diff options
Diffstat (limited to 'tests/lib/Settings/ManagerTest.php')
-rw-r--r-- | tests/lib/Settings/ManagerTest.php | 66 |
1 files changed, 24 insertions, 42 deletions
diff --git a/tests/lib/Settings/ManagerTest.php b/tests/lib/Settings/ManagerTest.php index 93d57c37806..91277cc7f1e 100644 --- a/tests/lib/Settings/ManagerTest.php +++ b/tests/lib/Settings/ManagerTest.php @@ -1,30 +1,15 @@ <?php + /** - * @copyright Copyright (c) 2016 Lukas Reschke <lukas@statuscode.ch> - * - * @author Lukas Reschke <lukas@statuscode.ch> - * - * @license GNU AGPL version 3 or any later version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * 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 - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * + * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later */ namespace OC\Settings\Tests\AppInfo; use OC\Settings\AuthorizedGroupMapper; use OC\Settings\Manager; +use OCA\WorkflowEngine\Settings\Section; use OCP\Group\ISubAdmin; use OCP\IDBConnection; use OCP\IGroupManager; @@ -32,6 +17,7 @@ use OCP\IL10N; use OCP\IServerContainer; use OCP\IURLGenerator; use OCP\L10N\IFactory; +use OCP\Server; use OCP\Settings\ISettings; use OCP\Settings\ISubAdminSettings; use PHPUnit\Framework\MockObject\MockObject; @@ -81,12 +67,12 @@ class ManagerTest extends TestCase { ); } - public function testGetAdminSections() { - $this->manager->registerSection('admin', \OCA\WorkflowEngine\Settings\Section::class); + public function testGetAdminSections(): void { + $this->manager->registerSection('admin', Section::class); - $section = \OC::$server->query(\OCA\WorkflowEngine\Settings\Section::class); + $section = Server::get(Section::class); $this->container->method('get') - ->with(\OCA\WorkflowEngine\Settings\Section::class) + ->with(Section::class) ->willReturn($section); $this->assertEquals([ @@ -94,12 +80,12 @@ class ManagerTest extends TestCase { ], $this->manager->getAdminSections()); } - public function testGetPersonalSections() { - $this->manager->registerSection('personal', \OCA\WorkflowEngine\Settings\Section::class); + public function testGetPersonalSections(): void { + $this->manager->registerSection('personal', Section::class); - $section = \OC::$server->query(\OCA\WorkflowEngine\Settings\Section::class); + $section = Server::get(Section::class); $this->container->method('get') - ->with(\OCA\WorkflowEngine\Settings\Section::class) + ->with(Section::class) ->willReturn($section); $this->assertEquals([ @@ -107,11 +93,11 @@ class ManagerTest extends TestCase { ], $this->manager->getPersonalSections()); } - public function testGetAdminSectionsEmptySection() { + public function testGetAdminSectionsEmptySection(): void { $this->assertEquals([], $this->manager->getAdminSections()); } - public function testGetPersonalSectionsEmptySection() { + public function testGetPersonalSectionsEmptySection(): void { $this->l10nFactory ->expects($this->once()) ->method('get') @@ -125,7 +111,7 @@ class ManagerTest extends TestCase { $this->assertEquals([], $this->manager->getPersonalSections()); } - public function testGetAdminSettings() { + public function testGetAdminSettings(): void { $section = $this->createMock(ISettings::class); $section->method('getPriority') ->willReturn(13); @@ -143,7 +129,7 @@ class ManagerTest extends TestCase { ], $settings); } - public function testGetAdminSettingsAsSubAdmin() { + public function testGetAdminSettingsAsSubAdmin(): void { $section = $this->createMock(ISettings::class); $section->method('getPriority') ->willReturn(13); @@ -159,7 +145,7 @@ class ManagerTest extends TestCase { $this->assertEquals([], $settings); } - public function testGetSubAdminSettingsAsSubAdmin() { + public function testGetSubAdminSettingsAsSubAdmin(): void { $section = $this->createMock(ISubAdminSettings::class); $section->method('getPriority') ->willReturn(13); @@ -178,7 +164,7 @@ class ManagerTest extends TestCase { ], $settings); } - public function testGetPersonalSettings() { + public function testGetPersonalSettings(): void { $section = $this->createMock(ISettings::class); $section->method('getPriority') ->willReturn(16); @@ -195,10 +181,6 @@ class ManagerTest extends TestCase { $this->container->expects($this->exactly(2)) ->method('get') - ->withConsecutive( - ['section1'], - ['section2'] - ) ->willReturnMap([ ['section1', $section], ['section2', $section2], @@ -212,7 +194,7 @@ class ManagerTest extends TestCase { ], $settings); } - public function testSameSectionAsPersonalAndAdmin() { + public function testSameSectionAsPersonalAndAdmin(): void { $this->l10nFactory ->expects($this->once()) ->method('get') @@ -223,13 +205,13 @@ class ManagerTest extends TestCase { ->method('t') ->willReturnArgument(0); - $this->manager->registerSection('personal', \OCA\WorkflowEngine\Settings\Section::class); - $this->manager->registerSection('admin', \OCA\WorkflowEngine\Settings\Section::class); + $this->manager->registerSection('personal', Section::class); + $this->manager->registerSection('admin', Section::class); - $section = \OC::$server->query(\OCA\WorkflowEngine\Settings\Section::class); + $section = Server::get(Section::class); $this->container->method('get') - ->with(\OCA\WorkflowEngine\Settings\Section::class) + ->with(Section::class) ->willReturn($section); $this->assertEquals([ |