예제 #1
0
 /**
  * Test get IP
  */
 public function testGetIp()
 {
     $env = Slim_Environment::getInstance();
     $req = new Slim_Http_Request($env);
     $this->assertEquals('127.0.0.1', $req->getIp());
 }
예제 #2
0
 /**
  * Test get IP with proxy server and X-Forwarded-For header
  */
 public function testGetIpWithForwardedFor()
 {
     $env = Slim_Environment::mock(array('REMOTE_ADDR' => '127.0.0.1', 'CLIENT_IP' => '127.0.0.2', 'X_FORWARDED_FOR' => '127.0.0.3'));
     $req = new Slim_Http_Request($env);
     $this->assertEquals('127.0.0.3', $req->getIp());
 }
예제 #3
0
 /**
  * Test get IP
  */
 public function testGetIp()
 {
     $env = Slim_Environment::mock(array('REMOTE_ADDR' => '127.0.0.1'));
     $req = new Slim_Http_Request($env);
     $this->assertEquals('127.0.0.1', $req->getIp());
 }