You are here

public function CspTest::testSetInvalidPolicy in Content-Security-Policy 8

Test that invalid directive names cause an exception.

@covers ::setDirective @covers ::isValidDirectiveName @covers ::validateDirectiveName

File

tests/src/Unit/CspTest.php, line 92

Class

CspTest
Test manipulating directives in a policy.

Namespace

Drupal\Tests\csp\Unit

Code

public function testSetInvalidPolicy() {
  $this
    ->expectException(\InvalidArgumentException::class);
  $policy = new Csp();
  $policy
    ->setDirective('foo', Csp::POLICY_SELF);
}