public function testShowsSevenDaysIfWeAreShowingFullWeek() { $timezone = 'America/Chicago'; // saturday $selectedDate = Date::Parse('2009-07-18', $timezone); $startDay = 0; $daysVisible = 100; // previous sunday $expectedStart = Date::Parse('2009-07-12', $timezone); $expectedEnd = $expectedStart->AddDays(7); $expectedScheduleDates = new DateRange($expectedStart, $expectedEnd); $user = new UserSession(1); $user->Timezone = $timezone; $this->fakeConfig->SetTimezone($timezone); $schedule = $this->getMock('ISchedule'); $schedulePage = $this->getMock('ISchedulePage'); $schedulePage->expects($this->once())->method('GetSelectedDate')->will($this->returnValue($selectedDate->Format("Y-m-d"))); $schedulePage->expects($this->once())->method('GetShowFullWeek')->will($this->returnValue(true)); $schedule->expects($this->once())->method('GetWeekdayStart')->will($this->returnValue($startDay)); $schedule->expects($this->once())->method('GetDaysVisible')->will($this->returnValue($daysVisible)); $pageBuilder = new SchedulePageBuilder(); $dates = $pageBuilder->GetScheduleDates($user, $schedule, $schedulePage); $this->assertEquals($expectedScheduleDates, $dates); }
public function GetScheduleDates(UserSession $user, ISchedule $schedule, ISchedulePage $page) { if ($this->startDate != null && $this->endDate != null) { return new DateRange($this->startDate, $this->endDate->AddDays(1)); } return parent::GetScheduleDates($user, $schedule, $page); }