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()); } }