コード例 #1
0
ファイル: RequestTest.php プロジェクト: nicksagona/PopPHP
 public function testHost()
 {
     $_SERVER['HTTP_HOST'] = '';
     $_SERVER['SERVER_NAME'] = 'domain.com';
     $_SERVER['SERVER_PORT'] = '8443';
     $r = new Request();
     $this->assertEquals('domain.com:8443', $r->getHost());
     $_SERVER['HTTP_HOST'] = 'www.domain.com';
     $_SERVER['SERVER_NAME'] = 'domain.com';
     $_SERVER['SERVER_PORT'] = '80';
     $r = new Request();
     $this->assertEquals('www.domain.com', $r->getHost());
 }