aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib/Security/CSP/AddContentSecurityPolicyEventTest.php
blob: edc0c613655a28659ca6232c6b31b56f8f290034 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?php

declare(strict_types=1);

/**
 * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
 * SPDX-License-Identifier: AGPL-3.0-or-later
 */

namespace Test\Security\CSP;

use OC\Security\CSP\ContentSecurityPolicyManager;
use OCP\AppFramework\Http\ContentSecurityPolicy;
use OCP\Security\CSP\AddContentSecurityPolicyEvent;
use Test\TestCase;

class AddContentSecurityPolicyEventTest extends TestCase {
	public function testAddEvent() {
		$cspManager = $this->createMock(ContentSecurityPolicyManager::class);
		$policy = $this->createMock(ContentSecurityPolicy::class);
		$event = new AddContentSecurityPolicyEvent($cspManager);

		$cspManager->expects($this->once())
			->method('addDefaultPolicy')
			->with($policy);

		$event->addPolicy($policy);
	}
}