diff options
author | diosmosis <benaka@piwik.pro> | 2015-10-29 15:17:31 +0300 |
---|---|---|
committer | diosmosis <benaka@piwik.pro> | 2015-10-29 15:17:31 +0300 |
commit | ddf3911dacf86035001355b0260212d25d967a0e (patch) | |
tree | 04dd3dcf0a7764f13ad99420676ee2c9b741e44f /tests/PHPUnit/Framework/TestRequest | |
parent | f1dcc9bae62566c0df71bc7e447a9af8b092492f (diff) |
Do not remove URLs in API output during tests, instead replace it w/ hard-coded root URL.
Diffstat (limited to 'tests/PHPUnit/Framework/TestRequest')
-rw-r--r-- | tests/PHPUnit/Framework/TestRequest/Response.php | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/tests/PHPUnit/Framework/TestRequest/Response.php b/tests/PHPUnit/Framework/TestRequest/Response.php index 22a12be8f0..daf76d72f4 100644 --- a/tests/PHPUnit/Framework/TestRequest/Response.php +++ b/tests/PHPUnit/Framework/TestRequest/Response.php @@ -115,7 +115,7 @@ class Response $apiResponse = $this->normalizeDecimalFields($apiResponse); $apiResponse = $this->normalizeEncodingPhp533($apiResponse); $apiResponse = $this->normalizeSpaces($apiResponse); - $apiResponse = $this->removePiwikUrl($apiResponse); + $apiResponse = $this->replacePiwikUrl($apiResponse); return $apiResponse; } @@ -265,8 +265,17 @@ class Response return $this->removeXmlFields($apiResponse, array('idsubdatatable_in_db')); } - private function removePiwikUrl($apiResponse) + /** + * To allow tests to pass no matter what port Piwik is on, we replace the test URL w/ another + * one in the response. We don't remove the URL outright, because then we would not be able + * to detect regressions where the root URL went missing. + * + * @param $apiResponse + * @return mixed + * @throws Exception + */ + private function replacePiwikUrl($apiResponse) { - return str_replace(Fixture::getRootUrl(), "", $apiResponse); + return str_replace(Fixture::getRootUrl(), "http://example.com/piwik/", $apiResponse); } } |