MINOR Fixed HTTPTest when invoked through dev/tests/all or with GET parameters (see r98373)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@98383 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2010-02-08 02:49:56 +00:00 committed by Sam Minnee
parent 9cf6bd8c7c
commit ccf4db936f

View File

@ -47,14 +47,17 @@ 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'
);
);
$this->assertEquals(
Director::absoluteBaseURL() . 'relative/url?foo=bar',