assertIsArray($times1); $this->assertNotEmpty($times1); $this->assertSame('00:00', $times1[0]['openingtime']); $this->assertSame('23:59', $times1[0]['closingtime']); // For location 2 (child of 1), it should inherit from 1 $times2 = OpeningTimes::forLocation(2); $this->assertIsArray($times2); $this->assertSame($times1, $times2); } public function testIsRoomOpenTrueWhenNoOpeningTimes(): void { // Remove opening times for all locations to simulate no configuration Database::exec('UPDATE location SET openingtime = NULL'); $this->assertTrue(OpeningTimes::isRoomOpen(3)); } public function testIsRoomOpenRespectsOffsets(): void { // Without offset, should be closed (opening time is in the future) $this->assertFalse(OpeningTimes::isRoomOpen(5)); // With openOffsetMin large enough to shift opening time earlier, it should be open $this->assertTrue(OpeningTimes::isRoomOpen(5, 90)); // Without offset, should be closed (opening time is in the future) $this->assertFalse(OpeningTimes::isRoomOpen(4)); // With closeOffsetMin large enough to shift closing time later, it should be open $this->assertTrue(OpeningTimes::isRoomOpen(4, 0, 90)); } }