You are here

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

Test that hash directives are copied from default-src.

@covers ::ff1313937

File

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

Class

CspFirefoxBugTest
Test Csp handling of Firefox bug #1313937.

Namespace

Drupal\Tests\csp\Unit

Code

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