public function SecKitTestCaseTest::testReportOnlyCsp in Security Kit 8
Same name and namespace in other branches
- 2.x tests/src/Functional/SecKitTestCaseTest.php \Drupal\Tests\seckit\Functional\SecKitTestCaseTest::testReportOnlyCsp()
Tests Content Security Policy in report-only mode.
File
- tests/
src/ Functional/ SecKitTestCaseTest.php, line 263
Class
- SecKitTestCaseTest
- Functional tests for Security Kit.
Namespace
Drupal\Tests\seckit\FunctionalCode
public function testReportOnlyCsp() {
$form['seckit_xss[csp][checkbox]'] = TRUE;
$form['seckit_xss[csp][vendor-prefix][x]'] = TRUE;
$form['seckit_xss[csp][vendor-prefix][webkit]'] = TRUE;
$form['seckit_xss[csp][report-only]'] = TRUE;
$this
->drupalPostForm('admin/config/system/seckit', $form, t('Save configuration'));
$this
->assertSession()
->responseHeaderContains('Content-Security-Policy-Report-Only', 'report-uri');
$this
->assertSession()
->responseHeaderContains('X-Content-Security-Policy-Report-Only', 'report-uri');
$this
->assertSession()
->responseHeaderContains('X-WebKit-CSP-Report-Only', 'report-uri');
}