class TrustedHostsTestController

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

Provides a test controller for testing the trusted hosts setting.

Hierarchy

Expanded class hierarchy of TrustedHostsTestController

File

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

Namespace

Drupal\trusted_hosts_test\Controller
View source
class TrustedHostsTestController {
    
    /**
     * Creates a fake request and prints out its host.
     */
    public function fakeRequestHost() {
        $request = Request::create('/');
        return [
            '#markup' => 'Host: ' . $request->getHost(),
        ];
    }
    
    /**
     * Creates a fake request and prints out the class name of the specified bag.
     */
    public function bagType($bag) {
        $request = Request::create('/');
        return [
            '#markup' => 'Type: ' . get_class($request->{$bag}),
        ];
    }

}

Members

Title Sort descending Modifiers Object type Summary
TrustedHostsTestController::bagType public function Creates a fake request and prints out the class name of the specified bag.
TrustedHostsTestController::fakeRequestHost public function Creates a fake request and prints out its host.

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