diff --git a/tests/PHPUnit/Core/JsProxyTest.php b/tests/PHPUnit/Core/JsProxyTest.php index c26199f9bee..af875440dcc 100644 --- a/tests/PHPUnit/Core/JsProxyTest.php +++ b/tests/PHPUnit/Core/JsProxyTest.php @@ -44,17 +44,6 @@ function testPiwikPhp() */ private function getStaticSrvUrl() { - $path = Piwik_Url::getCurrentScriptPath(); - if (substr($path, -7) == '/tests/') { - $path = substr($path, 0, -7); - } else { - if (substr($path, -18) == '/tests/core/Piwik/') { - $path = substr($path, 0, -18); - } else { - throw new Exception('unsupported test path: ' . $path); - } - } - - return "http://" . $_SERVER['HTTP_HOST'] . $path; + return IntegrationTestCase::getRootUrl(); } } diff --git a/tests/PHPUnit/Core/ServeStaticFileTest.php b/tests/PHPUnit/Core/ServeStaticFileTest.php index a186ffc3f3c..9eca4b10b1e 100644 --- a/tests/PHPUnit/Core/ServeStaticFileTest.php +++ b/tests/PHPUnit/Core/ServeStaticFileTest.php @@ -12,7 +12,7 @@ */ // This is Piwik logo, the static file used in this test suit -define("TEST_FILE_LOCATION", dirname(__FILE__) . "/../../resources/lipsum.txt"); +define("TEST_FILE_LOCATION", realpath(dirname(__FILE__) . "/../../resources/lipsum.txt")); define("TEST_FILE_CONTENT_TYPE", "text/plain"); // Defines http request parameters @@ -388,18 +388,10 @@ public function test_compressionCacheInvalidation() */ private function getStaticSrvUrl() { - $path = Piwik_Url::getCurrentScriptPath(); - if (substr($path, -7) == '/tests/') { - $path .= 'resources/'; - } else { - if (substr($path, -18) != '/tests/core/Piwik/') { - throw new Exception('unsupported test path: ' . $path); - } - } + $url = IntegrationTestCase::getRootUrl(); + $url .= '/tests/resources/'; - return - "http://" . $_SERVER['HTTP_HOST'] . - $path . "staticFileServer.php?" . FILE_MODE_REQUEST_VAR . "=" . STATIC_SERVER_MODE . + return $url . "staticFileServer.php?" . FILE_MODE_REQUEST_VAR . "=" . STATIC_SERVER_MODE . "&" . SRV_MODE_REQUEST_VAR . "="; }