public function testUsesTwoWeekSpanWhenNoDateFilterProvided() { $userTimezone = 'America/Chicago'; $defaultStart = Date::Now()->AddDays(-7)->ToTimezone($userTimezone)->GetDate(); $defaultEnd = Date::Now()->AddDays(7)->ToTimezone($userTimezone)->GetDate(); $searchedScheduleId = 15; $searchedResourceId = 105; $searchedStatusId = ReservationStatus::Pending; $searchedUserId = 111; $searchedReferenceNumber = 'abc123'; $searchedUserName = '******'; $searchedResourceStatusId = 292; $searchedResourceStatusReasonId = 4292; /** @var TestCustomAttribute[] $customAttributes */ $customAttributes = array(new TestCustomAttribute(1, 'something')); /** @var Attribute[] $attributes */ $attributes = array(new Attribute($customAttributes[0], 'value')); $this->resourceRepository->expects($this->once())->method('GetStatusReasons')->will($this->returnValue(array())); $this->page->expects($this->any())->method('FilterButtonPressed')->will($this->returnValue(true)); $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->atLeastOnce())->method('GetScheduleId')->will($this->returnValue($searchedScheduleId)); $this->page->expects($this->atLeastOnce())->method('GetResourceId')->will($this->returnValue($searchedResourceId)); $this->page->expects($this->atLeastOnce())->method('GetReservationStatusId')->will($this->returnValue($searchedStatusId)); $this->page->expects($this->atLeastOnce())->method('GetUserId')->will($this->returnValue($searchedUserId)); $this->page->expects($this->atLeastOnce())->method('GetUserName')->will($this->returnValue($searchedUserName)); $this->page->expects($this->atLeastOnce())->method('GetReferenceNumber')->will($this->returnValue($searchedReferenceNumber)); $this->page->expects($this->atLeastOnce())->method('GetResourceStatusFilterId')->will($this->returnValue($searchedResourceStatusId)); $this->page->expects($this->atLeastOnce())->method('GetResourceStatusReasonFilterId')->will($this->returnValue($searchedResourceStatusReasonId)); $this->page->expects($this->atLeastOnce())->method('GetAttributeFilters')->will($this->returnValue(array(new AttributeFormElement($customAttributes[0]->Id(), 'value')))); $filter = $this->GetExpectedFilter($defaultStart, $defaultEnd, $searchedReferenceNumber, $searchedScheduleId, $searchedResourceId, $searchedUserId, $searchedStatusId, $searchedResourceStatusId, $searchedResourceStatusReasonId, $attributes); $data = new PageableData($this->getReservations()); $this->reservationsService->expects($this->once())->method('LoadFiltered')->with($this->anything(), $this->anything(), $this->equalTo($filter), $this->equalTo($this->fakeUser))->will($this->returnValue($data)); $this->attributeService->expects($this->once())->method('GetByCategory')->with($this->equalTo(CustomAttributeCategory::RESERVATION))->will($this->returnValue($customAttributes)); $this->page->expects($this->once())->method('SetAttributeFilters')->with($attributes); $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('SetReferenceNumber')->with($this->equalTo($searchedReferenceNumber)); $this->page->expects($this->once())->method('SetScheduleId')->with($this->equalTo($searchedScheduleId)); $this->page->expects($this->once())->method('SetResourceId')->with($this->equalTo($searchedResourceId)); $this->page->expects($this->once())->method('SetReservationStatusId')->with($this->equalTo($searchedStatusId)); $this->page->expects($this->once())->method('SetUserId')->with($this->equalTo($searchedUserId)); $this->page->expects($this->once())->method('SetUserName')->with($this->equalTo($searchedUserName)); $this->page->expects($this->once())->method('SetUserName')->with($this->equalTo($searchedUserName)); $this->page->expects($this->once())->method('SetResourceStatusFilterId')->with($this->equalTo($searchedResourceStatusId)); $this->page->expects($this->once())->method('SetResourceStatusReasonFilterId')->with($this->equalTo($searchedResourceStatusReasonId)); $this->presenter->PageLoad($userTimezone); }
public function ProcessPageLoad() { $userTimezone = $this->server->GetUserSession()->Timezone; $this->Set('Timezone', $userTimezone); $this->Set('CsvExportUrl', ServiceLocator::GetServer()->GetUrl() . '&' . QueryStringKeys::FORMAT . '=csv'); $this->presenter->PageLoad($userTimezone); }