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
+31
View File
@@ -0,0 +1,31 @@
<?php
namespace Tests\Feature\Models;
use App\Models\OtpCode;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Carbon;
use Tests\TestCase;
class OtpCodeTest extends TestCase
{
use RefreshDatabase;
public function test_is_expired_is_false_before_expiry(): void
{
$this->assertFalse(OtpCode::factory()->create()->isExpired());
}
public function test_is_expired_is_true_after_expiry(): void
{
$this->assertTrue(OtpCode::factory()->expired()->create()->isExpired());
}
public function test_is_expired_is_false_at_exact_expiry_moment(): void
{
Carbon::setTestNow('2026-09-21 10:00:00');
$otp = OtpCode::factory()->create(['expires_at' => now()]);
$this->assertFalse($otp->isExpired());
}
}