|
|
|
|
@ -8,7 +8,6 @@ |
|
|
|
|
namespace OCA\User_LDAP\Tests; |
|
|
|
|
|
|
|
|
|
use OC\User\Backend; |
|
|
|
|
use OC\User\Session; |
|
|
|
|
use OCA\User_LDAP\Access; |
|
|
|
|
use OCA\User_LDAP\Connection; |
|
|
|
|
use OCA\User_LDAP\Mapping\AbstractMapping; |
|
|
|
|
@ -21,7 +20,6 @@ use OCA\User_LDAP\User_LDAP; |
|
|
|
|
use OCA\User_LDAP\User_LDAP as UserLDAP; |
|
|
|
|
use OCA\User_LDAP\UserPluginManager; |
|
|
|
|
use OCP\HintException; |
|
|
|
|
use OCP\IConfig; |
|
|
|
|
use OCP\IUser; |
|
|
|
|
use OCP\Notification\IManager as INotificationManager; |
|
|
|
|
use PHPUnit\Framework\MockObject\MockObject; |
|
|
|
|
@ -42,12 +40,8 @@ class User_LDAPTest extends TestCase { |
|
|
|
|
protected $access; |
|
|
|
|
/** @var OfflineUser|MockObject */ |
|
|
|
|
protected $offlineUser; |
|
|
|
|
/** @var IConfig|MockObject */ |
|
|
|
|
protected $config; |
|
|
|
|
/** @var INotificationManager|MockObject */ |
|
|
|
|
protected $notificationManager; |
|
|
|
|
/** @var Session|MockObject */ |
|
|
|
|
protected $session; |
|
|
|
|
/** @var UserPluginManager|MockObject */ |
|
|
|
|
protected $pluginManager; |
|
|
|
|
/** @var Connection|MockObject */ |
|
|
|
|
@ -72,10 +66,7 @@ class User_LDAPTest extends TestCase { |
|
|
|
|
$this->access->connection = $this->connection; |
|
|
|
|
$this->access->userManager = $this->userManager; |
|
|
|
|
|
|
|
|
|
$this->config = $this->createMock(IConfig::class); |
|
|
|
|
$this->notificationManager = $this->createMock(INotificationManager::class); |
|
|
|
|
// Cannot use IUserSession because of private listen() methods |
|
|
|
|
$this->session = $this->createMock(Session::class); |
|
|
|
|
$this->pluginManager = $this->createMock(UserPluginManager::class); |
|
|
|
|
|
|
|
|
|
$this->logger = $this->createMock(LoggerInterface::class); |
|
|
|
|
@ -84,9 +75,7 @@ class User_LDAPTest extends TestCase { |
|
|
|
|
|
|
|
|
|
$this->backend = new User_LDAP( |
|
|
|
|
$this->access, |
|
|
|
|
$this->config, |
|
|
|
|
$this->notificationManager, |
|
|
|
|
$this->session, |
|
|
|
|
$this->pluginManager, |
|
|
|
|
$this->logger, |
|
|
|
|
$this->deletedUsersIndex, |
|
|
|
|
@ -188,7 +177,7 @@ class User_LDAPTest extends TestCase { |
|
|
|
|
->method('get') |
|
|
|
|
->willReturn($user); |
|
|
|
|
|
|
|
|
|
$backend = new UserLDAP($this->access, $this->config, $this->notificationManager, $this->session, $this->pluginManager, $this->logger, $this->deletedUsersIndex); |
|
|
|
|
$backend = new UserLDAP($this->access, $this->notificationManager, $this->pluginManager, $this->logger, $this->deletedUsersIndex); |
|
|
|
|
|
|
|
|
|
\OC_User::useBackend($backend); |
|
|
|
|
|
|
|
|
|
@ -198,7 +187,7 @@ class User_LDAPTest extends TestCase { |
|
|
|
|
|
|
|
|
|
public function testCheckPasswordWrongPassword() { |
|
|
|
|
$this->prepareAccessForCheckPassword(); |
|
|
|
|
$backend = new UserLDAP($this->access, $this->config, $this->notificationManager, $this->session, $this->pluginManager, $this->logger, $this->deletedUsersIndex); |
|
|
|
|
$backend = new UserLDAP($this->access, $this->notificationManager, $this->pluginManager, $this->logger, $this->deletedUsersIndex); |
|
|
|
|
\OC_User::useBackend($backend); |
|
|
|
|
|
|
|
|
|
$result = $backend->checkPassword('roland', 'wrong'); |
|
|
|
|
@ -207,7 +196,7 @@ class User_LDAPTest extends TestCase { |
|
|
|
|
|
|
|
|
|
public function testCheckPasswordWrongUser() { |
|
|
|
|
$this->prepareAccessForCheckPassword(); |
|
|
|
|
$backend = new UserLDAP($this->access, $this->config, $this->notificationManager, $this->session, $this->pluginManager, $this->logger, $this->deletedUsersIndex); |
|
|
|
|
$backend = new UserLDAP($this->access, $this->notificationManager, $this->pluginManager, $this->logger, $this->deletedUsersIndex); |
|
|
|
|
\OC_User::useBackend($backend); |
|
|
|
|
|
|
|
|
|
$result = $backend->checkPassword('mallory', 'evil'); |
|
|
|
|
@ -222,7 +211,7 @@ class User_LDAPTest extends TestCase { |
|
|
|
|
->method('get') |
|
|
|
|
->willReturn(null); |
|
|
|
|
|
|
|
|
|
$backend = new UserLDAP($this->access, $this->config, $this->notificationManager, $this->session, $this->pluginManager, $this->logger, $this->deletedUsersIndex); |
|
|
|
|
$backend = new UserLDAP($this->access, $this->notificationManager, $this->pluginManager, $this->logger, $this->deletedUsersIndex); |
|
|
|
|
\OC_User::useBackend($backend); |
|
|
|
|
|
|
|
|
|
$result = $backend->checkPassword('roland', 'dt19'); |
|
|
|
|
@ -240,7 +229,7 @@ class User_LDAPTest extends TestCase { |
|
|
|
|
->method('get') |
|
|
|
|
->willReturn($user); |
|
|
|
|
|
|
|
|
|
$backend = new UserLDAP($this->access, $this->config, $this->notificationManager, $this->session, $this->pluginManager, $this->logger, $this->deletedUsersIndex); |
|
|
|
|
$backend = new UserLDAP($this->access, $this->notificationManager, $this->pluginManager, $this->logger, $this->deletedUsersIndex); |
|
|
|
|
\OC_User::useBackend($backend); |
|
|
|
|
|
|
|
|
|
$user = \OC::$server->getUserManager()->checkPassword('roland', 'dt19'); |
|
|
|
|
@ -253,7 +242,7 @@ class User_LDAPTest extends TestCase { |
|
|
|
|
|
|
|
|
|
public function testCheckPasswordPublicAPIWrongPassword() { |
|
|
|
|
$this->prepareAccessForCheckPassword(); |
|
|
|
|
$backend = new UserLDAP($this->access, $this->config, $this->notificationManager, $this->session, $this->pluginManager, $this->logger, $this->deletedUsersIndex); |
|
|
|
|
$backend = new UserLDAP($this->access, $this->notificationManager, $this->pluginManager, $this->logger, $this->deletedUsersIndex); |
|
|
|
|
\OC_User::useBackend($backend); |
|
|
|
|
|
|
|
|
|
$user = \OC::$server->getUserManager()->checkPassword('roland', 'wrong'); |
|
|
|
|
@ -266,7 +255,7 @@ class User_LDAPTest extends TestCase { |
|
|
|
|
|
|
|
|
|
public function testCheckPasswordPublicAPIWrongUser() { |
|
|
|
|
$this->prepareAccessForCheckPassword(); |
|
|
|
|
$backend = new UserLDAP($this->access, $this->config, $this->notificationManager, $this->session, $this->pluginManager, $this->logger, $this->deletedUsersIndex); |
|
|
|
|
$backend = new UserLDAP($this->access, $this->notificationManager, $this->pluginManager, $this->logger, $this->deletedUsersIndex); |
|
|
|
|
\OC_User::useBackend($backend); |
|
|
|
|
|
|
|
|
|
$user = \OC::$server->getUserManager()->checkPassword('mallory', 'evil'); |
|
|
|
|
@ -278,7 +267,7 @@ class User_LDAPTest extends TestCase { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function testDeleteUserCancel() { |
|
|
|
|
$backend = new UserLDAP($this->access, $this->config, $this->notificationManager, $this->session, $this->pluginManager, $this->logger, $this->deletedUsersIndex); |
|
|
|
|
$backend = new UserLDAP($this->access, $this->notificationManager, $this->pluginManager, $this->logger, $this->deletedUsersIndex); |
|
|
|
|
$result = $backend->deleteUser('notme'); |
|
|
|
|
$this->assertFalse($result); |
|
|
|
|
} |
|
|
|
|
@ -311,7 +300,7 @@ class User_LDAPTest extends TestCase { |
|
|
|
|
->method('get') |
|
|
|
|
->willReturn($offlineUser); |
|
|
|
|
|
|
|
|
|
$backend = new UserLDAP($this->access, $this->config, $this->notificationManager, $this->session, $this->pluginManager, $this->logger, $this->deletedUsersIndex); |
|
|
|
|
$backend = new UserLDAP($this->access, $this->notificationManager, $this->pluginManager, $this->logger, $this->deletedUsersIndex); |
|
|
|
|
|
|
|
|
|
$result = $backend->deleteUser($uid); |
|
|
|
|
$this->assertTrue($result); |
|
|
|
|
@ -400,7 +389,7 @@ class User_LDAPTest extends TestCase { |
|
|
|
|
|
|
|
|
|
public function testGetUsersNoParam() { |
|
|
|
|
$this->prepareAccessForGetUsers(); |
|
|
|
|
$backend = new UserLDAP($this->access, $this->config, $this->notificationManager, $this->session, $this->pluginManager, $this->logger, $this->deletedUsersIndex); |
|
|
|
|
$backend = new UserLDAP($this->access, $this->notificationManager, $this->pluginManager, $this->logger, $this->deletedUsersIndex); |
|
|
|
|
|
|
|
|
|
$result = $backend->getUsers(); |
|
|
|
|
$this->assertEquals(3, count($result)); |
|
|
|
|
@ -408,7 +397,7 @@ class User_LDAPTest extends TestCase { |
|
|
|
|
|
|
|
|
|
public function testGetUsersLimitOffset() { |
|
|
|
|
$this->prepareAccessForGetUsers(); |
|
|
|
|
$backend = new UserLDAP($this->access, $this->config, $this->notificationManager, $this->session, $this->pluginManager, $this->logger, $this->deletedUsersIndex); |
|
|
|
|
$backend = new UserLDAP($this->access, $this->notificationManager, $this->pluginManager, $this->logger, $this->deletedUsersIndex); |
|
|
|
|
|
|
|
|
|
$result = $backend->getUsers('', 1, 2); |
|
|
|
|
$this->assertEquals(1, count($result)); |
|
|
|
|
@ -416,7 +405,7 @@ class User_LDAPTest extends TestCase { |
|
|
|
|
|
|
|
|
|
public function testGetUsersLimitOffset2() { |
|
|
|
|
$this->prepareAccessForGetUsers(); |
|
|
|
|
$backend = new UserLDAP($this->access, $this->config, $this->notificationManager, $this->session, $this->pluginManager, $this->logger, $this->deletedUsersIndex); |
|
|
|
|
$backend = new UserLDAP($this->access, $this->notificationManager, $this->pluginManager, $this->logger, $this->deletedUsersIndex); |
|
|
|
|
|
|
|
|
|
$result = $backend->getUsers('', 2, 1); |
|
|
|
|
$this->assertEquals(2, count($result)); |
|
|
|
|
@ -424,7 +413,7 @@ class User_LDAPTest extends TestCase { |
|
|
|
|
|
|
|
|
|
public function testGetUsersSearchWithResult() { |
|
|
|
|
$this->prepareAccessForGetUsers(); |
|
|
|
|
$backend = new UserLDAP($this->access, $this->config, $this->notificationManager, $this->session, $this->pluginManager, $this->logger, $this->deletedUsersIndex); |
|
|
|
|
$backend = new UserLDAP($this->access, $this->notificationManager, $this->pluginManager, $this->logger, $this->deletedUsersIndex); |
|
|
|
|
|
|
|
|
|
$result = $backend->getUsers('yo'); |
|
|
|
|
$this->assertEquals(2, count($result)); |
|
|
|
|
@ -432,7 +421,7 @@ class User_LDAPTest extends TestCase { |
|
|
|
|
|
|
|
|
|
public function testGetUsersSearchEmptyResult() { |
|
|
|
|
$this->prepareAccessForGetUsers(); |
|
|
|
|
$backend = new UserLDAP($this->access, $this->config, $this->notificationManager, $this->session, $this->pluginManager, $this->logger, $this->deletedUsersIndex); |
|
|
|
|
$backend = new UserLDAP($this->access, $this->notificationManager, $this->pluginManager, $this->logger, $this->deletedUsersIndex); |
|
|
|
|
|
|
|
|
|
$result = $backend->getUsers('nix'); |
|
|
|
|
$this->assertEquals(0, count($result)); |
|
|
|
|
@ -448,7 +437,7 @@ class User_LDAPTest extends TestCase { |
|
|
|
|
|
|
|
|
|
public function testGetUsersViaAPINoParam() { |
|
|
|
|
$this->prepareAccessForGetUsers(); |
|
|
|
|
$backend = new UserLDAP($this->access, $this->config, $this->notificationManager, $this->session, $this->pluginManager, $this->logger, $this->deletedUsersIndex); |
|
|
|
|
$backend = new UserLDAP($this->access, $this->notificationManager, $this->pluginManager, $this->logger, $this->deletedUsersIndex); |
|
|
|
|
\OC_User::useBackend($backend); |
|
|
|
|
|
|
|
|
|
$result = $this->getUsers(); |
|
|
|
|
@ -457,7 +446,7 @@ class User_LDAPTest extends TestCase { |
|
|
|
|
|
|
|
|
|
public function testGetUsersViaAPILimitOffset() { |
|
|
|
|
$this->prepareAccessForGetUsers(); |
|
|
|
|
$backend = new UserLDAP($this->access, $this->config, $this->notificationManager, $this->session, $this->pluginManager, $this->logger, $this->deletedUsersIndex); |
|
|
|
|
$backend = new UserLDAP($this->access, $this->notificationManager, $this->pluginManager, $this->logger, $this->deletedUsersIndex); |
|
|
|
|
\OC_User::useBackend($backend); |
|
|
|
|
|
|
|
|
|
$result = $this->getUsers('', 1, 2); |
|
|
|
|
@ -466,7 +455,7 @@ class User_LDAPTest extends TestCase { |
|
|
|
|
|
|
|
|
|
public function testGetUsersViaAPILimitOffset2() { |
|
|
|
|
$this->prepareAccessForGetUsers(); |
|
|
|
|
$backend = new UserLDAP($this->access, $this->config, $this->notificationManager, $this->session, $this->pluginManager, $this->logger, $this->deletedUsersIndex); |
|
|
|
|
$backend = new UserLDAP($this->access, $this->notificationManager, $this->pluginManager, $this->logger, $this->deletedUsersIndex); |
|
|
|
|
\OC_User::useBackend($backend); |
|
|
|
|
|
|
|
|
|
$result = $this->getUsers('', 2, 1); |
|
|
|
|
@ -475,7 +464,7 @@ class User_LDAPTest extends TestCase { |
|
|
|
|
|
|
|
|
|
public function testGetUsersViaAPISearchWithResult() { |
|
|
|
|
$this->prepareAccessForGetUsers(); |
|
|
|
|
$backend = new UserLDAP($this->access, $this->config, $this->notificationManager, $this->session, $this->pluginManager, $this->logger, $this->deletedUsersIndex); |
|
|
|
|
$backend = new UserLDAP($this->access, $this->notificationManager, $this->pluginManager, $this->logger, $this->deletedUsersIndex); |
|
|
|
|
\OC_User::useBackend($backend); |
|
|
|
|
|
|
|
|
|
$result = $this->getUsers('yo'); |
|
|
|
|
@ -484,7 +473,7 @@ class User_LDAPTest extends TestCase { |
|
|
|
|
|
|
|
|
|
public function testGetUsersViaAPISearchEmptyResult() { |
|
|
|
|
$this->prepareAccessForGetUsers(); |
|
|
|
|
$backend = new UserLDAP($this->access, $this->config, $this->notificationManager, $this->session, $this->pluginManager, $this->logger, $this->deletedUsersIndex); |
|
|
|
|
$backend = new UserLDAP($this->access, $this->notificationManager, $this->pluginManager, $this->logger, $this->deletedUsersIndex); |
|
|
|
|
\OC_User::useBackend($backend); |
|
|
|
|
|
|
|
|
|
$result = $this->getUsers('nix'); |
|
|
|
|
@ -492,7 +481,7 @@ class User_LDAPTest extends TestCase { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function testUserExists() { |
|
|
|
|
$backend = new UserLDAP($this->access, $this->config, $this->notificationManager, $this->session, $this->pluginManager, $this->logger, $this->deletedUsersIndex); |
|
|
|
|
$backend = new UserLDAP($this->access, $this->notificationManager, $this->pluginManager, $this->logger, $this->deletedUsersIndex); |
|
|
|
|
$this->prepareMockForUserExists(); |
|
|
|
|
|
|
|
|
|
$user = $this->createMock(User::class); |
|
|
|
|
@ -511,7 +500,7 @@ class User_LDAPTest extends TestCase { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function testUserExistsForDeleted() { |
|
|
|
|
$backend = new UserLDAP($this->access, $this->config, $this->notificationManager, $this->session, $this->pluginManager, $this->logger, $this->deletedUsersIndex); |
|
|
|
|
$backend = new UserLDAP($this->access, $this->notificationManager, $this->pluginManager, $this->logger, $this->deletedUsersIndex); |
|
|
|
|
$this->prepareMockForUserExists(); |
|
|
|
|
|
|
|
|
|
$mapper = $this->createMock(UserMapping::class); |
|
|
|
|
@ -535,7 +524,7 @@ class User_LDAPTest extends TestCase { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function testUserExistsForNeverExisting() { |
|
|
|
|
$backend = new UserLDAP($this->access, $this->config, $this->notificationManager, $this->session, $this->pluginManager, $this->logger, $this->deletedUsersIndex); |
|
|
|
|
$backend = new UserLDAP($this->access, $this->notificationManager, $this->pluginManager, $this->logger, $this->deletedUsersIndex); |
|
|
|
|
$this->prepareMockForUserExists(); |
|
|
|
|
|
|
|
|
|
$this->access->expects($this->any()) |
|
|
|
|
@ -554,7 +543,7 @@ class User_LDAPTest extends TestCase { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function testUserExistsPublicAPI() { |
|
|
|
|
$backend = new UserLDAP($this->access, $this->config, $this->notificationManager, $this->session, $this->pluginManager, $this->logger, $this->deletedUsersIndex); |
|
|
|
|
$backend = new UserLDAP($this->access, $this->notificationManager, $this->pluginManager, $this->logger, $this->deletedUsersIndex); |
|
|
|
|
$this->prepareMockForUserExists(); |
|
|
|
|
\OC_User::useBackend($backend); |
|
|
|
|
|
|
|
|
|
@ -584,7 +573,7 @@ class User_LDAPTest extends TestCase { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function testDeleteUserExisting() { |
|
|
|
|
$backend = new UserLDAP($this->access, $this->config, $this->notificationManager, $this->session, $this->pluginManager, $this->logger, $this->deletedUsersIndex); |
|
|
|
|
$backend = new UserLDAP($this->access, $this->notificationManager, $this->pluginManager, $this->logger, $this->deletedUsersIndex); |
|
|
|
|
|
|
|
|
|
//we do not support deleting existing users at all |
|
|
|
|
$result = $backend->deleteUser('gunslinger'); |
|
|
|
|
@ -592,7 +581,7 @@ class User_LDAPTest extends TestCase { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function testGetHomeAbsolutePath() { |
|
|
|
|
$backend = new UserLDAP($this->access, $this->config, $this->notificationManager, $this->session, $this->pluginManager, $this->logger, $this->deletedUsersIndex); |
|
|
|
|
$backend = new UserLDAP($this->access, $this->notificationManager, $this->pluginManager, $this->logger, $this->deletedUsersIndex); |
|
|
|
|
$this->prepareMockForUserExists(); |
|
|
|
|
|
|
|
|
|
$this->connection->expects($this->any()) |
|
|
|
|
@ -641,7 +630,7 @@ class User_LDAPTest extends TestCase { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function testGetHomeRelative() { |
|
|
|
|
$backend = new UserLDAP($this->access, $this->config, $this->notificationManager, $this->session, $this->pluginManager, $this->logger, $this->deletedUsersIndex); |
|
|
|
|
$backend = new UserLDAP($this->access, $this->notificationManager, $this->pluginManager, $this->logger, $this->deletedUsersIndex); |
|
|
|
|
$this->prepareMockForUserExists(); |
|
|
|
|
|
|
|
|
|
$dataDir = \OC::$server->getConfig()->getSystemValue( |
|
|
|
|
@ -695,7 +684,7 @@ class User_LDAPTest extends TestCase { |
|
|
|
|
public function testGetHomeNoPath() { |
|
|
|
|
$this->expectException(\Exception::class); |
|
|
|
|
|
|
|
|
|
$backend = new UserLDAP($this->access, $this->config, $this->notificationManager, $this->session, $this->pluginManager, $this->logger, $this->deletedUsersIndex); |
|
|
|
|
$backend = new UserLDAP($this->access, $this->notificationManager, $this->pluginManager, $this->logger, $this->deletedUsersIndex); |
|
|
|
|
$this->prepareMockForUserExists(); |
|
|
|
|
|
|
|
|
|
$this->connection->expects($this->any()) |
|
|
|
|
@ -743,7 +732,7 @@ class User_LDAPTest extends TestCase { |
|
|
|
|
public function testGetHomeDeletedUser() { |
|
|
|
|
$uid = 'newyorker'; |
|
|
|
|
|
|
|
|
|
$backend = new UserLDAP($this->access, $this->config, $this->notificationManager, $this->session, $this->pluginManager, $this->logger, $this->deletedUsersIndex); |
|
|
|
|
$backend = new UserLDAP($this->access, $this->notificationManager, $this->pluginManager, $this->logger, $this->deletedUsersIndex); |
|
|
|
|
$this->prepareMockForUserExists(); |
|
|
|
|
|
|
|
|
|
$this->connection->expects($this->any()) |
|
|
|
|
@ -765,10 +754,6 @@ class User_LDAPTest extends TestCase { |
|
|
|
|
->method('getUserMapper') |
|
|
|
|
->willReturn($userMapper); |
|
|
|
|
|
|
|
|
|
$this->config->expects($this->any()) |
|
|
|
|
->method('getUserValue') |
|
|
|
|
->willReturn(true); |
|
|
|
|
|
|
|
|
|
$offlineUser = $this->createMock(OfflineUser::class); |
|
|
|
|
$offlineUser->expects($this->atLeastOnce()) |
|
|
|
|
->method('getHomePath') |
|
|
|
|
@ -835,7 +820,7 @@ class User_LDAPTest extends TestCase { |
|
|
|
|
|
|
|
|
|
public function testGetDisplayName() { |
|
|
|
|
$this->prepareAccessForGetDisplayName(); |
|
|
|
|
$backend = new UserLDAP($this->access, $this->config, $this->notificationManager, $this->session, $this->pluginManager, $this->logger, $this->deletedUsersIndex); |
|
|
|
|
$backend = new UserLDAP($this->access, $this->notificationManager, $this->pluginManager, $this->logger, $this->deletedUsersIndex); |
|
|
|
|
$this->prepareMockForUserExists(); |
|
|
|
|
|
|
|
|
|
$this->connection->expects($this->any()) |
|
|
|
|
@ -916,7 +901,7 @@ class User_LDAPTest extends TestCase { |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
$this->prepareAccessForGetDisplayName(); |
|
|
|
|
$backend = new UserLDAP($this->access, $this->config, $this->notificationManager, $this->session, $this->pluginManager, $this->logger, $this->deletedUsersIndex); |
|
|
|
|
$backend = new UserLDAP($this->access, $this->notificationManager, $this->pluginManager, $this->logger, $this->deletedUsersIndex); |
|
|
|
|
$this->prepareMockForUserExists(); |
|
|
|
|
|
|
|
|
|
$this->connection->expects($this->any()) |
|
|
|
|
@ -998,7 +983,7 @@ class User_LDAPTest extends TestCase { |
|
|
|
|
->method('countUsers') |
|
|
|
|
->willReturn(5); |
|
|
|
|
|
|
|
|
|
$backend = new UserLDAP($this->access, $this->config, $this->notificationManager, $this->session, $this->pluginManager, $this->logger, $this->deletedUsersIndex); |
|
|
|
|
$backend = new UserLDAP($this->access, $this->notificationManager, $this->pluginManager, $this->logger, $this->deletedUsersIndex); |
|
|
|
|
|
|
|
|
|
$result = $backend->countUsers(); |
|
|
|
|
$this->assertEquals(5, $result); |
|
|
|
|
@ -1009,7 +994,7 @@ class User_LDAPTest extends TestCase { |
|
|
|
|
->method('countUsers') |
|
|
|
|
->willReturn(false); |
|
|
|
|
|
|
|
|
|
$backend = new UserLDAP($this->access, $this->config, $this->notificationManager, $this->session, $this->pluginManager, $this->logger, $this->deletedUsersIndex); |
|
|
|
|
$backend = new UserLDAP($this->access, $this->notificationManager, $this->pluginManager, $this->logger, $this->deletedUsersIndex); |
|
|
|
|
|
|
|
|
|
$result = $backend->countUsers(); |
|
|
|
|
$this->assertFalse($result); |
|
|
|
|
@ -1053,7 +1038,7 @@ class User_LDAPTest extends TestCase { |
|
|
|
|
->method('writeToCache') |
|
|
|
|
->with($this->equalTo('loginName2UserName-'.$loginName), $this->equalTo($username)); |
|
|
|
|
|
|
|
|
|
$backend = new UserLDAP($this->access, $this->config, $this->notificationManager, $this->session, $this->pluginManager, $this->logger, $this->deletedUsersIndex); |
|
|
|
|
$backend = new UserLDAP($this->access, $this->notificationManager, $this->pluginManager, $this->logger, $this->deletedUsersIndex); |
|
|
|
|
$user = $this->createMock(User::class); |
|
|
|
|
$user->expects($this->any()) |
|
|
|
|
->method('getUsername') |
|
|
|
|
@ -1098,7 +1083,7 @@ class User_LDAPTest extends TestCase { |
|
|
|
|
->method('getAttributes') |
|
|
|
|
->willReturn(['dn', 'uid', 'mail', 'displayname']); |
|
|
|
|
|
|
|
|
|
$backend = new UserLDAP($this->access, $this->config, $this->notificationManager, $this->session, $this->pluginManager, $this->logger, $this->deletedUsersIndex); |
|
|
|
|
$backend = new UserLDAP($this->access, $this->notificationManager, $this->pluginManager, $this->logger, $this->deletedUsersIndex); |
|
|
|
|
$name = $backend->loginName2UserName($loginName); |
|
|
|
|
$this->assertSame(false, $name); |
|
|
|
|
|
|
|
|
|
@ -1135,7 +1120,7 @@ class User_LDAPTest extends TestCase { |
|
|
|
|
->method('getAttributes') |
|
|
|
|
->willReturn(['dn', 'uid', 'mail', 'displayname']); |
|
|
|
|
|
|
|
|
|
$backend = new UserLDAP($this->access, $this->config, $this->notificationManager, $this->session, $this->pluginManager, $this->logger, $this->deletedUsersIndex); |
|
|
|
|
$backend = new UserLDAP($this->access, $this->notificationManager, $this->pluginManager, $this->logger, $this->deletedUsersIndex); |
|
|
|
|
$name = $backend->loginName2UserName($loginName); |
|
|
|
|
$this->assertSame(false, $name); |
|
|
|
|
|
|
|
|
|
@ -1212,7 +1197,7 @@ class User_LDAPTest extends TestCase { |
|
|
|
|
$this->userManager->expects($this->atLeastOnce()) |
|
|
|
|
->method('get') |
|
|
|
|
->willReturn($this->createMock(User::class)); |
|
|
|
|
$backend = new UserLDAP($this->access, $this->config, $this->notificationManager, $this->session, $this->pluginManager, $this->logger, $this->deletedUsersIndex); |
|
|
|
|
$backend = new UserLDAP($this->access, $this->notificationManager, $this->pluginManager, $this->logger, $this->deletedUsersIndex); |
|
|
|
|
\OC_User::useBackend($backend); |
|
|
|
|
|
|
|
|
|
$this->assertTrue(\OC_User::setPassword('roland', 'dt')); |
|
|
|
|
@ -1225,7 +1210,7 @@ class User_LDAPTest extends TestCase { |
|
|
|
|
->method('get') |
|
|
|
|
->willReturn($this->createMock(User::class)); |
|
|
|
|
|
|
|
|
|
$backend = new UserLDAP($this->access, $this->config, $this->notificationManager, $this->session, $this->pluginManager, $this->logger, $this->deletedUsersIndex); |
|
|
|
|
$backend = new UserLDAP($this->access, $this->notificationManager, $this->pluginManager, $this->logger, $this->deletedUsersIndex); |
|
|
|
|
$this->userManager->expects($this->any()) |
|
|
|
|
->method('get') |
|
|
|
|
->willReturn($this->createMock(User::class)); |
|
|
|
|
@ -1241,7 +1226,7 @@ class User_LDAPTest extends TestCase { |
|
|
|
|
->willReturn($this->createMock(User::class)); |
|
|
|
|
|
|
|
|
|
$this->prepareAccessForSetPassword(false); |
|
|
|
|
$backend = new UserLDAP($this->access, $this->config, $this->notificationManager, $this->session, $this->pluginManager, $this->logger, $this->deletedUsersIndex); |
|
|
|
|
$backend = new UserLDAP($this->access, $this->notificationManager, $this->pluginManager, $this->logger, $this->deletedUsersIndex); |
|
|
|
|
\OC_User::useBackend($backend); |
|
|
|
|
|
|
|
|
|
$this->assertFalse(\OC_User::setPassword('roland', 'dt12234$')); |
|
|
|
|
|