parsaaghayi-backend/tests/Feature/Blog/HomeTest.php
parsa aghaei 37a507c742
Some checks failed
Deploy Backend / deploy (push) Failing after 2m16s
4.1-4.3: add PHPUnit feature tests for all endpoints + factories
2026-06-23 18:37:14 +03:30

30 lines
665 B
PHP

<?php
namespace Tests\Feature\Blog;
use App\Models\Blog\Category;
use App\Models\Blog\Post;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class HomeTest extends TestCase
{
use RefreshDatabase;
public function test_can_get_homepage()
{
Post::factory()->count(5)->create();
Category::factory()->count(3)->create();
$response = $this->getJson('/api/blog/homepage');
$response->assertStatus(200)
->assertJsonStructure([
'latest_posts',
'latest_categories',
'most_viewed_posts',
'random_posts',
]);
}
}