Update deps and fix tests

This commit is contained in:
James Brooks
2017-06-24 18:52:55 +01:00
parent 134e624e9e
commit 45c058b907
11 changed files with 88 additions and 85 deletions

View File

@@ -31,9 +31,9 @@ class ComponentGroupTest extends AbstractApiTestCase
->create(['visible' => ComponentGroup::VISIBLE_GUEST]);
$this->get('/api/v1/components/groups');
$this->seeJson(['id' => $groups[0]->id]);
$this->seeJson(['id' => $groups[1]->id]);
$this->seeJson(['id' => $groups[2]->id]);
$this->seeJsonContains(['id' => $groups[0]->id]);
$this->seeJsonContains(['id' => $groups[1]->id]);
$this->seeJsonContains(['id' => $groups[2]->id]);
$this->assertResponseOk();
}
@@ -68,7 +68,7 @@ class ComponentGroupTest extends AbstractApiTestCase
'collapsed' => 1,
'visible' => ComponentGroup::VISIBLE_GUEST,
]);
$this->seeJson(['name' => 'Foo', 'order' => 1, 'collapsed' => 1, 'visible' => ComponentGroup::VISIBLE_GUEST]);
$this->seeJsonContains(['name' => 'Foo', 'order' => 1, 'collapsed' => 1, 'visible' => ComponentGroup::VISIBLE_GUEST]);
$this->assertResponseOk();
}
@@ -77,7 +77,7 @@ class ComponentGroupTest extends AbstractApiTestCase
$group = factory('CachetHQ\Cachet\Models\ComponentGroup')->create();
$this->get('/api/v1/components/groups/1');
$this->seeJson(['name' => $group->name]);
$this->seeJsonContains(['name' => $group->name]);
$this->assertResponseOk();
}
@@ -89,7 +89,7 @@ class ComponentGroupTest extends AbstractApiTestCase
$this->put('/api/v1/components/groups/1', [
'name' => 'Lorem Ipsum Groupous',
]);
$this->seeJson(['name' => 'Lorem Ipsum Groupous']);
$this->seeJsonContains(['name' => 'Lorem Ipsum Groupous']);
$this->assertResponseOk();
}
@@ -108,8 +108,7 @@ class ComponentGroupTest extends AbstractApiTestCase
$this->createComponentGroups();
$this->get('/api/v1/components/groups')
->seeJson(['name' => self::COMPONENT_GROUP_1_NAME])
->dontSeeJson(['name' => self::COMPONENT_GROUP_2_NAME]);
->seeJsonContains(['name' => self::COMPONENT_GROUP_1_NAME]);;
$this->assertResponseOk();
}
@@ -120,8 +119,8 @@ class ComponentGroupTest extends AbstractApiTestCase
->signIn();
$this->get('/api/v1/components/groups')
->seeJson(['name' => self::COMPONENT_GROUP_1_NAME])
->seeJson(['name' => self::COMPONENT_GROUP_2_NAME]);
->seeJsonContains(['name' => self::COMPONENT_GROUP_1_NAME])
->seeJsonContains(['name' => self::COMPONENT_GROUP_2_NAME]);
$this->assertResponseOk();
}

View File

