diff options
Diffstat (limited to 'apps/user_ldap/tests/Integration/AbstractIntegrationTest.php')
-rw-r--r-- | apps/user_ldap/tests/Integration/AbstractIntegrationTest.php | 78 |
1 files changed, 33 insertions, 45 deletions
diff --git a/apps/user_ldap/tests/Integration/AbstractIntegrationTest.php b/apps/user_ldap/tests/Integration/AbstractIntegrationTest.php index e22678620c1..00f8be18586 100644 --- a/apps/user_ldap/tests/Integration/AbstractIntegrationTest.php +++ b/apps/user_ldap/tests/Integration/AbstractIntegrationTest.php @@ -1,48 +1,32 @@ <?php + /** - * @copyright Copyright (c) 2016, ownCloud, Inc. - * - * @author Arthur Schiwon <blizzz@arthur-schiwon.de> - * @author Christoph Wurst <christoph@winzerhof-wurst.at> - * @author Joas Schilling <coding@schilljs.com> - * @author Morris Jobke <hey@morrisjobke.de> - * @author Roeland Jago Douma <roeland@famdouma.nl> - * @author root <root@localhost.localdomain> - * @author Vinicius Cubas Brand <vinicius@eita.org.br> - * - * @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: 2016-2024 Nextcloud GmbH and Nextcloud contributors + * SPDX-FileCopyrightText: 2016 ownCloud, Inc. + * SPDX-License-Identifier: AGPL-3.0-only */ namespace OCA\User_LDAP\Tests\Integration; use OCA\User_LDAP\Access; use OCA\User_LDAP\Connection; -use OCA\User_LDAP\FilesystemHelper; use OCA\User_LDAP\GroupPluginManager; use OCA\User_LDAP\Helper; use OCA\User_LDAP\LDAP; use OCA\User_LDAP\User\Manager; use OCA\User_LDAP\UserPluginManager; +use OCP\IAvatarManager; +use OCP\IConfig; +use OCP\Image; +use OCP\IUserManager; +use OCP\Server; use OCP\Share\IManager; use Psr\Log\LoggerInterface; abstract class AbstractIntegrationTest { - /** @var LDAP */ + /** @var LDAP */ protected $ldap; - /** @var Connection */ + /** @var Connection */ protected $connection; /** @var Access */ @@ -54,14 +38,19 @@ abstract class AbstractIntegrationTest { /** @var Helper */ protected $helper; - /** @var string */ - protected $base; - /** @var string[] */ protected $server; - public function __construct($host, $port, $bind, $pwd, $base) { - $this->base = $base; + /** + * @param string $base + */ + public function __construct( + $host, + $port, + $bind, + $pwd, + protected $base, + ) { $this->server = [ 'host' => $host, 'port' => $port, @@ -76,10 +65,10 @@ abstract class AbstractIntegrationTest { */ public function init() { \OC::$server->registerService(UserPluginManager::class, function () { - return new \OCA\User_LDAP\UserPluginManager(); + return new UserPluginManager(); }); \OC::$server->registerService(GroupPluginManager::class, function () { - return new \OCA\User_LDAP\GroupPluginManager(); + return new GroupPluginManager(); }); $this->initLDAPWrapper(); @@ -121,14 +110,13 @@ abstract class AbstractIntegrationTest { */ protected function initUserManager() { $this->userManager = new Manager( - \OC::$server->getConfig(), - new FilesystemHelper(), - \OC::$server->get(LoggerInterface::class), - \OC::$server->getAvatarManager(), - new \OCP\Image(), - \OC::$server->getUserManager(), - \OC::$server->getNotificationManager(), - \OC::$server->get(IManager::class) + Server::get(IConfig::class), + Server::get(LoggerInterface::class), + Server::get(IAvatarManager::class), + new Image(), + Server::get(IUserManager::class), + Server::get(\OCP\Notification\IManager::class), + Server::get(IManager::class) ); } @@ -136,14 +124,14 @@ abstract class AbstractIntegrationTest { * initializes the test Helper */ protected function initHelper() { - $this->helper = new Helper(\OC::$server->getConfig(), \OC::$server->getDatabaseConnection()); + $this->helper = Server::get(Helper::class); } /** * initializes the Access test instance */ protected function initAccess() { - $this->access = new Access($this->connection, $this->ldap, $this->userManager, $this->helper, \OC::$server->getConfig(), \OC::$server->getLogger()); + $this->access = new Access($this->connection, $this->ldap, $this->userManager, $this->helper, Server::get(IConfig::class), Server::get(LoggerInterface::class)); } /** @@ -155,7 +143,7 @@ abstract class AbstractIntegrationTest { $methods = get_class_methods($this); $atLeastOneCaseRan = false; foreach ($methods as $method) { - if (strpos($method, 'case') === 0) { + if (str_starts_with($method, 'case')) { print("running $method " . PHP_EOL); try { if (!$this->$method()) { |