You are here

public function TrustedHostsRequestFactoryTest::testCreateRequest in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Core/Http/TrustedHostsRequestFactoryTest.php \Drupal\Tests\Core\Http\TrustedHostsRequestFactoryTest::testCreateRequest()
  2. 9 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 30

Class

TrustedHostsRequestFactoryTest
Tests the trusted hosts request factory.

Namespace

Drupal\Tests\Core\Http

Code

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