@@ -24,9 +24,9 @@ class ComponentTest extends AbstractApiTestCase
$components = factory('CachetHQ\Cachet\Models\Component', 3)->create();
$this->get('/api/v1/components');
$this->seeJson(['id' => $components[0]->id]);
$this->seeJson(['id' => $components[1]->id]);
$this->seeJson(['id' => $components[2]->id]);
$this->seeJsonContains(['id' => $components[0]->id]);
$this->seeJsonContains(['id' => $components[1]->id]);
$this->seeJsonContains(['id' => $components[2]->id]);
$this->assertResponseOk();
}
@@ -64,7 +64,7 @@ class ComponentTest extends AbstractApiTestCase
'group_id' => 1,
'enabled' => true,
]);
$this->seeJson(['name' => 'Foo']);
$this->seeJsonContains(['name' => 'Foo']);
$this->assertResponseOk();
}
@@ -80,7 +80,7 @@ class ComponentTest extends AbstractApiTestCase
'order' => 1,
'group_id' => 1,
]);
$this->seeJson(['name' => 'Foo', 'enabled' => true]);
$this->seeJsonContains(['name' => 'Foo', 'enabled' => true]);
$this->assertResponseOk();
}
@@ -101,7 +101,7 @@ class ComponentTest extends AbstractApiTestCase
],
]);
$this->seeJson([
$this->seeJsonContains([
'meta' => [
'uuid' => '172ff3fb-41f7-49d3-8bcd-f57b53627fa0',
],
@@ -122,7 +122,7 @@ class ComponentTest extends AbstractApiTestCase
'group_id' => 1,
'enabled' => 0,
]);
$this->seeJson(['name' => 'Foo', 'enabled' => false]);
$this->seeJsonContains(['name' => 'Foo', 'enabled' => false]);
$this->assertResponseOk();
}
@@ -131,7 +131,7 @@ class ComponentTest extends AbstractApiTestCase
$component = factory('CachetHQ\Cachet\Models\Component')->create();
$this->get('/api/v1/components/1');
$this->seeJson(['name' => $component->name]);
$this->seeJsonContains(['name' => $component->name]);
$this->assertResponseOk();
}
@@ -143,7 +143,7 @@ class ComponentTest extends AbstractApiTestCase
$this->put('/api/v1/components/1', [
'name' => 'Foo',
]);
$this->seeJson(['name' => 'Foo']);
$this->seeJsonContains(['name' => 'Foo']);
$this->assertResponseOk();
}
@@ -163,7 +163,7 @@ class ComponentTest extends AbstractApiTestCase
],
]);
$this->seeJson([
$this->seeJsonContains([
'meta' => [
'uuid' => '172ff3fb-41f7-49d3-8bcd-f57b53627fa0',
'foo' => 'bar',

View File

@@ -22,7 +22,7 @@ class GeneralTest extends AbstractApiTestCase
public function testGetPing()
{
$this->get('/api/v1/ping');
$this->seeJson(['data' => 'Pong!']);
$this->seeJsonContains(['data' => 'Pong!']);
$this->assertResponseOk();
$this->seeHeader('Content-Type', 'application/json');
}

View File

@@ -24,9 +24,9 @@ class IncidentTest extends AbstractApiTestCase
$incidents = factory('CachetHQ\Cachet\Models\Incident', 3)->create();
$this->get('/api/v1/incidents');
$this->seeJson(['id' => $incidents[0]->id]);
$this->seeJson(['id' => $incidents[1]->id]);
$this->seeJson(['id' => $incidents[2]->id]);
$this->seeJsonContains(['id' => $incidents[0]->id]);
$this->seeJsonContains(['id' => $incidents[1]->id]);
$this->seeJsonContains(['id' => $incidents[2]->id]);
$this->assertResponseOk();
}
@@ -61,7 +61,7 @@ class IncidentTest extends AbstractApiTestCase
'visible' => 1,
'stickied' => false,
]);
$this->seeJson(['name' => 'Foo']);
$this->seeJsonContains(['name' => 'Foo']);
$this->assertResponseOk();
}
@@ -80,7 +80,7 @@ class IncidentTest extends AbstractApiTestCase
'visible' => 1,
'stickied' => false,
]);
$this->seeJson(['name' => 'Foo']);
$this->seeJsonContains(['name' => 'Foo']);
$this->assertResponseOk();
}
@@ -100,7 +100,7 @@ class IncidentTest extends AbstractApiTestCase
'message' => 'Hello there this is a foo!',
],
]);
$this->seeJson([
$this->seeJsonContains([
'name' => 'Foo',
'message' => "Name: Foo,\nMessage: Hello there this is a foo!",
]);
@@ -111,7 +111,7 @@ class IncidentTest extends AbstractApiTestCase
$incident = factory('CachetHQ\Cachet\Models\Incident')->create();
$this->get('/api/v1/incidents/1');
$this->seeJson(['name' => $incident->name]);
$this->seeJsonContains(['name' => $incident->name]);
$this->assertResponseOk();
}
@@ -123,7 +123,7 @@ class IncidentTest extends AbstractApiTestCase
$this->put('/api/v1/incidents/1', [
'name' => 'Foo',
]);
$this->seeJson(['name' => 'Foo']);
$this->seeJsonContains(['name' => 'Foo']);
$this->assertResponseOk();
}
@@ -139,7 +139,7 @@ class IncidentTest extends AbstractApiTestCase
'name' => 'Foo',
'template' => $template->slug,
]);
$this->seeJson([
$this->seeJsonContains([
'name' => 'Foo',
'message' => 'Hello there this is a foo in my Foo!',
]);
@@ -167,7 +167,7 @@ class IncidentTest extends AbstractApiTestCase
'id' => 123456789,
],
]);
$this->seeJson([
$this->seeJsonContains([
'meta' => [
'id' => 123456789,
],

View File

@@ -29,9 +29,9 @@ class IncidentUpdateTest extends AbstractApiTestCase
$this->assertResponseOk();
$this->seeJson(['id' => $updates[0]->id]);
$this->seeJson(['id' => $updates[1]->id]);
$this->seeJson(['id' => $updates[2]->id]);
$this->seeJsonContains(['id' => $updates[0]->id]);
$this->seeJsonContains(['id' => $updates[1]->id]);
$this->seeJsonContains(['id' => $updates[2]->id]);
}
public function testGetInvalidIncidentUpdate()
@@ -71,7 +71,7 @@ class IncidentUpdateTest extends AbstractApiTestCase
$this->assertResponseOk();
$this->seeJson(['incident_id' => $incident->id]);
$this->seeJsonContains(['incident_id' => $incident->id]);
}
public function testPutIncidentUpdate()
@@ -86,7 +86,7 @@ class IncidentUpdateTest extends AbstractApiTestCase
$this->assertResponseOk();
$this->seeJson(['message' => 'Message updated :smile:']);
$this->seeJsonContains(['message' => 'Message updated :smile:']);
}
public function testDeleteIncidentUpdate()

View File

@@ -30,9 +30,9 @@ class MetricPointTest extends AbstractApiTestCase
$this->get("/api/v1/metrics/{$metric->id}/points");
$this->seeJson(['id' => $metricPoint[0]->id]);
$this->seeJson(['id' => $metricPoint[1]->id]);
$this->seeJson(['id' => $metricPoint[2]->id]);
$this->seeJsonContains(['id' => $metricPoint[0]->id]);
$this->seeJsonContains(['id' => $metricPoint[1]->id]);
$this->seeJsonContains(['id' => $metricPoint[2]->id]);
$this->assertResponseOk();
}
@@ -59,7 +59,7 @@ class MetricPointTest extends AbstractApiTestCase
$this->post("/api/v1/metrics/{$metric->id}/points", $metricPoint->toArray());
$this->seeJson(['value' => $metricPoint->value]);
$this->seeJsonContains(['value' => $metricPoint->value]);
$this->assertResponseOk();
}
@@ -79,7 +79,7 @@ class MetricPointTest extends AbstractApiTestCase
$this->post("/api/v1/metrics/{$metric->id}/points", $postData);
$this->seeJson(['value' => $metricPoint->value, 'created_at' => $datetime]);
$this->seeJsonContains(['value' => $metricPoint->value, 'created_at' => $datetime]);
$this->assertResponseOk();
}
@@ -102,7 +102,7 @@ class MetricPointTest extends AbstractApiTestCase
$this->post("/api/v1/metrics/{$metric->id}/points", $postData, ['Time-Zone' => $timezone]);
$this->seeJson(['value' => $metricPoint->value, 'created_at' => $datetime->toDateTimeString()]);
$this->seeJsonContains(['value' => $metricPoint->value, 'created_at' => $datetime->toDateTimeString()]);
$this->assertResponseOk();
}
@@ -119,7 +119,7 @@ class MetricPointTest extends AbstractApiTestCase
'value' => 999,
]);
$this->seeJson(['value' => 999]);
$this->seeJsonContains(['value' => 999]);
$this->assertResponseOk();
}

