You are here

public function SecKitTestCase::testReportOnlyCSP in Security Kit 7

Same name and namespace in other branches
  1. 6 seckit.test \SecKitTestCase::testReportOnlyCSP()

Tests Content Security Policy in report-only mode.

File

./seckit.test, line 313
Tests for Security Kit module.

Class

SecKitTestCase
Functional tests for Security Kit.

Code

public function testReportOnlyCSP() {
  $form['seckit_xss[csp][checkbox]'] = TRUE;
  $form['seckit_xss[csp][report-only]'] = TRUE;
  $this
    ->drupalPost('admin/config/system/seckit', $form, t('Save configuration'));
  $this
    ->assertTrue($this
    ->drupalGetHeader('Content-Security-Policy-Report-Only'), t('Content Security Policy is in report-only mode.'));
  $this
    ->assertFalse($this
    ->drupalGetHeader('X-Content-Security-Policy'), t('Vendor prefixed X-Content-Security-Policy header is disabled.'));
  $this
    ->assertFalse($this
    ->drupalGetHeader('X-WebKit-CSP'), t('Vendor prefixed X-Webkit-CSP header is disabled.'));
}