public function testUsesTwoWeekSpanWhenNoDateFilterProvided() { $userTimezone = $this->fakeUser->Timezone; $defaultStart = Date::Now()->AddDays(-7)->ToTimezone($userTimezone)->GetDate(); $defaultEnd = Date::Now()->AddDays(7)->ToTimezone($userTimezone)->GetDate(); $searchedScheduleId = 15; $searchedResourceId = 105; $this->page->expects($this->atLeastOnce())->method('GetStartDate')->will($this->returnValue(null)); $this->page->expects($this->atLeastOnce())->method('GetEndDate')->will($this->returnValue(null)); $this->page->expects($this->once())->method('GetScheduleId')->will($this->returnValue($searchedScheduleId)); $this->page->expects($this->once())->method('GetResourceId')->will($this->returnValue($searchedResourceId)); $filter = $this->GetExpectedFilter($defaultStart, $defaultEnd, $searchedScheduleId, $searchedResourceId); $data = new PageableData(); $this->blackoutsService->expects($this->once())->method('LoadFiltered')->with($this->anything(), $this->anything(), $this->equalTo($filter), $this->equalTo($this->fakeUser))->will($this->returnValue($data)); $this->page->expects($this->once())->method('SetStartDate')->with($this->equalTo($defaultStart)); $this->page->expects($this->once())->method('SetEndDate')->with($this->equalTo($defaultEnd)); $this->page->expects($this->once())->method('SetScheduleId')->with($this->equalTo($searchedScheduleId)); $this->page->expects($this->once())->method('SetResourceId')->with($this->equalTo($searchedResourceId)); $this->presenter->PageLoad($userTimezone); }
public function ProcessPageLoad() { $userTimezone = $this->server->GetUserSession()->Timezone; $this->Set('Timezone', $userTimezone); $this->Set('AddStartDate', Date::Now()->ToTimezone($userTimezone)); $this->Set('AddEndDate', Date::Now()->ToTimezone($userTimezone)); $this->presenter->PageLoad($userTimezone); }