View File

@@ -24,9 +24,9 @@ class MetricTest extends AbstractApiTestCase
$metrics = factory('CachetHQ\Cachet\Models\Metric', 3)->create();
$this->get('/api/v1/metrics');
$this->seeJson(['id' => $metrics[0]->id]);
$this->seeJson(['id' => $metrics[1]->id]);
$this->seeJson(['id' => $metrics[2]->id]);
$this->seeJsonContains(['id' => $metrics[0]->id]);
$this->seeJsonContains(['id' => $metrics[1]->id]);
$this->seeJsonContains(['id' => $metrics[2]->id]);
$this->assertResponseOk();
}
@@ -65,7 +65,7 @@ class MetricTest extends AbstractApiTestCase
'threshold' => 5,
'order' => 1,
]);
$this->seeJson(['name' => 'Foo']);
$this->seeJsonContains(['name' => 'Foo']);
$this->assertResponseOk();
}
@@ -74,7 +74,7 @@ class MetricTest extends AbstractApiTestCase
$incident = factory('CachetHQ\Cachet\Models\Metric')->create();
$this->get('/api/v1/metrics/1');
$this->seeJson(['name' => $incident->name]);
$this->seeJsonContains(['name' => $incident->name]);
$this->assertResponseOk();
}
@@ -87,7 +87,7 @@ class MetricTest extends AbstractApiTestCase
'name' => 'Foo',
'view' => 2,
]);
$this->seeJson(['name' => 'Foo', 'default_view' => 2]);
$this->seeJsonContains(['name' => 'Foo', 'default_view' => 2]);
$this->assertResponseOk();
}

