MINOR Fixed HTTPTest->testSetGetVar() (from r98407)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@102653 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2010-04-13 03:23:36 +00:00
parent 6a1cb91c9f
commit 67305d2787

View File

@ -47,14 +47,15 @@ class HTTPTest extends SapphireTest {
* Tests {@link HTTP::setGetVar()}
*/
public function testSetGetVar() {
$currentURL = Director::absoluteURL($_SERVER['REQUEST_URI']);
// Hackery to work around volatile URL formats in test invocation
$expected = $currentURL;
$expected .= (strpos($currentURL, '?') === FALSE) ? '?' : '&';
$expected .= 'foo=bar';
$this->assertEquals(
$expected,
$expectedPath = preg_replace('/\?.*/', '', $_SERVER['REQUEST_URI']);
$this->assertContains(
$expectedPath,
HTTP::setGetVar('foo', 'bar'),
'Omitting a URL falls back to current URL'
);
$this->assertContains(
'foo=bar',
HTTP::setGetVar('foo', 'bar'),
'Omitting a URL falls back to current URL'
);