You are here

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

Test that nonce directives are copied from default-src.

@covers ::ff1313937

File

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

Class

CspFirefoxBugTest
Test Csp handling of Firefox bug #1313937.

Namespace

Drupal\Tests\csp\Unit

Code

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