You are here

public function ValidateHostnameTest::testValidateHostname in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Core/DrupalKernel/ValidateHostnameTest.php \Drupal\Tests\Core\DrupalKernel\ValidateHostnameTest::testValidateHostname()
  2. 9 core/tests/Drupal/Tests/Core/DrupalKernel/ValidateHostnameTest.php \Drupal\Tests\Core\DrupalKernel\ValidateHostnameTest::testValidateHostname()

@covers ::validateHostname @dataProvider providerTestValidateHostname

File

core/tests/Drupal/Tests/Core/DrupalKernel/ValidateHostnameTest.php, line 19

Class

ValidateHostnameTest
@coversDefaultClass \Drupal\Core\DrupalKernel @group DrupalKernel

Namespace

Drupal\Tests\Core\DrupalKernel

Code

public function testValidateHostname($hostname, $message, $expected = FALSE) {
  $server = [
    'HTTP_HOST' => $hostname,
  ];
  $request = new Request([], [], [], [], [], $server);
  $validated_hostname = DrupalKernel::validateHostname($request);
  $this
    ->assertSame($expected, $validated_hostname, $message);
}