diff options
Diffstat (limited to 'tests/lib/CapabilitiesManagerTest.php')
-rw-r--r-- | tests/lib/CapabilitiesManagerTest.php | 48 |
1 files changed, 17 insertions, 31 deletions
diff --git a/tests/lib/CapabilitiesManagerTest.php b/tests/lib/CapabilitiesManagerTest.php index 536355f9697..e5bf7b03dee 100644 --- a/tests/lib/CapabilitiesManagerTest.php +++ b/tests/lib/CapabilitiesManagerTest.php @@ -1,22 +1,9 @@ <?php + /** - * @author Roeland Jago Douma <roeland@famdouma.nl> - * - * @copyright Copyright (c) 2015, ownCloud, Inc. - * @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 Test; @@ -25,26 +12,25 @@ use OC\CapabilitiesManager; use OCP\AppFramework\QueryException; use OCP\Capabilities\ICapability; use OCP\Capabilities\IPublicCapability; -use OCP\ILogger; +use Psr\Log\LoggerInterface; class CapabilitiesManagerTest extends TestCase { - /** @var CapabilitiesManager */ private $manager; - /** @var ILogger */ + /** @var LoggerInterface */ private $logger; protected function setUp(): void { parent::setUp(); - $this->logger = $this->getMockBuilder(ILogger::class)->getMock(); + $this->logger = $this->getMockBuilder(LoggerInterface::class)->getMock(); $this->manager = new CapabilitiesManager($this->logger); } /** * Test no capabilities */ - public function testNoCapabilities() { + public function testNoCapabilities(): void { $res = $this->manager->getCapabilities(); $this->assertEmpty($res); } @@ -52,7 +38,7 @@ class CapabilitiesManagerTest extends TestCase { /** * Test a valid capabilitie */ - public function testValidCapability() { + public function testValidCapability(): void { $this->manager->registerCapability(function () { return new SimpleCapability(); }); @@ -64,7 +50,7 @@ class CapabilitiesManagerTest extends TestCase { /** * Test a public capabilitie */ - public function testPublicCapability() { + public function testPublicCapability(): void { $this->manager->registerCapability(function () { return new PublicSimpleCapability1(); }); @@ -82,7 +68,7 @@ class CapabilitiesManagerTest extends TestCase { /** * Test that we need something that implents ICapability */ - public function testNoICapability() { + public function testNoICapability(): void { $this->expectException(\InvalidArgumentException::class); $this->expectExceptionMessage('The given Capability (Test\\NoCapability) does not implement the ICapability interface'); @@ -97,7 +83,7 @@ class CapabilitiesManagerTest extends TestCase { /** * Test a bunch of merged Capabilities */ - public function testMergedCapabilities() { + public function testMergedCapabilities(): void { $this->manager->registerCapability(function () { return new SimpleCapability(); }); @@ -123,7 +109,7 @@ class CapabilitiesManagerTest extends TestCase { /** * Test deep identical capabilities */ - public function testDeepIdenticalCapabilities() { + public function testDeepIdenticalCapabilities(): void { $this->manager->registerCapability(function () { return new DeepCapability(); }); @@ -139,17 +125,17 @@ class CapabilitiesManagerTest extends TestCase { ] ] ]; - + $this->assertEquals($expected, $res); } - public function testInvalidCapability() { - $this->manager->registerCapability(function () { + public function testInvalidCapability(): void { + $this->manager->registerCapability(function (): void { throw new QueryException(); }); $this->logger->expects($this->once()) - ->method('logException'); + ->method('error'); $res = $this->manager->getCapabilities(); |