This commit is contained in:
Manuel Raynaud
2013-09-11 08:27:40 +02:00
parent 990ab0e094
commit 70d93d1daa
155 changed files with 541 additions and 809 deletions

View File

@@ -62,8 +62,8 @@ class URLTest extends \PHPUnit_Framework_TestCase
new \Thelia\Tools\URL($container);
}
public function testGetIndexPage() {
public function testGetIndexPage()
{
$this->context->setBaseUrl('/thelia/index.php');
$url = \Thelia\Tools\URL::getInstance()->getIndexPage();
$this->assertEquals('http://localhost/thelia/index.php', $url);
@@ -81,7 +81,8 @@ class URLTest extends \PHPUnit_Framework_TestCase
$this->assertEquals('http://localhost/', $url);
}
public function testGetBaseUrl() {
public function testGetBaseUrl()
{
$this->context->setBaseUrl('/thelia/index.php');
$url = \Thelia\Tools\URL::getInstance()->getBaseUrl();
$this->assertEquals('http://localhost/thelia/index.php', $url);
@@ -95,7 +96,8 @@ class URLTest extends \PHPUnit_Framework_TestCase
$this->assertEquals('http://localhost/', $url);
}
public function testAbsoluteUrl() {
public function testAbsoluteUrl()
{
$this->context->setBaseUrl('/');
$url = \Thelia\Tools\URL::getInstance()->absoluteUrl('/path/to/action');
$this->assertEquals('http://localhost/path/to/action', $url);
@@ -113,8 +115,8 @@ class URLTest extends \PHPUnit_Framework_TestCase
$this->assertEquals('http://localhost/thelia/index.php/path/to/action', $url);
}
public function testAbsoluteUrlOnAbsolutePath() {
public function testAbsoluteUrlOnAbsolutePath()
{
$this->context->setBaseUrl('/thelia/index.php');
$url = \Thelia\Tools\URL::getInstance()->absoluteUrl('http://myhost/path/to/action');
$this->assertEquals('http://myhost/path/to/action', $url);
@@ -128,8 +130,8 @@ class URLTest extends \PHPUnit_Framework_TestCase
$this->assertEquals('http://myhost/path/to/action', $url);
}
public function testAbsoluteUrlOnAbsolutePathWithParameters() {
public function testAbsoluteUrlOnAbsolutePathWithParameters()
{
$this->context->setBaseUrl('/thelia/index.php');
$url = \Thelia\Tools\URL::getInstance()->absoluteUrl('http://myhost/path/to/action', array("p1" => "v1", "p2" => "v2"));
$this->assertEquals('http://myhost/path/to/action?p1=v1&p2=v2', $url);
@@ -143,7 +145,8 @@ class URLTest extends \PHPUnit_Framework_TestCase
$this->assertEquals('http://myhost/path/to/action?p1=v1&p2=v2', $url);
}
public function testAbsoluteUrlOnAbsolutePathWithParametersAddParameters() {
public function testAbsoluteUrlOnAbsolutePathWithParametersAddParameters()
{
$this->context->setBaseUrl('/thelia/index.php');
$url = \Thelia\Tools\URL::getInstance()->absoluteUrl('http://myhost/path/to/action?p0=v0', array("p1" => "v1", "p2" => "v2"));
$this->assertEquals('http://myhost/path/to/action?p0=v0&p1=v1&p2=v2', $url);
@@ -157,7 +160,8 @@ class URLTest extends \PHPUnit_Framework_TestCase
$this->assertEquals('http://myhost/path/to/action?p0=v0&p1=v1&p2=v2', $url);
}
public function testAbsoluteUrlWithParameters() {
public function testAbsoluteUrlWithParameters()
{
$this->context->setBaseUrl('/thelia/index.php');
$url = \Thelia\Tools\URL::getInstance()->absoluteUrl('/path/to/action', array("p1" => "v1", "p2" => "v2"));
$this->assertEquals('http://localhost/thelia/index.php/path/to/action?p1=v1&p2=v2', $url);
@@ -179,13 +183,15 @@ class URLTest extends \PHPUnit_Framework_TestCase
$this->assertEquals('http://localhost/path/to/action?p1=v1&p2=v2', $url);
}
public function testAbsoluteUrlPathOnly() {
public function testAbsoluteUrlPathOnly()
{
$this->context->setBaseUrl('/thelia/index.php');
$url = \Thelia\Tools\URL::getInstance()->absoluteUrl('/path/to/action', array(), URL::PATH_TO_FILE);
$this->assertEquals('http://localhost/thelia/path/to/action', $url);
}
public function testAbsoluteUrlPathOnlyWithParameters() {
public function testAbsoluteUrlPathOnlyWithParameters()
{
$this->context->setBaseUrl('/thelia/index.php');
$url = \Thelia\Tools\URL::getInstance()->absoluteUrl('/path/to/action', array("p1" => "v1", "p2" => "v2"), URL::PATH_TO_FILE);
$this->assertEquals('http://localhost/thelia/path/to/action?p1=v1&p2=v2', $url);
@@ -200,7 +206,8 @@ class URLTest extends \PHPUnit_Framework_TestCase
}
public function testAbsoluteUrlFromIndexWithParameters() {
public function testAbsoluteUrlFromIndexWithParameters()
{
$this->context->setBaseUrl('/thelia/index.php');
$url = \Thelia\Tools\URL::getInstance()->absoluteUrl('/', array("p1" => "v1", "p2" => "v2"));
$this->assertEquals('http://localhost/thelia/index.php/?p1=v1&p2=v2', $url);
@@ -215,7 +222,8 @@ class URLTest extends \PHPUnit_Framework_TestCase
}
public function testAbsoluteUrlPathOnlyFromIndexWithParameters() {
public function testAbsoluteUrlPathOnlyFromIndexWithParameters()
{
$this->context->setBaseUrl('/thelia/index.php');
$url = \Thelia\Tools\URL::getInstance()->absoluteUrl('/', array("p1" => "v1", "p2" => "v2"), URL::PATH_TO_FILE);
$this->assertEquals('http://localhost/thelia/?p1=v1&p2=v2', $url);