function TrustedHostsRequestFactoryTest::testCreateRequest

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Core/Http/TrustedHostsRequestFactoryTest.php \Drupal\Tests\Core\Http\TrustedHostsRequestFactoryTest::testCreateRequest()
  2. 8.9.x core/tests/Drupal/Tests/Core/Http/TrustedHostsRequestFactoryTest.php \Drupal\Tests\Core\Http\TrustedHostsRequestFactoryTest::testCreateRequest()
  3. 10 core/tests/Drupal/Tests/Core/Http/TrustedHostsRequestFactoryTest.php \Drupal\Tests\Core\Http\TrustedHostsRequestFactoryTest::testCreateRequest()

Tests TrustedHostsRequestFactory::createRequest().

@covers ::createRequest @dataProvider providerTestCreateRequest

Parameters

string $host: The host to pass into TrustedHostsRequestFactory.

array $server: The server array to pass into TrustedHostsRequestFactory::createRequest().

string $expected: The expected host of the created request.

File

core/tests/Drupal/Tests/Core/Http/TrustedHostsRequestFactoryTest.php, line 32

Class

TrustedHostsRequestFactoryTest
Tests the trusted hosts request factory.

Namespace

Drupal\Tests\Core\Http

Code

public function testCreateRequest($host, $server, $expected) : void {
    $request_factory = new TrustedHostsRequestFactory($host);
    $request = $request_factory->createRequest([], [], [], [], [], $server, []);
    $this->assertEquals($expected, $request->getHost());
}

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