Add feature tests for Doctor-related functionalities

This commit is contained in:
2026-09-21 05:41:06 +03:30
parent e987a528ef
commit 6e92ebaada
29 changed files with 2634 additions and 29 deletions
@@ -0,0 +1,38 @@
<?php
namespace Tests\Feature\Http\Client\Doctor;
use App\Models\Document;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Inertia\Testing\AssertableInertia as Assert;
use Tests\TestCase;
class DocumentControllerTest extends TestCase
{
use RefreshDatabase;
public function test_routes_require_authentication(): void
{
$this->get(route('dashboard.documents.index'))->assertRedirect(route('login'));
}
public function test_index_lists_pending_documents_of_user(): void
{
$user = User::factory()->create();
Document::factory()->count(3)->registered()->create(['requester_id' => $user->id]);
Document::factory()->registered()->create();
$this->actingAs($user)->get(route('dashboard.documents.index'))
->assertOk()
->assertInertia(fn (Assert $page) => $page->component('Dashboard/Documents/Index')->has('documents.data', 3));
}
public function test_show_redirects_to_case_page(): void
{
$document = Document::factory()->create();
$this->actingAs($document->requester)->get(route('dashboard.documents.show', $document))
->assertRedirect(route('dashboard.cases.show', $document));
}
}