public function testLoginAsReturnsASoapFaultIfUserNotLoggedIn() { $admin_session_hash = 'admin_session_hash'; $user = new MockUser(); $user->setReturnValue('isLoggedIn', false); $um = new MockUserManager(); $um->setReturnValue('getCurrentUser', $user); $user_soap_server = new User_SOAPServer($um); $user_name = 'toto'; $this->expectException('SoapFault'); $um->expectNever('loginAs'); $user_soap_server->loginAs($admin_session_hash, $user_name); }
/** * loginAs: open session for another user * * @global $Language * * @param string $admin_session_hash * @param string $username the user name (login) * * @return string the user session_hash */ function loginAs($admin_session_hash, $username) { $server = new User_SOAPServer(UserManager::instance()); return $server->loginAs($admin_session_hash, $username); }