/** * @param array $accountData */ public function getApplicationUser(array $accountData) { $user = $this->userService->findById($accountData['id']); if ($user) { // populate account data to SiteUser $user = $this->userService->hydrateAccountData($user, $accountData); // set user roles $user->setRoles($this->userService->getUserRolesForSecurityToken($user)); //TODO: not sure if this is the place to set the session; this // shouldn't be part of the user provider's responsibilities $this->userService->setSessionVariables($user); return $user; } else { // check in the admin user if these credentials belong to internal admin $adminUser = $this->adminUserService->findById($accountData['id']); return $adminUser; } return null; }
/** * @depends testCreate * @param AdminUser $adminUser */ public function testFindbyId(AdminUser $adminUser) { $accountId = $adminUser->getAccountId(); $result = $this->service->findById($accountId, true); $this->assertNotEmpty($result); }