Skip to content
Snippets Groups Projects
Commit 78b4e3cc authored by catch's avatar catch
Browse files

Issue #3038062 by Gábor Hojtsy, alexpott: [Symfony 4] Skip...

Issue #3038062 by Gábor Hojtsy, alexpott: [Symfony 4] Skip ReverseProxyMiddlewareTest::testReverseProxyEnabledLegacy test
parent e866ce6c
No related branches found
No related tags found
No related merge requests found
......@@ -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.
*
......
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