function ValidateHostnameTest::testValidateHostname

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Core/DrupalKernel/ValidateHostnameTest.php \Drupal\Tests\Core\DrupalKernel\ValidateHostnameTest::testValidateHostname()
  2. 8.9.x core/tests/Drupal/Tests/Core/DrupalKernel/ValidateHostnameTest.php \Drupal\Tests\Core\DrupalKernel\ValidateHostnameTest::testValidateHostname()
  3. 11.x 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 21

Class

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

Namespace

Drupal\Tests\Core\DrupalKernel

Code

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

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