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:
authorStefan Giehl <stefan@matomo.org>2021-05-26 20:41:30 +0300
committerGitHub <noreply@github.com>2021-05-26 20:41:30 +0300
commitcf2572e603d87e551fae9e694f34262528e13f20 (patch)
tree5e8f981de4540849544773cb579b7b9b59d9e1cf /tests
parent27965abcc37c1457b8f4e5f9d64620aa1701f4a0 (diff)
Clear EventDispatcher cache in tests (#17620)
Diffstat (limited to 'tests')
-rw-r--r--tests/PHPUnit/Framework/Fixture.php2
-rw-r--r--tests/PHPUnit/Framework/TestCase/IntegrationTestCase.php9
-rw-r--r--tests/PHPUnit/Unit/DataAccess/LogQueryBuilder/JoinTablesTest.php2
3 files changed, 8 insertions, 5 deletions
diff --git a/tests/PHPUnit/Framework/Fixture.php b/tests/PHPUnit/Framework/Fixture.php
index fefe641240..18f7b68d31 100644
--- a/tests/PHPUnit/Framework/Fixture.php
+++ b/tests/PHPUnit/Framework/Fixture.php
@@ -24,6 +24,7 @@ use Piwik\DataTable\Manager as DataTableManager;
use Piwik\Date;
use Piwik\Db;
use Piwik\DbHelper;
+use Piwik\EventDispatcher;
use Piwik\FrontController;
use Matomo\Ini\IniReader;
use Piwik\Log;
@@ -405,6 +406,7 @@ class Fixture extends \PHPUnit\Framework\Assert
PiwikCache::getEagerCache()->flushAll();
PiwikCache::getLazyCache()->flushAll();
ArchiveTableCreator::clear();
+ EventDispatcher::getInstance()->clearCache();
\Piwik\Plugins\ScheduledReports\API::$cache = array();
Singleton::clearAll();
PluginsArchiver::$archivers = array();
diff --git a/tests/PHPUnit/Framework/TestCase/IntegrationTestCase.php b/tests/PHPUnit/Framework/TestCase/IntegrationTestCase.php
index c44995e904..4d31a70d34 100644
--- a/tests/PHPUnit/Framework/TestCase/IntegrationTestCase.php
+++ b/tests/PHPUnit/Framework/TestCase/IntegrationTestCase.php
@@ -9,13 +9,11 @@
namespace Piwik\Tests\Framework\TestCase;
use Piwik\Access;
-use Piwik\Config;
+use Piwik\Cache as PiwikCache;
use Piwik\Db;
-use Piwik\DbHelper;
-use Piwik\Menu\MenuAbstract;
+use Piwik\EventDispatcher;
use Piwik\Option;
use Piwik\Tests\Framework\Fixture;
-use Piwik\Cache as PiwikCache;
use Piwik\Tests\Framework\TestingEnvironmentVariables;
/**
@@ -90,8 +88,11 @@ abstract class IntegrationTestCase extends SystemTestCase
self::restoreDbTables(self::$tableData);
}
+ // Note: we can't clear all in memory caches at this point
+ // Otherwise fixtures can't be used to e.g. manipulate static instances
PiwikCache::getEagerCache()->flushAll();
PiwikCache::getTransientCache()->flushAll();
+ EventDispatcher::getInstance()->clearCache();
Option::clearCache();
}
diff --git a/tests/PHPUnit/Unit/DataAccess/LogQueryBuilder/JoinTablesTest.php b/tests/PHPUnit/Unit/DataAccess/LogQueryBuilder/JoinTablesTest.php
index 5c54297296..847d9e0348 100644
--- a/tests/PHPUnit/Unit/DataAccess/LogQueryBuilder/JoinTablesTest.php
+++ b/tests/PHPUnit/Unit/DataAccess/LogQueryBuilder/JoinTablesTest.php
@@ -6,7 +6,7 @@
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*
*/
-namespace Piwik\Tests\Unit\DataAccess;
+namespace Piwik\Tests\Unit\DataAccess\LogQueryBuilder;
use Piwik\DataAccess\LogQueryBuilder\JoinTables;
use Piwik\Tests\Framework\Mock\Plugin\LogTablesProvider;