diff options
author | diosmosis <benaka@piwik.pro> | 2015-10-18 03:35:20 +0300 |
---|---|---|
committer | diosmosis <benaka@piwik.pro> | 2015-10-27 07:46:53 +0300 |
commit | c3242ae09f91672e1b8067c440f9e3990a4fb82a (patch) | |
tree | e205879f44350ba177bf407684654d7c3e11924c /config/environment | |
parent | b04e2840fd3d6c0ade7d1bb1fa12e3c485b4b497 (diff) |
Remove host & port only if test port is defined in config & remove Piwik base path from all output so tests won't change based on machine.
Diffstat (limited to 'config/environment')
-rw-r--r-- | config/environment/ui-test.php | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/config/environment/ui-test.php b/config/environment/ui-test.php index 738d1556db..7d9351c445 100644 --- a/config/environment/ui-test.php +++ b/config/environment/ui-test.php @@ -5,8 +5,17 @@ return array( 'observers.global' => array( array('Request.dispatch.end', function (&$result) { - // remove the port from URLs if any so UI tests won't fail if the port isn't 80 - $result = preg_replace('/localhost:[0-9]+/', 'localhost', $result); + $config = \Piwik\Config::getInstance(); + $host = $config->tests['http_host']; + $port = $config->tests['port']; + + if (!empty($port)) { + // remove the port from URLs if any so UI tests won't fail if the port isn't 80 + $result = str_replace($host . ':' . $port, $host, $result); + } + + // remove PIWIK_INCLUDE_PATH from result so tests don't change based on the machine used + $result = str_replace(realpath(PIWIK_INCLUDE_PATH), '', $result); }), ), |