From 78b4e3cc661d377632d3206ed6744e86525962c8 Mon Sep 17 00:00:00 2001 From: Nathaniel Catchpole <catch@35733.no-reply.drupal.org> Date: Thu, 7 Mar 2019 12:17:51 +0000 Subject: [PATCH] =?UTF-8?q?Issue=20#3038062=20by=20G=C3=A1bor=20Hojtsy,=20?= =?UTF-8?q?alexpott:=20[Symfony=204]=20Skip=20ReverseProxyMiddlewareTest::?= =?UTF-8?q?testReverseProxyEnabledLegacy=20test?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../StackMiddleware/ReverseProxyMiddlewareTest.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/core/tests/Drupal/Tests/Core/StackMiddleware/ReverseProxyMiddlewareTest.php b/core/tests/Drupal/Tests/Core/StackMiddleware/ReverseProxyMiddlewareTest.php index ba9877ce3133..8f9b5aedbd82 100644 --- a/core/tests/Drupal/Tests/Core/StackMiddleware/ReverseProxyMiddlewareTest.php +++ b/core/tests/Drupal/Tests/Core/StackMiddleware/ReverseProxyMiddlewareTest.php @@ -37,10 +37,10 @@ public function testNoProxy() { $middleware = new ReverseProxyMiddleware($this->mockHttpKernel, $settings); // Mock a request object. - $request = $this->getMock('Symfony\Component\HttpFoundation\Request', ['setTrustedHeaderName', 'setTrustedProxies']); - // setTrustedHeaderName() should never fire. + $request = $this->getMock('Symfony\Component\HttpFoundation\Request', ['setTrustedProxies']); + // setTrustedProxies() should never fire. $request->expects($this->never()) - ->method('setTrustedHeaderName'); + ->method('setTrustedProxies'); // Actually call the check method. $middleware->handle($request); } @@ -89,6 +89,9 @@ public function reverseProxyEnabledProvider() { * @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); @@ -132,9 +135,8 @@ public function reverseProxyEnabledProviderLegacy() { } /** - * Tests that trusted header methods are called. + * Tests that trusted headers are set correctly. * - * \Symfony\Component\HttpFoundation\Request::setTrustedHeaderName() and * \Symfony\Component\HttpFoundation\Request::setTrustedProxies() should * always be called when reverse proxy settings are enabled. * -- GitLab