create new method allowing to add paramter to the current query string

This commit is contained in:
Manuel Raynaud
2013-08-06 16:13:34 +02:00
parent 86161f0320
commit 75929e1d4f
3 changed files with 111 additions and 29 deletions

View File

@@ -0,0 +1,43 @@
<?php
namespace Thelia\Tests\Core\HttpFoundation;
use Thelia\Core\HttpFoundation\Request;
class RequestTest extends \PHPUnit_Framework_TestCase
{
public function testGetUriAddingParameters()
{
$request = $this->getMock(
"Thelia\Core\HttpFoundation\Request",
array("getUri", "getQueryString")
);
$request->expects($this->any())
->method("getUri")
->will($this->onConsecutiveCalls(
"http://localhost/",
"http://localhost/?test=fu"
));
$request->expects($this->any())
->method("getQueryString")
->will($this->onConsecutiveCalls(
"",
"test=fu"
));
$result = $request->getUriAddingParameters(array("foo" => "bar"));
$this->assertEquals("http://localhost/?foo=bar", $result);
$result = $request->getUriAddingParameters(array("foo" => "bar"));
$this->assertEquals("http://localhost/?test=fu&foo=bar", $result);
}
}