Files
UNIT3D/tests/Feature/Http/Controllers/ArticleControllerTest.shift.php
2023-07-11 18:27:15 +00:00

36 lines
1.1 KiB
PHP

<?php
uses(RefreshDatabase::class);
test('index returns an ok response', function (): void {
$this->markTestIncomplete('This test case was generated by Shift. When you are ready, remove this line and complete this test case.');
$articles = \App\Models\Article::factory()->times(3)->create();
$user = \App\Models\User::factory()->create();
$response = $this->actingAs($user)->get(route('articles.index'));
$response->assertOk();
$response->assertViewIs('article.index');
$response->assertViewHas('articles', $articles);
// TODO: perform additional assertions
});
test('show returns an ok response', function (): void {
$this->markTestIncomplete('This test case was generated by Shift. When you are ready, remove this line and complete this test case.');
$article = \App\Models\Article::factory()->create();
$user = \App\Models\User::factory()->create();
$response = $this->actingAs($user)->get(route('articles.show', [$article]));
$response->assertOk();
$response->assertViewIs('article.show');
$response->assertViewHas('article', $article);
// TODO: perform additional assertions
});
// test cases...