16 lines
609 B
PHP
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');
|
|
});
|