Exemplo n.º 1
0
 private function normalizeEncodingPhp533($apiResponse)
 {
     if (!SystemTestCase::isPhpVersion53() || strpos($apiResponse, '<result') === false) {
         return $apiResponse;
     }
     return str_replace('&amp;#039;', "'", $apiResponse);
 }
 /**
  * @group Core
  */
 public function test_getHostFromUrl()
 {
     $this->assertEquals('', UrlHelper::getHostFromUrl(''));
     $this->assertEquals('', UrlHelper::getHostFromUrl(null));
     $this->assertEquals('localhost', UrlHelper::getHostFromUrl('http://localhost'));
     $this->assertEquals('localhost', UrlHelper::getHostFromUrl('http://localhost/path'));
     $this->assertEquals('localhost', UrlHelper::getHostFromUrl('localhost/path'));
     $this->assertEquals('sub.localhost', UrlHelper::getHostFromUrl('sub.localhost/path'));
     $this->assertEquals('sub.localhost', UrlHelper::getHostFromUrl('http://sub.localhost/path/?query=test'));
     if (SystemTestCase::isPhpVersion53()) {
         //parse_url was fixed in 5,4,7
         //  Fixed host recognition when scheme is omitted and a leading component separator is present.
         // http://php.net/parse_url
         return;
     }
     $this->assertEquals('localhost', UrlHelper::getHostFromUrl('//localhost/path'));
     $this->assertEquals('localhost', UrlHelper::getHostFromUrl('//localhost/path?test=test2'));
     $this->assertEquals('example.org', UrlHelper::getHostFromUrl('//example.org/path'));
     $this->assertEquals('example.org', UrlHelper::getHostFromUrl('//example.org/path?test=test2'));
 }