function TrustedHostsTestController::fakeRequestHost

Same name in other branches
  1. 9 core/modules/system/tests/modules/trusted_hosts_test/src/Controller/TrustedHostsTestController.php \Drupal\trusted_hosts_test\Controller\TrustedHostsTestController::fakeRequestHost()
  2. 8.9.x core/modules/system/tests/modules/trusted_hosts_test/src/Controller/TrustedHostsTestController.php \Drupal\trusted_hosts_test\Controller\TrustedHostsTestController::fakeRequestHost()
  3. 10 core/modules/system/tests/modules/trusted_hosts_test/src/Controller/TrustedHostsTestController.php \Drupal\trusted_hosts_test\Controller\TrustedHostsTestController::fakeRequestHost()

Creates a fake request and prints out its host.

1 string reference to 'TrustedHostsTestController::fakeRequestHost'
trusted_hosts_test.routing.yml in core/modules/system/tests/modules/trusted_hosts_test/trusted_hosts_test.routing.yml
core/modules/system/tests/modules/trusted_hosts_test/trusted_hosts_test.routing.yml

File

core/modules/system/tests/modules/trusted_hosts_test/src/Controller/TrustedHostsTestController.php, line 17

Class

TrustedHostsTestController
Provides a test controller for testing the trusted hosts setting.

Namespace

Drupal\trusted_hosts_test\Controller

Code

public function fakeRequestHost() {
    $request = Request::create('/');
    return [
        '#markup' => 'Host: ' . $request->getHost(),
    ];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.