4.1-4.3: add PHPUnit feature tests for all endpoints + factories
Deploy Backend / deploy (push) Failing after 2m16s
Deploy Backend / deploy (push) Failing after 2m16s
This commit is contained in:
1 parent
a4025256d4
commit
37a507c742
16 files changed
+504
-37
No files matched your search
@@ -0,0 +1,29 @@
|
||||
<?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',
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user