You are here

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

Wildcard source should be removed for attribute directives.

@covers ::reduceAttrSourceList

File

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

Class

CspOptimizationTest
Test optimization of CSP directives.

Namespace

Drupal\Tests\csp\Unit

Code

public function testReduceAttrSourceListWildcard() {
  $policy = new Csp();
  $policy
    ->setDirective('script-src-attr', [
    Csp::POLICY_UNSAFE_INLINE,
    Csp::POLICY_ANY,
  ]);
  $this
    ->assertEquals("script-src-attr 'unsafe-inline'", $policy
    ->getHeaderValue());
}