diff options
Diffstat (limited to 'apps/provisioning_api/tests/TestCase.php')
-rw-r--r-- | apps/provisioning_api/tests/TestCase.php | 43 |
1 files changed, 13 insertions, 30 deletions
diff --git a/apps/provisioning_api/tests/TestCase.php b/apps/provisioning_api/tests/TestCase.php index 1ff2c82a3be..30e7f3a4ecf 100644 --- a/apps/provisioning_api/tests/TestCase.php +++ b/apps/provisioning_api/tests/TestCase.php @@ -1,38 +1,21 @@ <?php + /** - * @copyright Copyright (c) 2016, ownCloud, Inc. - * - * @author Joas Schilling <coding@schilljs.com> - * @author Morris Jobke <hey@morrisjobke.de> - * @author Roeland Jago Douma <roeland@famdouma.nl> - * @author Thomas Müller <thomas.mueller@tmit.eu> - * - * @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: 2019-2024 Nextcloud GmbH and Nextcloud contributors + * SPDX-FileCopyrightText: 2016 ownCloud, Inc. + * SPDX-License-Identifier: AGPL-3.0-only */ - namespace OCA\Provisioning_API\Tests; +use OCP\IGroupManager; use OCP\IUser; use OCP\IUserManager; -use OCP\IGroupManager; +use OCP\Server; abstract class TestCase extends \Test\TestCase { /** @var IUser[] */ - protected $users = array(); + protected $users = []; /** @var IUserManager */ protected $userManager; @@ -40,11 +23,11 @@ abstract class TestCase extends \Test\TestCase { /** @var IGroupManager */ protected $groupManager; - protected function setUp() { + protected function setUp(): void { parent::setUp(); - $this->userManager = \OC::$server->getUserManager(); - $this->groupManager = \OC::$server->getGroupManager(); + $this->userManager = Server::get(IUserManager::class); + $this->groupManager = Server::get(IGroupManager::class); $this->groupManager->createGroup('admin'); } @@ -54,7 +37,7 @@ abstract class TestCase extends \Test\TestCase { * @return IUser[]|IUser */ protected function generateUsers($num = 1) { - $users = array(); + $users = []; for ($i = 0; $i < $num; $i++) { $user = $this->userManager->createUser($this->getUniqueID(), 'password'); $this->users[] = $user; @@ -63,8 +46,8 @@ abstract class TestCase extends \Test\TestCase { return count($users) == 1 ? reset($users) : $users; } - protected function tearDown() { - foreach($this->users as $user) { + protected function tearDown(): void { + foreach ($this->users as $user) { $user->delete(); } |