You are here

public function TrustedHostsTest::testStatusPageWithConfiguration in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/system/tests/src/Functional/System/TrustedHostsTest.php \Drupal\Tests\system\Functional\System\TrustedHostsTest::testStatusPageWithConfiguration()
  2. 10 core/modules/system/tests/src/Functional/System/TrustedHostsTest.php \Drupal\Tests\system\Functional\System\TrustedHostsTest::testStatusPageWithConfiguration()

Tests that the status page shows the trusted patterns from settings.php.

File

core/modules/system/tests/src/Functional/System/TrustedHostsTest.php, line 46

Class

TrustedHostsTest
Tests output on the status overview page.

Namespace

Drupal\Tests\system\Functional\System

Code

public function testStatusPageWithConfiguration() {
  $settings['settings']['trusted_host_patterns'] = (object) [
    'value' => [
      '^' . preg_quote(\Drupal::request()
        ->getHost()) . '$',
    ],
    'required' => TRUE,
  ];
  $this
    ->writeSettings($settings);
  $this
    ->drupalGet('admin/reports/status');
  $this
    ->assertSession()
    ->statusCodeEquals(200);
  $this
    ->assertRaw(t('Trusted Host Settings'));
  $this
    ->assertRaw(t('The trusted_host_patterns setting is set to allow'));
}