예제 #1
0
 public function testCanSpecifyWhichHeaderToUseStatically()
 {
     $this->backup();
     $_SERVER['REMOTE_ADDR'] = '0.1.2.3';
     $_SERVER['HTTP_X_FORWARDED_FOR'] = '2.1.2.3, 1.1.2.3';
     $_SERVER['HTTP_CLIENT_IP'] = '0.1.2.4';
     RemoteAddr::setUseProxy(true);
     RemoteAddr::setProxyHeader('Client-Ip');
     $validator = new RemoteAddr();
     $this->assertEquals('0.1.2.4', $validator->getData());
     $this->restore();
 }