RKA\Middleware\Test\RendererTest::testXForwardedForWithInvalidIp PHP Method

testXForwardedForWithInvalidIp() public method

    public function testXForwardedForWithInvalidIp()
    {
        $middleware = new IPAddress(true);
        $request = ServerRequestFactory::fromGlobals(['REMOTE_ADDR' => '192.168.1.1', 'HTTP_X_FORWARDED_FOR' => 'foo-bar']);
        $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.168.1.1', $ipAddress);
    }