mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-04-21 19:32:15 +09:00
Implement URL::modifyURL()
This commit is contained in:
parent
de0d49b9f3
commit
13a67f3496
2 changed files with 55 additions and 10 deletions
|
|
@ -18,6 +18,9 @@ class URLTest extends \Codeception\TestCase\Test
|
|||
// Removing item from the query string
|
||||
$this->assertEquals($protocol . $_SERVER['HTTP_HOST'] . '/index.php?xe=sucks', Rhymix\Framework\URL::getCurrentURL(array('foo' => null)));
|
||||
|
||||
// Removing all items from the query string
|
||||
$this->assertEquals($protocol . $_SERVER['HTTP_HOST'] . '/index.php', Rhymix\Framework\URL::getCurrentURL(array('foo' => null, 'xe' => null)));
|
||||
|
||||
// Adding and removing parameters at the same time
|
||||
$this->assertEquals($protocol . $_SERVER['HTTP_HOST'] . '/index.php?xe=sucks&l=ko', Rhymix\Framework\URL::getCurrentURL(array('l' => 'ko', 'foo' => null)));
|
||||
}
|
||||
|
|
@ -55,6 +58,25 @@ class URLTest extends \Codeception\TestCase\Test
|
|||
}
|
||||
}
|
||||
|
||||
public function testModifyURL()
|
||||
{
|
||||
$protocol = \RX_SSL ? 'https://' : 'http://';
|
||||
$_SERVER['HTTP_HOST'] = 'www.rhymix.org';
|
||||
$url = $protocol . $_SERVER['HTTP_HOST'] . \RX_BASEURL . 'index.php?foo=bar';
|
||||
|
||||
// Conversion to absolute
|
||||
$this->assertEquals($url, Rhymix\Framework\URL::modifyURL('./index.php?foo=bar'));
|
||||
|
||||
// Adding items to the query string
|
||||
$this->assertEquals($url . '&var=1&arr%5B0%5D=2&arr%5B1%5D=3', Rhymix\Framework\URL::modifyURL($url, array('var' => '1', 'arr' => array(2, 3))));
|
||||
|
||||
// Removing item from the query string
|
||||
$this->assertEquals($protocol . $_SERVER['HTTP_HOST'] . \RX_BASEURL . 'index.php', Rhymix\Framework\URL::modifyURL($url, array('foo' => null)));
|
||||
|
||||
// Adding and removing parameters at the same time
|
||||
$this->assertEquals($protocol . $_SERVER['HTTP_HOST'] . \RX_BASEURL . 'index.php?l=ko', Rhymix\Framework\URL::modifyURL($url, array('l' => 'ko', 'foo' => null)));
|
||||
}
|
||||
|
||||
public function testIsInternalURL()
|
||||
{
|
||||
// This function is checked in Security::checkCSRF()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue