From 191f08683edb9970c2ad6c061840292c2df14d61 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Fri, 20 May 2011 07:02:52 +0200 Subject: [PATCH] all but one test work now with a different unittest database --- tests/TestBaseApi.php | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/tests/TestBaseApi.php b/tests/TestBaseApi.php index 1f2e8ff..20574f3 100644 --- a/tests/TestBaseApi.php +++ b/tests/TestBaseApi.php @@ -72,10 +72,26 @@ class TestBaseApi extends TestBase * @param string $urlSuffix Suffix for the URL * * @return HTTP_Request2 HTTP request object + */ + protected function getRequest($urlSuffix = null) + { + $url = $this->getTestUrl($urlSuffix); + $req = new HTTP_Request2($url, HTTP_Request2::METHOD_GET); + + return $req; + } + + /** + * Creates an URL from $this->url plus $urlSuffix and an appended + * unittestMode=1 parameter. + * + * @param string $urlSuffix Suffix for the URL + * + * @return string URL * * @uses $url */ - protected function getRequest($urlSuffix = null) + protected function getTestUrl($urlSuffix = null) { $url = $this->url . $urlSuffix; if (strpos($urlSuffix, '?') !== false) { @@ -83,10 +99,7 @@ class TestBaseApi extends TestBase } else { $url .= '?unittestMode=1'; } - - $req = new HTTP_Request2($url, HTTP_Request2::METHOD_GET); - - return $req; + return $url; } @@ -170,7 +183,7 @@ class TestBaseApi extends TestBase $uid = $this->addUser($username, $password); $req = new HTTP_Request2( - $GLOBALS['unittestUrl'] . '/login.php', + $GLOBALS['unittestUrl'] . '/login.php?unittestMode=1', HTTP_Request2::METHOD_POST ); $cookies = $req->setCookieJar()->getCookieJar();