Added casts properties to all models, re-ordered model properties. Fixes #916
This commit is contained in:
@@ -23,9 +23,9 @@ class ComponentGroupTest extends AbstractTestCase
|
||||
$groups = factory('CachetHQ\Cachet\Models\ComponentGroup', 3)->create();
|
||||
|
||||
$this->get('/api/v1/components/groups');
|
||||
$this->seeJson(['id' => (string) $groups[0]->id]);
|
||||
$this->seeJson(['id' => (string) $groups[1]->id]);
|
||||
$this->seeJson(['id' => (string) $groups[2]->id]);
|
||||
$this->seeJson(['id' => $groups[0]->id]);
|
||||
$this->seeJson(['id' => $groups[1]->id]);
|
||||
$this->seeJson(['id' => $groups[2]->id]);
|
||||
$this->assertResponseOk();
|
||||
}
|
||||
|
||||
|
||||
@@ -23,9 +23,9 @@ class ComponentTest extends AbstractTestCase
|
||||
$components = factory('CachetHQ\Cachet\Models\Component', 3)->create();
|
||||
|
||||
$this->get('/api/v1/components');
|
||||
$this->seeJson(['id' => (string) $components[0]->id]);
|
||||
$this->seeJson(['id' => (string) $components[1]->id]);
|
||||
$this->seeJson(['id' => (string) $components[2]->id]);
|
||||
$this->seeJson(['id' => $components[0]->id]);
|
||||
$this->seeJson(['id' => $components[1]->id]);
|
||||
$this->seeJson(['id' => $components[2]->id]);
|
||||
$this->assertResponseOk();
|
||||
}
|
||||
|
||||
|
||||
@@ -23,9 +23,9 @@ class IncidentTest extends AbstractTestCase
|
||||
$incidents = factory('CachetHQ\Cachet\Models\Incident', 3)->create();
|
||||
|
||||
$this->get('/api/v1/incidents');
|
||||
$this->seeJson(['id' => (string) $incidents[0]->id]);
|
||||
$this->seeJson(['id' => (string) $incidents[1]->id]);
|
||||
$this->seeJson(['id' => (string) $incidents[2]->id]);
|
||||
$this->seeJson(['id' => $incidents[0]->id]);
|
||||
$this->seeJson(['id' => $incidents[1]->id]);
|
||||
$this->seeJson(['id' => $incidents[2]->id]);
|
||||
$this->assertResponseOk();
|
||||
}
|
||||
|
||||
|
||||
@@ -26,9 +26,9 @@ class MetricPointTest extends AbstractTestCase
|
||||
]);
|
||||
|
||||
$this->get("/api/v1/metrics/{$metric->id}/points");
|
||||
$this->seeJson(['id' => (string) $metricPoint[0]->id]);
|
||||
$this->seeJson(['id' => (string) $metricPoint[1]->id]);
|
||||
$this->seeJson(['id' => (string) $metricPoint[2]->id]);
|
||||
$this->seeJson(['id' => $metricPoint[0]->id]);
|
||||
$this->seeJson(['id' => $metricPoint[1]->id]);
|
||||
$this->seeJson(['id' => $metricPoint[2]->id]);
|
||||
}
|
||||
|
||||
public function testPostMetricPointUnauthorized()
|
||||
@@ -52,7 +52,7 @@ class MetricPointTest extends AbstractTestCase
|
||||
]);
|
||||
|
||||
$this->post("/api/v1/metrics/{$metric->id}/points", $metricPoint->toArray());
|
||||
$this->seeJson(['value' => (string) $metricPoint->value]);
|
||||
$this->seeJson(['value' => $metricPoint->value]);
|
||||
}
|
||||
|
||||
public function testPostMetricPointTimestamp()
|
||||
@@ -69,7 +69,7 @@ class MetricPointTest extends AbstractTestCase
|
||||
$postData['timestamp'] = $timestamp;
|
||||
|
||||
$this->post("/api/v1/metrics/{$metric->id}/points", $postData);
|
||||
$this->seeJson(['value' => (string) $metricPoint->value, 'created_at' => $datetime]);
|
||||
$this->seeJson(['value' => $metricPoint->value, 'created_at' => $datetime]);
|
||||
}
|
||||
|
||||
public function testPutMetricPoint()
|
||||
@@ -82,7 +82,7 @@ class MetricPointTest extends AbstractTestCase
|
||||
$this->put("/api/v1/metrics/{$metric->id}/points/{$metricPoint->id}", [
|
||||
'value' => 999,
|
||||
]);
|
||||
$this->seeJson(['value' => '999']);
|
||||
$this->seeJson(['value' => 999]);
|
||||
}
|
||||
|
||||
public function testDeleteMetricPoint()
|
||||
|
||||
@@ -23,9 +23,9 @@ class MetricTest extends AbstractTestCase
|
||||
$metrics = factory('CachetHQ\Cachet\Models\Metric', 3)->create();
|
||||
|
||||
$this->get('/api/v1/metrics');
|
||||
$this->seeJson(['id' => (string) $metrics[0]->id]);
|
||||
$this->seeJson(['id' => (string) $metrics[1]->id]);
|
||||
$this->seeJson(['id' => (string) $metrics[2]->id]);
|
||||
$this->seeJson(['id' => $metrics[0]->id]);
|
||||
$this->seeJson(['id' => $metrics[1]->id]);
|
||||
$this->seeJson(['id' => $metrics[2]->id]);
|
||||
$this->assertResponseOk();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user