AddContentSecurityPolicyEventTest.php 781 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace Test\Security\CSP;
  8. use OC\Security\CSP\ContentSecurityPolicyManager;
  9. use OCP\AppFramework\Http\ContentSecurityPolicy;
  10. use OCP\Security\CSP\AddContentSecurityPolicyEvent;
  11. use Test\TestCase;
  12. class AddContentSecurityPolicyEventTest extends TestCase {
  13. public function testAddEvent(): void {
  14. $cspManager = $this->createMock(ContentSecurityPolicyManager::class);
  15. $policy = $this->createMock(ContentSecurityPolicy::class);
  16. $event = new AddContentSecurityPolicyEvent($cspManager);
  17. $cspManager->expects($this->once())
  18. ->method('addDefaultPolicy')
  19. ->with($policy);
  20. $event->addPolicy($policy);
  21. }
  22. }