public function CspSubscriberTest::testNoDirectives in Googalytics - Google Analytics 8
Shouldn't alter the policy if no directives are enabled.
@covers ::onCspPolicyAlter
File
- tests/
src/ Unit/ EventSubscriber/ CspSubscriberTest.php, line 57
Class
- CspSubscriberTest
- Test for Content Security Policy event integration.
Namespace
Drupal\Tests\ga\Unit\EventSubscriberCode
public function testNoDirectives() {
$policy = new Csp();
$alterEvent = new PolicyAlterEvent($policy, $this->response);
$subscriber = new CspSubscriber();
$subscriber
->onCspPolicyAlter($alterEvent);
$this
->assertFalse($alterEvent
->getPolicy()
->hasDirective('default-src'));
$this
->assertFalse($alterEvent
->getPolicy()
->hasDirective('img-src'));
$this
->assertFalse($alterEvent
->getPolicy()
->hasDirective('connect-src'));
}