You are here

public function CspFirefoxBugTest::testEmptyDefault in Content-Security-Policy 8

Test that no modifications are made if default-src isn't set.

@covers ::ff1313937

File

tests/src/Unit/CspFirefoxBugTest.php, line 23

Class

CspFirefoxBugTest
Test Csp handling of Firefox bug #1313937.

Namespace

Drupal\Tests\csp\Unit

Code

public function testEmptyDefault() {
  $policy = new Csp();
  $policy
    ->setDirective('script-src', [
    Csp::POLICY_STRICT_DYNAMIC,
    "'nonce-abc'",
  ]);
  $policy
    ->setDirective('style-src', [
    Csp::POLICY_SELF,
    "'hash-abc'",
  ]);
  $this
    ->assertEquals("script-src 'strict-dynamic' 'nonce-abc'; style-src 'self' 'hash-abc'", $policy
    ->getHeaderValue());
}