You are here

public function ReverseProxyMiddlewareTest::testReverseProxyEnabled in Drupal 9

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Core/StackMiddleware/ReverseProxyMiddlewareTest.php \Drupal\Tests\Core\StackMiddleware\ReverseProxyMiddlewareTest::testReverseProxyEnabled()
  2. 10 core/tests/Drupal/Tests/Core/StackMiddleware/ReverseProxyMiddlewareTest.php \Drupal\Tests\Core\StackMiddleware\ReverseProxyMiddlewareTest::testReverseProxyEnabled()

Tests that subscriber sets trusted headers when reverse proxy is set.

@dataProvider reverseProxyEnabledProvider

File

core/tests/Drupal/Tests/Core/StackMiddleware/ReverseProxyMiddlewareTest.php, line 53

Class

ReverseProxyMiddlewareTest
Unit test the reverse proxy stack middleware.

Namespace

Drupal\Tests\Core\StackMiddleware

Code

public function testReverseProxyEnabled($provided_settings, $expected_trusted_header_set) {

  // Enable reverse proxy and add test values.
  $settings = new Settings([
    'reverse_proxy' => 1,
  ] + $provided_settings);
  $this
    ->trustedHeadersAreSet($settings, $expected_trusted_header_set);
}