public function testBindsUsersAndAttributesAndGroups() { $userId = 123; $pageNumber = 1; $pageSize = 10; $result = new UserItemView(); $result->Id = $userId; $results = array($result); $userList = new PageableData($results); $resourceList = array(new FakeBookableResource(1)); $attributeList = array(new FakeCustomAttribute(1, '1')); $this->page->expects($this->once())->method('GetPageNumber')->will($this->returnValue($pageNumber)); $this->page->expects($this->once())->method('GetPageSize')->will($this->returnValue($pageSize)); $this->page->expects($this->once())->method('GetFilterStatusId')->will($this->returnValue(AccountStatus::ALL)); $this->userRepo->expects($this->once())->method('GetList')->with($this->equalTo($pageNumber), $this->equalTo($pageSize), $this->isNull(), $this->isNull(), $this->isNull(), $this->equalTo(AccountStatus::ALL))->will($this->returnValue($userList)); $user = new FakeUser(); $this->userRepo->expects($this->once())->method('LoadById')->with($this->fakeUser->UserId)->will($this->returnValue($user)); $this->page->expects($this->once())->method('BindUsers')->with($this->equalTo($userList->Results())); $this->page->expects($this->once())->method('BindPageInfo')->with($this->equalTo($userList->PageInfo())); $this->resourceRepo->expects($this->once())->method('GetResourceList')->will($this->returnValue($resourceList)); $this->page->expects($this->once())->method('BindResources')->with($this->equalTo($resourceList)); $this->attributeService->expects($this->once())->method('GetByCategory')->with($this->equalTo(CustomAttributeCategory::USER))->will($this->returnValue($attributeList)); $this->page->expects($this->once())->method('BindAttributeList')->with($this->equalTo($attributeList)); $groups = array(new GroupItemView(1, 'gn')); $groupList = new PageableData($groups); $this->groupViewRepository->expects($this->once())->method('GetList')->will($this->returnValue($groupList)); $this->page->expects($this->once())->method('BindGroups')->with($this->equalTo($groups)); $this->presenter->PageLoad(); }
public function ProcessPageLoad() { $this->_presenter->PageLoad(); $config = Configuration::Instance(); $resources = Resources::GetInstance(); $this->Set('statusDescriptions', array(AccountStatus::ALL => $resources->GetString('All'), AccountStatus::ACTIVE => $resources->GetString('Active'), AccountStatus::AWAITING_ACTIVATION => $resources->GetString('Pending'), AccountStatus::INACTIVE => $resources->GetString('Inactive'))); $this->Set('Timezone', $config->GetDefaultTimezone()); $this->Set('Timezones', $GLOBALS['APP_TIMEZONES']); $this->Set('Languages', $GLOBALS['APP_TIMEZONES']); $this->Set('ManageGroupsUrl', Pages::MANAGE_GROUPS); $this->Set('ManageReservationsUrl', Pages::MANAGE_RESERVATIONS); $this->Set('FilterStatusId', $this->GetFilterStatusId()); $this->Set('PerUserColors', $config->GetSectionKey(ConfigSection::SCHEDULE, ConfigKeys::SCHEDULE_PER_USER_COLORS, new BooleanConverter())); $this->RenderTemplate(); }