feat: add comprehensive tests for Medium, OtpCode, Shift models and various Enums

This commit is contained in:
2026-09-21 05:47:44 +03:30
parent 6e92ebaada
commit 0d16d8f512
8 changed files with 289 additions and 8 deletions
+38
View File
@@ -0,0 +1,38 @@
<?php
namespace Tests\Feature\Models;
use App\Models\Shift;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class ShiftTest extends TestCase
{
use RefreshDatabase;
public function test_active_scope_returns_only_active_shifts(): void
{
$active = Shift::factory()->create();
Shift::factory()->inactive()->create();
$this->assertSame([$active->id], Shift::active()->pluck('id')->all());
}
public function test_open_scope_returns_only_unassigned_shifts(): void
{
$open = Shift::factory()->create();
Shift::factory()->forDoctor()->create();
$this->assertSame([$open->id], Shift::open()->pluck('id')->all());
}
public function test_scopes_can_be_chained(): void
{
$target = Shift::factory()->create();
Shift::factory()->inactive()->create();
Shift::factory()->forDoctor()->create();
Shift::factory()->forDoctor()->inactive()->create();
$this->assertSame([$target->id], Shift::active()->open()->pluck('id')->all());
}
}