1
0

AddFeaturePolicyEventTest.php 735 B

12345678910111213141516171819202122232425262728
  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\FeaturePolicy\FeaturePolicyManager;
  9. use OCP\AppFramework\Http\FeaturePolicy;
  10. use OCP\Security\FeaturePolicy\AddFeaturePolicyEvent;
  11. use Test\TestCase;
  12. class AddFeaturePolicyEventTest extends TestCase {
  13. public function testAddEvent(): void {
  14. $manager = $this->createMock(FeaturePolicyManager::class);
  15. $policy = $this->createMock(FeaturePolicy::class);
  16. $event = new AddFeaturePolicyEvent($manager);
  17. $manager->expects($this->once())
  18. ->method('addDefaultPolicy')
  19. ->with($policy);
  20. $event->addPolicy($policy);
  21. }
  22. }