diff options
author | diosmosis <benaka@piwik.pro> | 2015-10-15 04:05:02 +0300 |
---|---|---|
committer | diosmosis <benaka@piwik.pro> | 2015-10-27 07:46:52 +0300 |
commit | af70ae0a2fa058772fbcdecef9cb0a13e463c319 (patch) | |
tree | 99d6c42fc6eb3c09ad6862fde6921d5474633b20 /tests/PHPUnit/Framework/TestingEnvironmentManipulator.php | |
parent | 9aebceffc788b73544803dcd83b44cde07d29842 (diff) |
Make sure server port is included in current URLs in case Piwik is on a separate URL.
Diffstat (limited to 'tests/PHPUnit/Framework/TestingEnvironmentManipulator.php')
-rw-r--r-- | tests/PHPUnit/Framework/TestingEnvironmentManipulator.php | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/tests/PHPUnit/Framework/TestingEnvironmentManipulator.php b/tests/PHPUnit/Framework/TestingEnvironmentManipulator.php index be1c17f959..cbd7f9185c 100644 --- a/tests/PHPUnit/Framework/TestingEnvironmentManipulator.php +++ b/tests/PHPUnit/Framework/TestingEnvironmentManipulator.php @@ -55,6 +55,8 @@ class TestingEnvironmentManipulator implements EnvironmentManipulator { $this->vars = $testingEnvironment; $this->globalObservers = $globalObservers; + + $this->removePortIfPresentInHttpHeader(); } public function makeGlobalSettingsProvider(GlobalSettingsProvider $original) @@ -234,4 +236,15 @@ class TestingEnvironmentManipulator implements EnvironmentManipulator . "Is the namespace correct? Is the file in the correct folder?"); } } -}
\ No newline at end of file + + private function removePortIfPresentInHttpHeader() + { + if (isset($_SERVER['HTTP_HOST']) + && preg_match("/(.*[^:]):([0-9]+)/", $_SERVER['HTTP_HOST'], $matches) + ) { + // phantomjs sends the port in HTTP_HOST which causes some UI tests to fail. so if it's present, we remove it here. + $_SERVER['HTTP_HOST'] = $matches[1]; + $_SERVER['SERVER_PORT'] = $matches[2]; + } + } +} |