Last active
October 29, 2020 13:59
Revisions
-
davidpeach created this gist
Oct 29, 2020 .There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,30 @@ <?php namespace Tests\Feature; use App\Models\Post; use Illuminate\Database\Eloquent\Collection; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Foundation\Testing\RefreshDatabase; use Illuminate\Foundation\Testing\WithFaker; use Tests\TestCase; class ViewPostsTest extends TestCase { use HasFactory; use RefreshDatabase; /** @test */ public function a_guest_can_view_the_blog_post_archive() { list($postA, $postB, $postC) = Post::factory()->count(3)->create(); $response = $this->get('/posts'); $response->assertViewHas('posts', new Collection([ $postA->fresh(), $postB->fresh(), $postC->fresh(), ])); } }