/**
  * @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 testUpdate(AdminUser $adminUser)
 {
     //test for valid adminuser
     $adminUser->setFirstName('edited name');
     $result = $this->service->update($adminUser);
     $this->assertNotEmpty($result);
     //test for empty adminuser
     $adminUser = new AdminUser();
     $result = $this->service->update($adminUser);
     $this->assertEmpty($result);
 }