@dataProvider testGetClientIpProvider
public function testGetClientIp($expected, $proxy, $remoteAddr, $httpClientIp, $httpForwardedFor) {
$request = new Request();
$this
->assertEquals('', $request
->getClientIp());
$server = array(
'REMOTE_ADDR' => $remoteAddr,
);
if (null !== $httpClientIp) {
$server['HTTP_CLIENT_IP'] = $httpClientIp;
}
if (null !== $httpForwardedFor) {
$server['HTTP_X_FORWARDED_FOR'] = $httpForwardedFor;
}
$request
->initialize(array(), array(), array(), array(), array(), $server);
if ($proxy) {
$this
->startTrustingProxyData();
}
$this
->assertEquals($expected, $request
->getClientIp($proxy));
if ($proxy) {
$this
->stopTrustingProxyData();
}
}