Skip to content
Snippets Groups Projects
Commit 39bd4196 authored by Jess's avatar Jess
Browse files

Issue #3135302 by longwave, Kristen Pol: Remove Symfony 3 legacy test from...

Issue #3135302 by longwave, Kristen Pol: Remove Symfony 3 legacy test from ReverseProxyMiddlewareTest
parent b1d0cab0
No related branches found
No related tags found
No related merge requests found
......@@ -84,58 +84,6 @@ public function reverseProxyEnabledProvider() {
];
}
/**
* Tests that subscriber sets trusted headers when reverse proxy is set.
*
* @dataProvider reverseProxyEnabledProviderLegacy
* @group legacy
*/
public function testReverseProxyEnabledLegacy($provided_settings, $expected_trusted_header_set, array $expected_deprecations) {
if (!method_exists(Request::class, 'setTrustedHeaderName')) {
$this->markTestSkipped('The method \Symfony\Component\HttpFoundation\Request::setTrustedHeaderName() does not exist therefore testing on Symfony 4 or greater.');
}
$this->expectedDeprecations($expected_deprecations);
// Enable reverse proxy and add test values.
$settings = new Settings(['reverse_proxy' => 1] + $provided_settings);
$this->trustedHeadersAreSet($settings, $expected_trusted_header_set);
}
/**
* Data provider for testReverseProxyEnabled.
*/
public function reverseProxyEnabledProviderLegacy() {
return [
'Proxy with deprecated custom headers' => [
[
'reverse_proxy_addresses' => ['127.0.0.2', '127.0.0.3'],
'reverse_proxy_host_header' => NULL,
'reverse_proxy_forwarded_header' => NULL,
],
// For AWS configuration forwarded and x_forwarded_host headers are not
// trusted.
Request::HEADER_X_FORWARDED_AWS_ELB,
[
'The \'reverse_proxy_host_header\' setting in settings.php is deprecated in Drupal 8.7.0 and will be removed before Drupal 9.0.0. Use the \'reverse_proxy_trusted_headers\' setting instead. See https://www.drupal.org/node/3030558',
'The \'reverse_proxy_forwarded_header\' setting in settings.php is deprecated in Drupal 8.7.0 and will be removed before Drupal 9.0.0. Use the \'reverse_proxy_trusted_headers\' setting instead. See https://www.drupal.org/node/3030558',
'The "Symfony\Component\HttpFoundation\Request::setTrustedHeaderName()" method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the $trustedHeaderSet argument of the Request::setTrustedProxies() method instead.',
],
],
'Proxy with deprecated custom header' => [
[
'reverse_proxy_addresses' => ['127.0.0.2', '127.0.0.3'],
'reverse_proxy_forwarded_header' => NULL,
],
// The forwarded header is not trusted which is the same as trusting all
// the x_forwarded headers.
Request::HEADER_X_FORWARDED_ALL,
[
'The \'reverse_proxy_forwarded_header\' setting in settings.php is deprecated in Drupal 8.7.0 and will be removed before Drupal 9.0.0. Use the \'reverse_proxy_trusted_headers\' setting instead. See https://www.drupal.org/node/3030558',
'The "Symfony\Component\HttpFoundation\Request::setTrustedHeaderName()" method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the $trustedHeaderSet argument of the Request::setTrustedProxies() method instead.',
],
],
];
}
/**
* Tests that trusted headers are set correctly.
*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment