diff --git a/tests/HTTPTest.php b/tests/HTTPTest.php index dd6b72c94..930a8f406 100644 --- a/tests/HTTPTest.php +++ b/tests/HTTPTest.php @@ -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' );