mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
0747fc6d52
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@69856 467b73ca-7a2a-4603-9d3b-597d59a354a9
30 lines
742 B
PHP
30 lines
742 B
PHP
<?php
|
|
/**
|
|
* Tests the {@link HTTP} class
|
|
*
|
|
* @package sapphire
|
|
* @subpackage tests
|
|
*/
|
|
class HTTPTest extends SapphireTest {
|
|
|
|
/**
|
|
* Tests {@link HTTP::setGetVar()}
|
|
*/
|
|
public function testSetGetVar() {
|
|
$expected = array (
|
|
'/?foo=bar' => array('foo', 'bar', '/'),
|
|
'/?baz=buz&foo=bar' => array('foo', 'bar', '/?baz=buz'),
|
|
'/?buz=baz&foo=baz' => array('foo', 'baz', '/?foo=bar&buz=baz'),
|
|
'/?foo=var' => array('foo', 'var', '/?foo=&foo=bar'),
|
|
'/?foo[test]=var' => array('foo[test]', 'var', '/?foo[test]=another')
|
|
);
|
|
|
|
foreach($expected as $result => $args) {
|
|
$this->assertEquals(
|
|
call_user_func_array(array('HTTP', 'setGetVar'), $args), str_replace('&', '&', $result)
|
|
);
|
|
}
|
|
}
|
|
|
|
}
|