You are here

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

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

Tests HTTP Origin allows requests from the specified source.

Includes a single value in the whitelist.

File

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

Class

SecKitTestCaseTest
Functional tests for Security Kit.

Namespace

Drupal\Tests\seckit\Functional

Code

public function testOriginAllowsSpecifiedSource() {
  $form = [
    'seckit_csrf[origin]' => TRUE,
    'seckit_csrf[origin_whitelist]' => 'http://www.example.com',
  ];
  $this
    ->drupalPostForm('admin/config/system/seckit', $form, t('Save configuration'));
  $this->originHeader = 'http://www.example.com';
  $this
    ->drupalPostForm('admin/config/system/seckit', $form, t('Save configuration'));
  $this
    ->assertSession()
    ->statusCodeEquals(200);
}