fix(LDAP): remove unneeded dependencies

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
pull/46956/head
Arthur Schiwon 2024-08-01 17:35:29 +07:00
parent 60b9bb40f5
commit 0447aa4e62
No known key found for this signature in database
GPG Key ID: 7424F1874854DF23
10 changed files with 44 additions and 85 deletions

@ -14,9 +14,7 @@ use OCA\User_LDAP\Exceptions\NotOnLDAP;
use OCA\User_LDAP\User\DeletedUsersIndex;
use OCA\User_LDAP\User\OfflineUser;
use OCA\User_LDAP\User\User;
use OCP\IConfig;
use OCP\IUserBackend;
use OCP\IUserSession;
use OCP\Notification\IManager as INotificationManager;
use OCP\User\Backend\ICountMappedUsersBackend;
use OCP\User\Backend\ICountUsersBackend;
@ -25,7 +23,6 @@ use OCP\UserInterface;
use Psr\Log\LoggerInterface;
class User_LDAP extends BackendUtility implements IUserBackend, UserInterface, IUserLDAP, ICountUsersBackend, ICountMappedUsersBackend, IProvideEnabledStateBackend {
protected IConfig $ocConfig;
protected INotificationManager $notificationManager;
protected UserPluginManager $userPluginManager;
protected LoggerInterface $logger;
@ -33,15 +30,12 @@ class User_LDAP extends BackendUtility implements IUserBackend, UserInterface, I
public function __construct(
Access $access,
IConfig $ocConfig,
INotificationManager $notificationManager,
IUserSession $userSession,
UserPluginManager $userPluginManager,
LoggerInterface $logger,
DeletedUsersIndex $deletedUsersIndex,
) {
parent::__construct($access);
$this->ocConfig = $ocConfig;
$this->notificationManager = $notificationManager;
$this->userPluginManager = $userPluginManager;
$this->logger = $logger;

@ -10,9 +10,7 @@ namespace OCA\User_LDAP;
use OCA\User_LDAP\User\DeletedUsersIndex;
use OCA\User_LDAP\User\OfflineUser;
use OCA\User_LDAP\User\User;
use OCP\IConfig;
use OCP\IUserBackend;
use OCP\IUserSession;
use OCP\Notification\IManager as INotificationManager;
use OCP\User\Backend\ICountMappedUsersBackend;
use OCP\User\Backend\ICountUsersBackend;
@ -27,9 +25,7 @@ class User_Proxy extends Proxy implements IUserBackend, UserInterface, IUserLDAP
private bool $isSetUp = false;
private Helper $helper;
private IConfig $ocConfig;
private INotificationManager $notificationManager;
private IUserSession $userSession;
private UserPluginManager $userPluginManager;
private LoggerInterface $logger;
private DeletedUsersIndex $deletedUsersIndex;
@ -38,18 +34,14 @@ class User_Proxy extends Proxy implements IUserBackend, UserInterface, IUserLDAP
Helper $helper,
ILDAPWrapper $ldap,
AccessFactory $accessFactory,
IConfig $ocConfig,
INotificationManager $notificationManager,
IUserSession $userSession,
UserPluginManager $userPluginManager,
LoggerInterface $logger,
DeletedUsersIndex $deletedUsersIndex,
) {
parent::__construct($ldap, $accessFactory);
$this->helper = $helper;
$this->ocConfig = $ocConfig;
$this->notificationManager = $notificationManager;
$this->userSession = $userSession;
$this->userPluginManager = $userPluginManager;
$this->logger = $logger;
$this->deletedUsersIndex = $deletedUsersIndex;
@ -64,9 +56,7 @@ class User_Proxy extends Proxy implements IUserBackend, UserInterface, IUserLDAP
foreach ($serverConfigPrefixes as $configPrefix) {
$this->backends[$configPrefix] = new User_LDAP(
$this->getAccess($configPrefix),
$this->ocConfig,
$this->notificationManager,
$this->userSession,
$this->userPluginManager,
$this->logger,
$this->deletedUsersIndex,

@ -36,7 +36,7 @@ class IntegrationTestAttributeDetection extends AbstractIntegrationTest {
$groupMapper->clear();
$this->access->setGroupMapper($groupMapper);
$userBackend = new User_LDAP($this->access, \OC::$server->getConfig(), \OC::$server->getNotificationManager(), \OC::$server->getUserSession(), \OC::$server->get(UserPluginManager::class), \OC::$server->get(LoggerInterface::class), \OC::$server->get(DeletedUsersIndex::class));
$userBackend = new User_LDAP($this->access, \OC::$server->getNotificationManager(), \OC::$server->get(UserPluginManager::class), \OC::$server->get(LoggerInterface::class), \OC::$server->get(DeletedUsersIndex::class));
$userManager = \OC::$server->getUserManager();
$userManager->clearBackends();
$userManager->registerBackend($userBackend);

@ -34,7 +34,7 @@ class IntegrationTestFetchUsersByLoginName extends AbstractIntegrationTest {
$this->mapping = new UserMapping(\OC::$server->getDatabaseConnection());
$this->mapping->clear();
$this->access->setUserMapper($this->mapping);
$this->backend = new User_LDAP($this->access, \OC::$server->getConfig(), \OC::$server->getNotificationManager(), \OC::$server->getUserSession(), \OC::$server->get(UserPluginManager::class), \OC::$server->get(LoggerInterface::class), \OC::$server->get(DeletedUsersIndex::class));
$this->backend = new User_LDAP($this->access, \OC::$server->getNotificationManager(), \OC::$server->get(UserPluginManager::class), \OC::$server->get(LoggerInterface::class), \OC::$server->get(DeletedUsersIndex::class));
}
/**

@ -34,7 +34,7 @@ class IntegrationTestPaging extends AbstractIntegrationTest {
require(__DIR__ . '/../setup-scripts/createExplicitUsers.php');
parent::init();
$this->backend = new User_LDAP($this->access, \OC::$server->getConfig(), \OC::$server->getNotificationManager(), \OC::$server->getUserSession(), \OC::$server->get(UserPluginManager::class), \OC::$server->get(LoggerInterface::class), \OC::$server->get(DeletedUsersIndex::class));
$this->backend = new User_LDAP($this->access, \OC::$server->getNotificationManager(), \OC::$server->get(UserPluginManager::class), \OC::$server->get(LoggerInterface::class), \OC::$server->get(DeletedUsersIndex::class));
}
public function initConnection() {

@ -35,7 +35,7 @@ class IntegrationTestUserAvatar extends AbstractIntegrationTest {
$this->mapping = new UserMapping(\OC::$server->getDatabaseConnection());
$this->mapping->clear();
$this->access->setUserMapper($this->mapping);
$userBackend = new User_LDAP($this->access, \OC::$server->getConfig(), \OC::$server->getNotificationManager(), \OC::$server->getUserSession(), \OC::$server->get(UserPluginManager::class), \OC::$server->get(LoggerInterface::class), \OC::$server->get(DeletedUsersIndex::class));
$userBackend = new User_LDAP($this->access, \OC::$server->getNotificationManager(), \OC::$server->get(UserPluginManager::class), \OC::$server->get(LoggerInterface::class), \OC::$server->get(DeletedUsersIndex::class));
\OC_User::useBackend($userBackend);
}

@ -32,7 +32,7 @@ class IntegrationTestUserCleanUp extends AbstractIntegrationTest {
$this->mapping->clear();
$this->access->setUserMapper($this->mapping);
$userBackend = new User_LDAP($this->access, \OC::$server->getConfig(), \OC::$server->getNotificationManager(), \OC::$server->getUserSession(), \OC::$server->get(UserPluginManager::class), \OC::$server->get(LoggerInterface::class), \OC::$server->get(DeletedUsersIndex::class));
$userBackend = new User_LDAP($this->access, \OC::$server->getNotificationManager(), \OC::$server->get(UserPluginManager::class), \OC::$server->get(LoggerInterface::class), \OC::$server->get(DeletedUsersIndex::class));
\OC_User::useBackend($userBackend);
}

@ -30,7 +30,7 @@ class IntegrationTestUserDisplayName extends AbstractIntegrationTest {
$this->mapping = new UserMapping(\OC::$server->getDatabaseConnection());
$this->mapping->clear();
$this->access->setUserMapper($this->mapping);
$userBackend = new User_LDAP($this->access, \OC::$server->getConfig(), \OC::$server->getNotificationManager(), \OC::$server->getUserSession(), \OC::$server->get(UserPluginManager::class), \OC::$server->get(LoggerInterface::class), \OC::$server->get(DeletedUsersIndex::class));
$userBackend = new User_LDAP($this->access, \OC::$server->getNotificationManager(), \OC::$server->get(UserPluginManager::class), \OC::$server->get(LoggerInterface::class), \OC::$server->get(DeletedUsersIndex::class));
\OC_User::useBackend($userBackend);
}

@ -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$'));

@ -11,8 +11,6 @@ use OCA\User_LDAP\ILDAPWrapper;
use OCA\User_LDAP\User\DeletedUsersIndex;
use OCA\User_LDAP\User_Proxy;
use OCA\User_LDAP\UserPluginManager;
use OCP\IConfig;
use OCP\IUserSession;
use OCP\Notification\IManager as INotificationManager;
use PHPUnit\Framework\MockObject\MockObject;
use Psr\Log\LoggerInterface;
@ -25,12 +23,8 @@ class User_ProxyTest extends TestCase {
private $ldapWrapper;
/** @var AccessFactory|MockObject */
private $accessFactory;
/** @var IConfig|MockObject */
private $config;
/** @var INotificationManager|MockObject */
private $notificationManager;
/** @var IUserSession|MockObject */
private $userSession;
/** @var User_Proxy|MockObject */
private $proxy;
/** @var UserPluginManager|MockObject */
@ -46,9 +40,7 @@ class User_ProxyTest extends TestCase {
$this->helper = $this->createMock(Helper::class);
$this->ldapWrapper = $this->createMock(ILDAPWrapper::class);
$this->accessFactory = $this->createMock(AccessFactory::class);
$this->config = $this->createMock(IConfig::class);
$this->notificationManager = $this->createMock(INotificationManager::class);
$this->userSession = $this->createMock(IUserSession::class);
$this->userPluginManager = $this->createMock(UserPluginManager::class);
$this->logger = $this->createMock(LoggerInterface::class);
$this->deletedUsersIndex = $this->createMock(DeletedUsersIndex::class);
@ -57,9 +49,7 @@ class User_ProxyTest extends TestCase {
$this->helper,
$this->ldapWrapper,
$this->accessFactory,
$this->config,
$this->notificationManager,
$this->userSession,
$this->userPluginManager,
$this->logger,
$this->deletedUsersIndex,