Skip to content
Extraits de code Groupes Projets
Valider dfe30d91 rédigé par mattab's avatar mattab
Parcourir les fichiers

Fix unit tests as parse_url does not work when there is no scheme on 5.3 till 5.4.7 refs #6652

parent ad4d4eea
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -8,6 +8,7 @@
namespace Piwik\Tests\Unit;
use Piwik\Tests\Framework\TestCase\SystemTestCase;
use Piwik\UrlHelper;
use Spyc;
......@@ -204,11 +205,22 @@ class Core_UrlHelperTest extends \PHPUnit_Framework_TestCase
$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('localhost', UrlHelper::getHostFromUrl('//localhost/path?test=test2'));
$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'));
}
/**
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter