public function CspTest::testToString in Content-Security-Policy 8
@covers ::__toString
File
- tests/
src/ Unit/ CspTest.php, line 409
Class
- CspTest
- Test manipulating directives in a policy.
Namespace
Drupal\Tests\csp\UnitCode
public function testToString() {
$policy = new Csp();
$policy
->setDirective('default-src', Csp::POLICY_SELF);
$policy
->setDirective('script-src', [
Csp::POLICY_SELF,
'example.com',
]);
$this
->assertEquals("Content-Security-Policy: default-src 'self'; script-src 'self' example.com", $policy
->__toString());
}