This commit is contained in:
a6a2f5842 2025-12-26 08:46:14 +01:00
parent 70adf0b0c6
commit 38e841a986
1 changed files with 19 additions and 0 deletions

View File

@ -490,6 +490,7 @@ class CartItemAvailabilityValidationTest extends TestCase
} }
$this->assertEquals(1, $readies, '1 item should be ready (1 single available)'); $this->assertEquals(1, $readies, '1 item should be ready (1 single available)');
$this->assertFalse($cart->is_ready_to_checkout);
$offset = 4; $offset = 4;
$cart->setDates( $cart->setDates(
@ -505,6 +506,7 @@ class CartItemAvailabilityValidationTest extends TestCase
} }
$this->assertEquals(3, $readies, '3 items should be ready'); $this->assertEquals(3, $readies, '3 items should be ready');
$this->assertTrue($cart->is_ready_to_checkout);
$offset = 3; $offset = 3;
$cart->setDates( $cart->setDates(
@ -523,5 +525,22 @@ class CartItemAvailabilityValidationTest extends TestCase
// In hotel-style bookings, checkout day = checkin day does NOT overlap, // In hotel-style bookings, checkout day = checkin day does NOT overlap,
// so all 3 singles should be available. // so all 3 singles should be available.
$this->assertEquals(3, $readies, '3 items should be ready (no overlap with offset 3)'); $this->assertEquals(3, $readies, '3 items should be ready (no overlap with offset 3)');
$this->assertTrue($cart->is_ready_to_checkout);
$offset = 2;
$cart->setDates(
$from->copy()->addDays($offset),
$until->copy()->addDays($offset)
);
$readies = 0;
foreach ($cart->items as $item) {
if ($item->is_ready_to_checkout) {
$readies++;
}
}
$this->assertEquals(1, $readies, '1 item should be ready (no overlap with offset 2)');
$this->assertFalse($cart->is_ready_to_checkout);
} }
} }