ramadanproject/tests/Feature/ExpireReservationsCommandTest.php
Ahmed Darrazi 45a147253c
Some checks failed
tests / ci (push) Failing after 6m13s
linter / quality (pull_request) Failing after 58s
linter / quality (push) Failing after 1m19s
tests / ci (pull_request) Failing after 5m28s
feat(public-grid): add QA, quickstart, decision docs; scheduler docs; ignore files; tasks updates; run pint
2026-01-03 04:56:12 +01:00

16 lines
609 B
PHP

<?php
use App\Models\Reservation;
it('expires past-held reservations when command runs', function () {
Reservation::query()->delete();
$r1 = Reservation::create(['x' => 0, 'y' => 0, 'w' => 1, 'h' => 1, 'status' => 'held', 'reserved_until' => now()->subMinutes(10)]);
$r2 = Reservation::create(['x' => 5, 'y' => 5, 'w' => 1, 'h' => 1, 'status' => 'held', 'reserved_until' => now()->addMinutes(10)]);
$this->artisan('reservations:expire')->assertExitCode(0);
expect(Reservation::find($r1->id)->status)->toBe('expired');
expect(Reservation::find($r2->id)->status)->toBe('held');
});