diff options
Diffstat (limited to 'apps/user_ldap/tests/Integration/Lib/User/IntegrationTestUserCleanUp.php')
-rw-r--r-- | apps/user_ldap/tests/Integration/Lib/User/IntegrationTestUserCleanUp.php | 39 |
1 files changed, 13 insertions, 26 deletions
diff --git a/apps/user_ldap/tests/Integration/Lib/User/IntegrationTestUserCleanUp.php b/apps/user_ldap/tests/Integration/Lib/User/IntegrationTestUserCleanUp.php index a706aae9895..9b05298a151 100644 --- a/apps/user_ldap/tests/Integration/Lib/User/IntegrationTestUserCleanUp.php +++ b/apps/user_ldap/tests/Integration/Lib/User/IntegrationTestUserCleanUp.php @@ -1,25 +1,9 @@ <?php + /** - * @copyright Copyright (c) 2016, ownCloud, Inc. - * - * @author Arthur Schiwon <blizzz@arthur-schiwon.de> - * @author Christoph Wurst <christoph@winzerhof-wurst.at> - * @author Morris Jobke <hey@morrisjobke.de> - * - * @license AGPL-3.0 - * - * This code is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License, version 3, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License, version 3, - * along with this program. If not, see <http://www.gnu.org/licenses/> - * + * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors + * SPDX-FileCopyrightText: 2016 ownCloud, Inc. + * SPDX-License-Identifier: AGPL-3.0-only */ namespace OCA\User_LDAP\Tests\Integration\Lib\User; @@ -29,12 +13,15 @@ use OCA\User_LDAP\Tests\Integration\AbstractIntegrationTest; use OCA\User_LDAP\User\DeletedUsersIndex; use OCA\User_LDAP\User_LDAP; use OCA\User_LDAP\UserPluginManager; +use OCP\IDBConnection; +use OCP\IUserManager; +use OCP\Server; use Psr\Log\LoggerInterface; require_once __DIR__ . '/../../Bootstrap.php'; class IntegrationTestUserCleanUp extends AbstractIntegrationTest { - /** @var UserMapping */ + /** @var UserMapping */ protected $mapping; /** @@ -44,12 +31,12 @@ class IntegrationTestUserCleanUp extends AbstractIntegrationTest { public function init() { require(__DIR__ . '/../../setup-scripts/createExplicitUsers.php'); parent::init(); - $this->mapping = new UserMapping(\OC::$server->getDatabaseConnection()); + $this->mapping = new UserMapping(Server::get(IDBConnection::class)); $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)); - \OC_User::useBackend($userBackend); + $userBackend = new User_LDAP($this->access, Server::get(\OCP\Notification\IManager::class), Server::get(UserPluginManager::class), Server::get(LoggerInterface::class), Server::get(DeletedUsersIndex::class)); + Server::get(IUserManager::class)->registerBackend($userBackend); } /** @@ -86,13 +73,13 @@ class IntegrationTestUserCleanUp extends AbstractIntegrationTest { // user instance must not be requested from global user manager, before // it is deleted from the LDAP server. The instance will be returned // from cache and may false-positively confirm the correctness. - $user = \OC::$server->getUserManager()->get($username); + $user = Server::get(IUserManager::class)->get($username); if ($user === null) { return false; } $user->delete(); - return \OC::$server->getUserManager()->get($username) === null; + return Server::get(IUserManager::class)->get($username) === null; } } |