function testdllValidation()
 {
     Mock::generatePartial('OA_Dll_User', 'PartialMockOA_Dll_User', array('raiseError'));
     $dllUserMock = new PartialMockOA_Dll_User();
     $dllUserMock->setReturnValue('raiseError', true);
     $dllUserMock->expectCallCount('raiseError', 2);
     $oUserInfo = new OA_Dll_UserInfo();
     // Test with nothing set
     $this->assertFalse($this->oPlugin->dllValidation($dllUserMock, $oUserInfo));
     // Test with username set
     $oUserInfo->username = '******';
     $this->assertFalse($this->oPlugin->dllValidation($dllUserMock, $oUserInfo));
     // Test with username and password set
     $oUserInfo->password = '******';
     $this->assertTrue($this->oPlugin->dllValidation($dllUserMock, $oUserInfo));
     $this->assertEqual($oUserInfo->password, md5('pwd'));
     // Test edit
     $oUserInfo = new OA_Dll_UserInfo();
     $oUserInfo->userId = 1;
     $this->assertTrue($this->oPlugin->dllValidation($dllUserMock, $oUserInfo));
     $this->assertNull($oUserInfo->password);
     // Test edit with new password
     $oUserInfo->password = '******';
     $this->assertTrue($this->oPlugin->dllValidation($dllUserMock, $oUserInfo));
     $this->assertEqual($oUserInfo->password, md5('pwd'));
     $dllUserMock->tally();
 }
 function testUpdateSsoUserId()
 {
     $dllUserPartialMock = new PartialMockOA_Dll_User($this);
     $dllUserPartialMock->setReturnValue('checkPermissions', true);
     $dllUserPartialMock->expectCallCount('checkPermissions', 4);
     $doUsers = OA_Dal::factoryDO('users');
     $doUsers->username = '******' . time();
     $doUsers->sso_user_id = 0;
     $this->assertTrue($userId = DataGenerator::generateOne($doUsers));
     $this->assertFalse($dllUserPartialMock->updateSsoUserId(1001, 1002));
     $doUsers = OA_Dal::factoryDO('users');
     $doUsers->user_id = $userId;
     $doUsers->sso_user_id = 1001;
     $doUsers->update();
     $this->assertTrue($dllUserPartialMock->updateSsoUserId(1001, 1002), $dllUserPartialMock->getLastError());
     // Test errors
     $this->assertTrue(!$dllUserPartialMock->updateSsoUserId(0, 1) && $dllUserPartialMock->getLastError() == OA_Dll_User::ERROR_WRONG_PARAMS, $this->_getMethodShouldReturnError(OA_Dll_User::ERROR_WRONG_PARAMS));
     $this->assertTrue(!$dllUserPartialMock->updateSsoUserId(1, 0) && $dllUserPartialMock->getLastError() == OA_Dll_User::ERROR_WRONG_PARAMS, $this->_getMethodShouldReturnError(OA_Dll_User::ERROR_WRONG_PARAMS));
     $dllUserPartialMock->tally();
 }