Last active
October 29, 2020 13:59
-
-
Save davidpeach/44ec36bda1f7a7dde2a2ea825b1be2b6 to your computer and use it in GitHub Desktop.
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 characters
<?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(), | |
])); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment