diff --git a/tests/Feature/Backstage/ViewConcertListTest.php b/tests/Feature/Backstage/ViewConcertListTest.php index 63c1ebb..da01d9a 100644 --- a/tests/Feature/Backstage/ViewConcertListTest.php +++ b/tests/Feature/Backstage/ViewConcertListTest.php @@ -16,6 +16,23 @@ class ViewConcertListTest extends TestCase { use DatabaseMigrations; + protected function setUp() + { + parent::setUp(); + + TestResponse::macro('data', function ($key) { + return $this->original->getData()[$key]; + }); + + Collection::macro('assertContains', function ($value) { + Assert::assertTrue($this->contains($value), "Failed asserting that the collection contains the specified value."); + }); + + Collection::macro('assertNotContains', function ($value) { + Assert::assertFalse($this->contains($value), "Failed asserting that the collection does not contain the specified value."); + }); + } + /** @test */ function guests_cannot_view_a_promoters_concert_list() { @@ -39,9 +56,9 @@ class ViewConcertListTest extends TestCase $response = $this->actingAs($user)->get('/backstage/concerts'); $response->assertStatus(200); - $this->assertTrue($response->original->getData()['concerts']->contains($concertA)); - $this->assertTrue($response->original->getData()['concerts']->contains($concertB)); - $this->assertTrue($response->original->getData()['concerts']->contains($concertD)); - $this->assertFalse($response->original->getData()['concerts']->contains($concertC)); + $response->data('concerts')->assertContains($concertA); + $response->data('concerts')->assertContains($concertB); + $response->data('concerts')->assertContains($concertD); + $response->data('concerts')->assertNotContains($concertC); } }