diff options
Diffstat (limited to 'tests/PHPUnit/Framework')
-rw-r--r-- | tests/PHPUnit/Framework/Fixture.php | 15 | ||||
-rw-r--r-- | tests/PHPUnit/Framework/Mock/TestConfig.php | 11 |
2 files changed, 25 insertions, 1 deletions
diff --git a/tests/PHPUnit/Framework/Fixture.php b/tests/PHPUnit/Framework/Fixture.php index 88b057f4e1..1150444db3 100644 --- a/tests/PHPUnit/Framework/Fixture.php +++ b/tests/PHPUnit/Framework/Fixture.php @@ -15,6 +15,7 @@ use Piwik\Auth; use Piwik\Auth\Password; use Matomo\Cache\Backend\File; use Piwik\Cache as PiwikCache; +use Piwik\CliMulti\CliPhp; use Piwik\Common; use Piwik\Config; use Piwik\Container\StaticContainer; @@ -145,6 +146,20 @@ class Fixture extends \PHPUnit_Framework_Assert return 'python'; } + public static function getCliCommandBase() + { + $cliPhp = new CliPhp(); + $php = $cliPhp->findPhpBinary(); + + $command = $php . ' ' . PIWIK_INCLUDE_PATH .'/tests/PHPUnit/proxy/console '; + + if (!empty($_SERVER['HTTP_HOST'])) { + $command .= '--matomo-domain=' . $_SERVER['HTTP_HOST']; + } + + return $command; + } + public static function getTestRootUrl() { return self::getRootUrl() . 'tests/PHPUnit/proxy/'; diff --git a/tests/PHPUnit/Framework/Mock/TestConfig.php b/tests/PHPUnit/Framework/Mock/TestConfig.php index 3676163e0d..7fe0302e11 100644 --- a/tests/PHPUnit/Framework/Mock/TestConfig.php +++ b/tests/PHPUnit/Framework/Mock/TestConfig.php @@ -58,9 +58,18 @@ class TestConfig extends Config // Ensure local mods do not affect tests if (empty($pathGlobal)) { + $general = $chain->getFrom($this->getLocalPath(), 'General'); + $instanceId = isset($general['instance_id']) ? $general['instance_id'] : null; + $chain->set('Debug', $chain->getFrom($this->getGlobalPath(), 'Debug')); $chain->set('mail', $chain->getFrom($this->getGlobalPath(), 'mail')); - $chain->set('General', $chain->getFrom($this->getGlobalPath(), 'General')); + + $globalGeneral = $chain->getFrom($this->getGlobalPath(), 'General'); + if ($instanceId) { + $globalGeneral['instance_id'] = $instanceId; + } + $chain->set('General', $globalGeneral); + $chain->set('Segments', $chain->getFrom($this->getGlobalPath(), 'Segments')); $chain->set('Tracker', $chain->getFrom($this->getGlobalPath(), 'Tracker')); $chain->set('Deletelogs', $chain->getFrom($this->getGlobalPath(), 'Deletelogs')); |