You are here

public function SecKitTestCase::testEnabledFeaturePolicy in Security Kit 7

Tests enabled feature-policy.

File

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

Class

SecKitTestCase
Functional tests for Security Kit.

Code

public function testEnabledFeaturePolicy() {
  $form = array(
    '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
    ->drupalPost('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
    ->assertEqual($expected, $this
    ->drupalGetHeader('Feature-Policy'), t('The feature-policy header is correctly sent.'));
  debug(array(
    'expected' => $expected,
    'received' => $this
      ->drupalGetHeader('Feature-Policy'),
    'headers' => $this
      ->drupalGetHeaders(),
  ));
}