Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authordiosmosis <diosmosis@users.noreply.github.com>2018-09-06 01:51:44 +0300
committerGitHub <noreply@github.com>2018-09-06 01:51:44 +0300
commit5e71b34bbc05376a729a454d4f421dbfb9d26e39 (patch)
tree7fe8f891098cbb95995562b69c5af9f19f7e6ad2 /tests
parentd679c5571ece625b9863c63ad9b99d09f28ce63f (diff)
Couple test related changes for tests that load multiple other plugins (#13319)
* In tests:setup-fixture do not overwrite a Fixtures existing extra plugins to load. * Only uninstall plugins in test if dropDatabaseInTeardown is false. * Load fixture extra plugins in testing environment manipulator. * Handle test case fixture too.
Diffstat (limited to 'tests')
-rw-r--r--tests/PHPUnit/Framework/Fixture.php5
-rw-r--r--tests/PHPUnit/Framework/TestingEnvironmentManipulator.php12
2 files changed, 11 insertions, 6 deletions
diff --git a/tests/PHPUnit/Framework/Fixture.php b/tests/PHPUnit/Framework/Fixture.php
index 4f046c6776..7c43127a76 100644
--- a/tests/PHPUnit/Framework/Fixture.php
+++ b/tests/PHPUnit/Framework/Fixture.php
@@ -350,10 +350,9 @@ class Fixture extends \PHPUnit_Framework_Assert
// with error Error while sending QUERY packet. PID=XX
$this->tearDown();
- self::unloadAllPlugins();
-
-
if ($this->dropDatabaseInTearDown) {
+ self::unloadAllPlugins();
+
$this->dropDatabase();
}
diff --git a/tests/PHPUnit/Framework/TestingEnvironmentManipulator.php b/tests/PHPUnit/Framework/TestingEnvironmentManipulator.php
index ff75c429de..8370642cba 100644
--- a/tests/PHPUnit/Framework/TestingEnvironmentManipulator.php
+++ b/tests/PHPUnit/Framework/TestingEnvironmentManipulator.php
@@ -17,6 +17,7 @@ use Piwik\Config;
use Piwik\DbHelper;
use Piwik\Option;
use Piwik\Plugin;
+use Piwik\SettingsServer;
class FakePluginList extends PluginList
{
@@ -142,6 +143,8 @@ class TestingEnvironmentManipulator implements EnvironmentManipulator
{
$testVarDefinitionSource = new TestingEnvironmentVariablesDefinitionSource($this->vars);
+ $fixturePluginsToLoad = [];
+
$diConfigs = array($testVarDefinitionSource);
if ($this->vars->testCaseClass) {
$testCaseClass = $this->vars->testCaseClass;
@@ -151,6 +154,7 @@ class TestingEnvironmentManipulator implements EnvironmentManipulator
// Apply DI config from the fixture
if (isset($testCaseClass::$fixture)) {
$diConfigs[] = $testCaseClass::$fixture->provideContainerConfig();
+ $fixturePluginsToLoad = $testCaseClass::$fixture->extraPluginsToLoad;
}
if (method_exists($testCaseClass, 'provideContainerConfigBeforeClass')) {
@@ -166,6 +170,7 @@ class TestingEnvironmentManipulator implements EnvironmentManipulator
if ($this->classExists($fixtureClass)) {
$fixture = new $fixtureClass();
+ $fixturePluginsToLoad = $fixture->extraPluginsToLoad;
if (method_exists($fixture, 'provideContainerConfig')) {
$diConfigs[] = $fixture->provideContainerConfig();
@@ -173,7 +178,7 @@ class TestingEnvironmentManipulator implements EnvironmentManipulator
}
}
- $plugins = $this->getPluginsToLoadDuringTest();
+ $plugins = $this->getPluginsToLoadDuringTest($fixturePluginsToLoad);
$diConfigs[] = array(
'observers.global' => \DI\add($this->globalObservers),
@@ -203,7 +208,7 @@ class TestingEnvironmentManipulator implements EnvironmentManipulator
return $result;
}
- private function getPluginsToLoadDuringTest()
+ private function getPluginsToLoadDuringTest($fixtureExtraPlugins = [])
{
$plugins = $this->vars->getCoreAndSupportedPlugins();
@@ -216,7 +221,8 @@ class TestingEnvironmentManipulator implements EnvironmentManipulator
Plugin::getPluginNameFromNamespace($this->vars->testCaseClass),
Plugin::getPluginNameFromNamespace($this->vars->fixtureClass),
Plugin::getPluginNameFromNamespace(get_called_class())
- )
+ ),
+ $fixtureExtraPlugins
);
foreach ($extraPlugins as $pluginName) {