diff --git a/composer.json b/composer.json index 9f2428f0..28246795 100644 --- a/composer.json +++ b/composer.json @@ -33,7 +33,7 @@ "alt-three/logger": "^1.3", "alt-three/throttle": "^1.0", "alt-three/twitter": "^1.0", - "alt-three/validator": "^1.5", + "alt-three/validator": "^2.0", "aws/aws-sdk-php": "^3.7", "backup-manager/laravel": "^1.1", "barryvdh/laravel-cors": "^0.8", @@ -60,7 +60,7 @@ "filp/whoops": "^2.1", "fzaninotto/faker": "^1.6", "graham-campbell/testbench-core": "^1.1", - "laravel/browser-kit-testing": "^1.0", + "laravel/browser-kit-testing": "^2.0", "mockery/mockery": "0.9.5", "nikic/php-parser": "^3.0", "phpunit/phpunit": "5.7.20", diff --git a/composer.lock b/composer.lock index de7e793e..43e8a25b 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "77606525b8e09d8109a508cac01d0d62", + "content-hash": "90bfac3954b22e9f681064ff48c1187a", "packages": [ { "name": "alt-three/badger", @@ -389,16 +389,16 @@ }, { "name": "alt-three/validator", - "version": "v1.6.0", + "version": "v2.0.0", "source": { "type": "git", "url": "https://github.com/AltThree/Validator.git", - "reference": "d61966e8f703643197f957816c765306bcf27664" + "reference": "08754a80d86804f0b8df5c06d3354c4534a430ab" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/AltThree/Validator/zipball/d61966e8f703643197f957816c765306bcf27664", - "reference": "d61966e8f703643197f957816c765306bcf27664", + "url": "https://api.github.com/repos/AltThree/Validator/zipball/08754a80d86804f0b8df5c06d3354c4534a430ab", + "reference": "08754a80d86804f0b8df5c06d3354c4534a430ab", "shasum": "" }, "require": { @@ -413,7 +413,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.6-dev" + "dev-master": "2.0-dev" } }, "autoload": { @@ -445,20 +445,20 @@ "logging", "validator" ], - "time": "2017-01-01T12:36:20+00:00" + "time": "2017-06-01T22:25:25+00:00" }, { "name": "aws/aws-sdk-php", - "version": "3.29.7", + "version": "3.30.2", "source": { "type": "git", "url": "https://github.com/aws/aws-sdk-php.git", - "reference": "76540001ff938c072db5367a7c945296984b999b" + "reference": "20539a38dc643a2700f80ae8647dbd1a05d3f7a9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/76540001ff938c072db5367a7c945296984b999b", - "reference": "76540001ff938c072db5367a7c945296984b999b", + "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/20539a38dc643a2700f80ae8647dbd1a05d3f7a9", + "reference": "20539a38dc643a2700f80ae8647dbd1a05d3f7a9", "shasum": "" }, "require": { @@ -525,7 +525,7 @@ "s3", "sdk" ], - "time": "2017-06-16T17:29:33+00:00" + "time": "2017-06-23T18:54:40+00:00" }, { "name": "backup-manager/backup-manager", @@ -1675,16 +1675,16 @@ }, { "name": "guzzlehttp/guzzle", - "version": "6.2.3", + "version": "6.3.0", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "8d6c6cc55186db87b7dc5009827429ba4e9dc006" + "reference": "f4db5a78a5ea468d4831de7f0bf9d9415e348699" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/8d6c6cc55186db87b7dc5009827429ba4e9dc006", - "reference": "8d6c6cc55186db87b7dc5009827429ba4e9dc006", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/f4db5a78a5ea468d4831de7f0bf9d9415e348699", + "reference": "f4db5a78a5ea468d4831de7f0bf9d9415e348699", "shasum": "" }, "require": { @@ -1694,9 +1694,12 @@ }, "require-dev": { "ext-curl": "*", - "phpunit/phpunit": "^4.0", + "phpunit/phpunit": "^4.0 || ^5.0", "psr/log": "^1.0" }, + "suggest": { + "psr/log": "Required for using the Log middleware" + }, "type": "library", "extra": { "branch-alias": { @@ -1733,7 +1736,7 @@ "rest", "web service" ], - "time": "2017-02-28T22:50:30+00:00" + "time": "2017-06-22T18:50:49+00:00" }, { "name": "guzzlehttp/promises", @@ -4698,16 +4701,16 @@ }, { "name": "laravel/browser-kit-testing", - "version": "v1.0.3", + "version": "v2.0.0", "source": { "type": "git", "url": "https://github.com/laravel/browser-kit-testing.git", - "reference": "0adfb725147815bff5516d157577f375a6e66ebd" + "reference": "23f1a7eefcbca0797305b236600aa5426c9528f2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/browser-kit-testing/zipball/0adfb725147815bff5516d157577f375a6e66ebd", - "reference": "0adfb725147815bff5516d157577f375a6e66ebd", + "url": "https://api.github.com/repos/laravel/browser-kit-testing/zipball/23f1a7eefcbca0797305b236600aa5426c9528f2", + "reference": "23f1a7eefcbca0797305b236600aa5426c9528f2", "shasum": "" }, "require": { @@ -4718,7 +4721,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-master": "2.0-dev" } }, "autoload": { @@ -4741,7 +4744,7 @@ "laravel", "testing" ], - "time": "2017-02-08T22:32:37+00:00" + "time": "2017-05-26T12:46:48+00:00" }, { "name": "mockery/mockery", diff --git a/tests/Api/ComponentGroupTest.php b/tests/Api/ComponentGroupTest.php index 2fa40fe6..9dd59194 100644 --- a/tests/Api/ComponentGroupTest.php +++ b/tests/Api/ComponentGroupTest.php @@ -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(); } diff --git a/tests/Api/ComponentTest.php b/tests/Api/ComponentTest.php index e7ae01c5..5eeec266 100644 --- a/tests/Api/ComponentTest.php +++ b/tests/Api/ComponentTest.php @@ -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', diff --git a/tests/Api/GeneralTest.php b/tests/Api/GeneralTest.php index c5e4d128..a94f5f3a 100644 --- a/tests/Api/GeneralTest.php +++ b/tests/Api/GeneralTest.php @@ -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'); } diff --git a/tests/Api/IncidentTest.php b/tests/Api/IncidentTest.php index 1ea01c8e..c54d9a91 100644 --- a/tests/Api/IncidentTest.php +++ b/tests/Api/IncidentTest.php @@ -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, ], diff --git a/tests/Api/IncidentUpdateTest.php b/tests/Api/IncidentUpdateTest.php index c23137a0..d46c98b0 100644 --- a/tests/Api/IncidentUpdateTest.php +++ b/tests/Api/IncidentUpdateTest.php @@ -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() diff --git a/tests/Api/MetricPointTest.php b/tests/Api/MetricPointTest.php index 283db778..7e12c9f7 100644 --- a/tests/Api/MetricPointTest.php +++ b/tests/Api/MetricPointTest.php @@ -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(); } diff --git a/tests/Api/MetricTest.php b/tests/Api/MetricTest.php index e65adc81..9b8e8e94 100644 --- a/tests/Api/MetricTest.php +++ b/tests/Api/MetricTest.php @@ -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(); } diff --git a/tests/Api/ScheduleTest.php b/tests/Api/ScheduleTest.php index 5ba3ee84..ea62d0b0 100644 --- a/tests/Api/ScheduleTest.php +++ b/tests/Api/ScheduleTest.php @@ -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() diff --git a/tests/Api/SubscriberTest.php b/tests/Api/SubscriberTest.php index 22fd9155..a04c696d 100644 --- a/tests/Api/SubscriberTest.php +++ b/tests/Api/SubscriberTest.php @@ -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' => []]]); }