From 58dc6964976a5bb6dcaf265e17b0c4e036ea4b8b Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Mon, 8 Feb 2010 02:51:44 +0000 Subject: [PATCH] MINOR Fixed HTTPTest when invoked through dev/tests/all or with GET parameters (see r98373) (merged from r98383) git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.3@98384 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- tests/HTTPTest.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/HTTPTest.php b/tests/HTTPTest.php index 57a54632e..ba694c306 100644 --- a/tests/HTTPTest.php +++ b/tests/HTTPTest.php @@ -26,11 +26,14 @@ class HTTPTest extends SapphireTest { * Tests {@link HTTP::setGetVar()} */ public function testSetGetVar() { - // HACK No easy way to get the current URL without the query string or fragment - $base = Director::absoluteBaseURL() . 'dev/tests/HTTPTest'; + $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( - $base . '?foo=bar', + $expected, HTTP::setGetVar('foo', 'bar'), 'Omitting a URL falls back to current URL' );