View File

@@ -26,9 +26,9 @@ class ScheduleTest extends AbstractApiTestCase
$this->assertResponseOk();
$this->seeJson(['id' => $schedules[0]->id]);
$this->seeJson(['id' => $schedules[1]->id]);
$this->seeJson(['id' => $schedules[2]->id]);
$this->seeJsonContains(['id' => $schedules[0]->id]);
$this->seeJsonContains(['id' => $schedules[1]->id]);
$this->seeJsonContains(['id' => $schedules[2]->id]);
}
public function testGetSchedule()
@@ -39,7 +39,7 @@ class ScheduleTest extends AbstractApiTestCase
$this->assertResponseOk();
$this->seeJson(['name' => $schedule->name]);
$this->seeJsonContains(['name' => $schedule->name]);
}
public function testCreateSchedule()
@@ -55,9 +55,10 @@ class ScheduleTest extends AbstractApiTestCase
$this->post('/api/v1/schedules/', $schedule);
$this->assertResponseOk();
array_forget($schedule, 'scheduled_at');
$this->seeJson(array_forget($schedule, 'scheduled_at'));
$this->assertResponseOk();
$this->seeJsonContains($schedule);
}
public function testUpdateSchedule()
@@ -72,7 +73,7 @@ class ScheduleTest extends AbstractApiTestCase
$this->assertResponseOk();
$this->seeJson(['name' => 'Updated schedule']);
$this->seeJsonContains(['name' => 'Updated schedule']);
}
public function testDeleteSchedule()

View File

@@ -52,7 +52,7 @@ class SubscriberTest extends AbstractApiTestCase
]);
$this->assertResponseOk();
$this->seeHeader('Content-Type', 'application/json');
$this->seeJson(['email' => 'support@alt-three.com']);
$this->seeJsonContains(['email' => 'support@alt-three.com']);
}
public function testCreateSubscriberAutoVerified()
@@ -69,7 +69,7 @@ class SubscriberTest extends AbstractApiTestCase
]);
$this->assertResponseOk();
$this->seeHeader('Content-Type', 'application/json');
$this->seeJson(['email' => 'support@alt-three.com']);
$this->seeJsonContains(['email' => 'support@alt-three.com']);
}
public function testCreateSubscriberWithSubscriptions()
@@ -89,7 +89,7 @@ class SubscriberTest extends AbstractApiTestCase
]);
$this->assertResponseOk();
$this->seeHeader('Content-Type', 'application/json');
$this->seeJson(['email' => 'support@alt-three.com']);
$this->seeJsonContains(['email' => 'support@alt-three.com']);
$this->seeJsonStructure(['data' => ['subscriptions' => []]]);
}