You are here

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

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

Tests enabled feature-policy.

File

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

Class

SecKitTestCaseTest
Functional tests for Security Kit.

Namespace

Drupal\Tests\seckit\Functional

Code

public function testEnabledFeaturePolicy() {
  $form = [
    'seckit_fp[feature_policy]' => TRUE,
    'seckit_fp[feature_policy_policy]' => "accelerometer 'none'; camera 'none'; geolocation 'none'; gyroscope 'none'; magnetometer 'none'; microphone 'none'; payment 'none'; usb 'none'",
  ];
  $this
    ->drupalPostForm('admin/config/system/seckit', $form, t('Save configuration'));
  $expected = "accelerometer 'none'; camera 'none'; geolocation 'none'; gyroscope 'none'; magnetometer 'none'; microphone 'none'; payment 'none'; usb 'none'";
  $this
    ->assertSession()
    ->responseHeaderEquals('Feature-Policy', $expected);
}