You are here

public function SecKitTestCaseTest::testHstsAllDirectves in Security Kit 2.x

Same name and namespace in other branches
  1. 8 tests/src/Functional/SecKitTestCaseTest.php \Drupal\Tests\seckit\Functional\SecKitTestCaseTest::testHstsAllDirectves()

Tests HTTP Strict Transport Security has all directives.

File

tests/src/Functional/SecKitTestCaseTest.php, line 519

Class

SecKitTestCaseTest
Functional tests for Security Kit.

Namespace

Drupal\Tests\seckit\Functional

Code

public function testHstsAllDirectves() {
  $form = [
    'seckit_ssl[hsts]' => TRUE,
    'seckit_ssl[hsts_max_age]' => 1000,
    'seckit_ssl[hsts_subdomains]' => 1,
  ];
  $this
    ->drupalPostForm('admin/config/system/seckit', $form, t('Save configuration'));
  $expected = 'max-age=1000; includeSubDomains';
  $this
    ->assertSession()
    ->responseHeaderEquals('Strict-Transport-Security', $expected);
}