You are here

public function CspOptimizationTest::testReduceSourceListWithNone in Content-Security-Policy 8

Test reducing the source list when 'none' is included.

@covers ::reduceSourceList

File

tests/src/Unit/CspOptimizationTest.php, line 195

Class

CspOptimizationTest
Test optimization of CSP directives.

Namespace

Drupal\Tests\csp\Unit

Code

public function testReduceSourceListWithNone() {
  $policy = new Csp();
  $policy
    ->setDirective('object-src', [
    Csp::POLICY_NONE,
    'example.com',
    "'hash-123abc'",
  ]);
  $this
    ->assertEquals("object-src 'none'", $policy
    ->getHeaderValue());
}