public function CspTest::testRavenJavascriptConfig in Raven: Sentry Integration 3.x
Same name and namespace in other branches
- 8.2 tests/src/Functional/CspTest.php \Drupal\Tests\raven\Functional\CspTest::testRavenJavascriptConfig()
Tests Sentry browser client configuration UI.
File
- tests/
src/ Functional/ CspTest.php, line 32
Class
- CspTest
- Tests Raven and CSP modules.
Namespace
Drupal\Tests\raven\FunctionalCode
public function testRavenJavascriptConfig() {
$admin_user = $this
->drupalCreateUser([
'administer csp configuration',
'administer site configuration',
'send javascript errors to sentry',
]);
$this
->drupalLogin($admin_user);
$this
->drupalGet('admin/config/development/logging');
$this
->submitForm([
'raven[js][javascript_error_handler]' => TRUE,
'raven[js][public_dsn]' => 'https://a@domain.test/1',
], $this
->t('Save configuration'));
$this
->drupalGet('admin/config/system/csp');
$this
->submitForm([
'report-only[reporting][handler]' => 'raven',
], $this
->t('Save configuration'));
$this
->assertSession()
->responseHeaderEquals('Content-Security-Policy-Report-Only', "script-src 'self'; style-src 'self'; frame-ancestors 'self'; report-uri https://domain.test/api/1/security/?sentry_key=a");
$this
->drupalGet('admin/config/system/csp');
$this
->submitForm([
'report-only[directives][connect-src][enable]' => TRUE,
'report-only[directives][connect-src][base]' => 'self',
], $this
->t('Save configuration'));
$this
->assertSession()
->responseHeaderEquals('Content-Security-Policy-Report-Only', "connect-src 'self' https://domain.test/api/1/store/ https://domain.test/api/1/envelope/; script-src 'self'; style-src 'self'; frame-ancestors 'self'; report-uri https://domain.test/api/1/security/?sentry_key=a");
}