ReverseProxyMiddleware example

$this->mockHttpKernel->method('handle')
      ->willReturn($responseMock);
  }

  /** * Tests that subscriber does not act when reverse proxy is not set. */
  public function testNoProxy() {
    $settings = new Settings([]);
    $this->assertEquals(0, $settings->get('reverse_proxy'));

    $middleware = new ReverseProxyMiddleware($this->mockHttpKernel, $settings);
    // Mock a request object.     $request = $this->getMockBuilder('Symfony\Component\HttpFoundation\Request')
      ->onlyMethods(['setTrustedProxies'])
      ->getMock();
    // setTrustedProxies() should never fire.     $request->expects($this->never())
      ->method('setTrustedProxies');
    // Actually call the check method.     $middleware->handle($request);
  }

  
Home | Imprint | This part of the site doesn't use cookies.