added tests for blogPost

This commit is contained in:
2024-01-10 13:41:43 +03:00
parent d96954f4b4
commit 93ca684f67
22 changed files with 548 additions and 28 deletions

View File

@@ -0,0 +1,35 @@
<?php
namespace Tests\Feature\BlogPost;
use Tests\TestCase;
use App\Models\User;
use App\Models\BlogPost;
use Illuminate\Foundation\Testing\RefreshDatabase;
class ShowTest extends TestCase
{
use RefreshDatabase;
private BlogPost $blogPost;
protected User $user;
public function setUp(): void
{
$this->refreshApplicationWithLocale('en');
$this->user = User::inRandomOrder()->first();
$this->blogPost = BlogPost::inRandomOrder()->first();
}
public function test_show_page_success(): void
{
$response = $this->actingAs($this->user)
->get(route('blog_post.show', $this->blogPost));
$response
->assertOk();
}
}