Skip to content
Extraits de code Groupes Projets
Valider ddf3911d rédigé par diosmosis's avatar diosmosis
Parcourir les fichiers

Do not remove URLs in API output during tests, instead replace it w/ hard-coded root URL.

parent f1dcc9ba
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -115,7 +115,7 @@ class Response ...@@ -115,7 +115,7 @@ class Response
$apiResponse = $this->normalizeDecimalFields($apiResponse); $apiResponse = $this->normalizeDecimalFields($apiResponse);
$apiResponse = $this->normalizeEncodingPhp533($apiResponse); $apiResponse = $this->normalizeEncodingPhp533($apiResponse);
$apiResponse = $this->normalizeSpaces($apiResponse); $apiResponse = $this->normalizeSpaces($apiResponse);
$apiResponse = $this->removePiwikUrl($apiResponse); $apiResponse = $this->replacePiwikUrl($apiResponse);
return $apiResponse; return $apiResponse;
} }
...@@ -265,8 +265,17 @@ class Response ...@@ -265,8 +265,17 @@ class Response
return $this->removeXmlFields($apiResponse, array('idsubdatatable_in_db')); 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);
} }
} }
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter