public function ProcessDataRequest($dataRequest) { if ($dataRequest == 'permissions') { $this->page->SetJsonResponse($this->GetUserResourcePermissions()); } elseif ($dataRequest == 'groups') { $this->page->SetJsonResponse($this->GetUserGroups()); } elseif ($dataRequest == 'all') { $users = $this->userRepository->GetAll(); $this->page->SetJsonResponse($users); } }
public function testGetAllUsersReturnsAllActiveUsers() { $timezone = 'UTC'; $language = 'en_us'; $preferences = 'n1=v1'; $userRows = array(array(ColumnNames::USER_ID => 1, ColumnNames::FIRST_NAME => "f1", ColumnNames::LAST_NAME => 'l1', ColumnNames::EMAIL => 'e1', ColumnNames::TIMEZONE_NAME => $timezone, ColumnNames::LANGUAGE_CODE => $language), array(ColumnNames::USER_ID => 2, ColumnNames::FIRST_NAME => "f2", ColumnNames::LAST_NAME => 'l2', ColumnNames::EMAIL => 'e2', ColumnNames::TIMEZONE_NAME => $timezone, ColumnNames::LANGUAGE_CODE => $language, ColumnNames::USER_PREFERENCES => $preferences), array(ColumnNames::USER_ID => 3, ColumnNames::FIRST_NAME => "f3", ColumnNames::LAST_NAME => 'l3', ColumnNames::EMAIL => 'e3', ColumnNames::TIMEZONE_NAME => $timezone, ColumnNames::LANGUAGE_CODE => $language)); $this->db->SetRows($userRows); $userRepository = new UserRepository(); $users = $userRepository->GetAll(); $user1 = new UserDto(1, "f1", "l1", "e1", $timezone, $language); $user2 = new UserDto(2, "f2", "l2", "e2", $timezone, $language, $preferences); $user3 = new UserDto(3, "f3", "l3", "e3", $timezone, $language); $getAllUsersCommand = new GetAllUsersByStatusCommand(AccountStatus::ACTIVE); $this->assertEquals($user1, $users[0]); $this->assertEquals($user2, $users[1]); $this->assertEquals($user3, $users[2]); $this->assertEquals(1, count($this->db->_Commands)); $this->assertEquals($getAllUsersCommand, $this->db->_Commands[0]); }