public function DrupalKernelTest::providerTestTrustedHosts in Drupal 10
Same name and namespace in other branches
- 8 core/tests/Drupal/Tests/Core/DrupalKernel/DrupalKernelTest.php \Drupal\Tests\Core\DrupalKernel\DrupalKernelTest::providerTestTrustedHosts()
- 9 core/tests/Drupal/Tests/Core/DrupalKernel/DrupalKernelTest.php \Drupal\Tests\Core\DrupalKernel\DrupalKernelTest::providerTestTrustedHosts()
Provides test data for testTrustedHosts().
File
- core/
tests/ Drupal/ Tests/ Core/ DrupalKernel/ DrupalKernelTest.php, line 53
Class
- DrupalKernelTest
- @coversDefaultClass \Drupal\Core\DrupalKernel @group DrupalKernel
Namespace
Drupal\Tests\Core\DrupalKernelCode
public function providerTestTrustedHosts() {
$data = [];
// Tests canonical URL.
$data[] = [
'www.example.com',
'www.example.com',
'canonical URL is trusted',
TRUE,
];
// Tests missing hostname for HTTP/1.0 compatibility where the Host
// header is optional.
$data[] = [
NULL,
'www.example.com',
'empty Host is valid',
TRUE,
];
// Tests the additional patterns from the settings.
$data[] = [
'example.com',
'www.example.com',
'host from settings is trusted',
TRUE,
];
$data[] = [
'subdomain.example.com',
'www.example.com',
'host from settings is trusted',
TRUE,
];
$data[] = [
'www.example.org',
'www.example.com',
'host from settings is trusted',
TRUE,
];
$data[] = [
'example.org',
'www.example.com',
'host from settings is trusted',
TRUE,
];
// Tests mismatch.
$data[] = [
'www.black_hat.com',
'www.example.com',
'unspecified host is untrusted',
FALSE,
];
return $data;
}