Example #1
0
 /**
  * Test get host with port doesn't dulplicate port numbers
  */
 public function testGetHostDoesntDulplicatePort()
 {
     $env = Slim_Environment::mock(array('HOST' => 'slimframework.com:80', 'SERVER_NAME' => 'slim', 'SERVER_PORT' => 80, 'slim.url_scheme' => 'http'));
     $req = new Slim_Http_Request($env);
     $this->assertEquals('slimframework.com:80', $req->getHostWithPort());
 }
Example #2
0
 /**
  * Test get host with port
  */
 public function testGetHostWithPort()
 {
     Slim_Environment::mock(array('REQUEST_METHOD' => 'GET', 'REMOTE_ADDR' => '127.0.0.1', 'SCRIPT_NAME' => '/foo/index.php', 'PATH_INFO' => '/bar/xyz', 'QUERY_STRING' => 'one=1&two=2&three=3', 'SERVER_NAME' => 'slim', 'SERVER_PORT' => 80, 'slim.url_scheme' => 'http', 'slim.input' => '', 'slim.errors' => fopen('php://stderr', 'w'), 'HTTP_HOST' => 'slimframework.com'));
     $env = Slim_Environment::getInstance();
     $req = new Slim_Http_Request($env);
     $this->assertEquals('slimframework.com:80', $req->getHostWithPort());
 }