aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib/Security/FeaturePolicy/FeaturePolicyManagerTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lib/Security/FeaturePolicy/FeaturePolicyManagerTest.php')
-rw-r--r--tests/lib/Security/FeaturePolicy/FeaturePolicyManagerTest.php34
1 files changed, 9 insertions, 25 deletions
diff --git a/tests/lib/Security/FeaturePolicy/FeaturePolicyManagerTest.php b/tests/lib/Security/FeaturePolicy/FeaturePolicyManagerTest.php
index 7202e45de73..01624cb92d3 100644
--- a/tests/lib/Security/FeaturePolicy/FeaturePolicyManagerTest.php
+++ b/tests/lib/Security/FeaturePolicy/FeaturePolicyManagerTest.php
@@ -2,25 +2,8 @@
declare(strict_types=1);
/**
- * @copyright Copyright (c) 2019, Roeland Jago Douma <roeland@famdouma.nl>
- *
- * @author Roeland Jago Douma <roeland@famdouma.nl>
- *
- * @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: 2019 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace Test\Security\CSP;
@@ -29,6 +12,7 @@ use OC\Security\FeaturePolicy\FeaturePolicyManager;
use OCP\AppFramework\Http\FeaturePolicy;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\Security\FeaturePolicy\AddFeaturePolicyEvent;
+use OCP\Server;
use Test\TestCase;
class FeaturePolicyManagerTest extends TestCase {
@@ -40,17 +24,17 @@ class FeaturePolicyManagerTest extends TestCase {
protected function setUp(): void {
parent::setUp();
- $this->dispatcher = \OC::$server->query(IEventDispatcher::class);
+ $this->dispatcher = Server::get(IEventDispatcher::class);
$this->manager = new FeaturePolicyManager($this->dispatcher);
}
- public function testAddDefaultPolicy() {
+ public function testAddDefaultPolicy(): void {
$this->manager->addDefaultPolicy(new FeaturePolicy());
$this->addToAssertionCount(1);
}
- public function testGetDefaultPolicyWithPoliciesViaEvent() {
- $this->dispatcher->addListener(AddFeaturePolicyEvent::class, function (AddFeaturePolicyEvent $e) {
+ public function testGetDefaultPolicyWithPoliciesViaEvent(): void {
+ $this->dispatcher->addListener(AddFeaturePolicyEvent::class, function (AddFeaturePolicyEvent $e): void {
$policy = new FeaturePolicy();
$policy->addAllowedMicrophoneDomain('mydomain.com');
$policy->addAllowedPaymentDomain('mypaymentdomain.com');
@@ -58,7 +42,7 @@ class FeaturePolicyManagerTest extends TestCase {
$e->addPolicy($policy);
});
- $this->dispatcher->addListener(AddFeaturePolicyEvent::class, function (AddFeaturePolicyEvent $e) {
+ $this->dispatcher->addListener(AddFeaturePolicyEvent::class, function (AddFeaturePolicyEvent $e): void {
$policy = new FeaturePolicy();
$policy->addAllowedPaymentDomain('mydomainother.com');
$policy->addAllowedGeoLocationDomain('mylocation.here');
@@ -66,7 +50,7 @@ class FeaturePolicyManagerTest extends TestCase {
$e->addPolicy($policy);
});
- $this->dispatcher->addListener(AddFeaturePolicyEvent::class, function (AddFeaturePolicyEvent $e) {
+ $this->dispatcher->addListener(AddFeaturePolicyEvent::class, function (AddFeaturePolicyEvent $e): void {
$policy = new FeaturePolicy();
$policy->addAllowedAutoplayDomain('youtube.com');