public function testItemIsNotIncludedIfItStartsAfterLastDisplayedPeriod() { $tz = 'America/Chicago'; $listDate = Date::Parse('2011-02-08', $tz); $layout = new ScheduleLayout($tz); $layout->AppendBlockedPeriod(Time::Parse('0:00', $tz), Time::Parse('2:00', $tz)); $layout->AppendPeriod(Time::Parse('2:00', $tz), Time::Parse('6:00', $tz)); $layout->AppendBlockedPeriod(Time::Parse('6:00', $tz), Time::Parse('0:00', $tz)); $item = new TestBlackoutItemView(1, Date::Parse('2011-02-08 6:00', $tz)->ToUtc(), Date::Parse('2011-02-09 1:00', $tz)->ToUtc(), 1); $r1 = new BlackoutListItem($item); $list = new ScheduleReservationList(array($r1), $layout, $listDate, true); $slots = $list->BuildSlots(); $periods = $layout->GetLayout($listDate, true); $expectedPeriod = $periods[0]; $this->assertEquals(new EmptyReservationSlot($expectedPeriod, $expectedPeriod, $listDate, true), $slots[0]); }
public function testFullDayPeriod() { $utc = 'UTC'; $sunday = Date::Parse('2013-01-06 00:00', 'America/Chicago'); $utcDate = $sunday->ToUtc(); $midnight = Time::Parse('00:00', $utc); $layout = new ScheduleLayout($utc); $layout->AppendPeriod($midnight, $midnight); $periods = $layout->GetLayout($sunday); $this->assertEquals(1, count($periods)); $period1 = new SchedulePeriod($utcDate->SetTime($midnight), $utcDate->SetTime($midnight, true)); $this->assertEquals($period1, $periods[0], 'Expected ' . $period1 . ' Actual ' . $periods[0]); }