public function testForwardedWithAllOptions()
{
$middleware = new IPAddress(true);
$request = ServerRequestFactory::fromGlobals(['REMOTE_ADDR' => '192.168.1.1', 'HTTP_FORWARDED' => 'for=192.0.2.60; proto=http;by=203.0.113.43; host=_hiddenProxy, for=192.0.2.61']);
$response = new Response();
$ipAddress = '123';
$response = $middleware($request, $response, function ($request, $response) use(&$ipAddress) {
// simply store the "ip_address" attribute in to the referenced $ipAddress
$ipAddress = $request->getAttribute('ip_address');
return $response;
});
$this->assertSame('192.0.2.60', $ipAddress);
}