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:
authorThomas Steur <tsteur@users.noreply.github.com>2020-11-23 04:18:29 +0300
committerGitHub <noreply@github.com>2020-11-23 04:18:29 +0300
commit9da2de3233592acc789eb61bdc775bd8ddf6b115 (patch)
treef12a4741048a81274cb4cf4b03e5adcac3493e8a /tests
parent4cfbe93000e610bd152eb66e5b4a8874cd9304e2 (diff)
Remove existing invalidations before scheduling new ones (#16772)4.0.0-rc7
Diffstat (limited to 'tests')
-rw-r--r--tests/PHPUnit/Integration/DataAccess/ArchiveInvalidatorTest.php19
1 files changed, 18 insertions, 1 deletions
diff --git a/tests/PHPUnit/Integration/DataAccess/ArchiveInvalidatorTest.php b/tests/PHPUnit/Integration/DataAccess/ArchiveInvalidatorTest.php
index 9aa35cd543..e2d2d59af0 100644
--- a/tests/PHPUnit/Integration/DataAccess/ArchiveInvalidatorTest.php
+++ b/tests/PHPUnit/Integration/DataAccess/ArchiveInvalidatorTest.php
@@ -1209,7 +1209,7 @@ class ArchiveInvalidatorTest extends IntegrationTestCase
$this->invalidator->scheduleReArchiving('all', 'VisitsSummary');
$this->invalidator->applyScheduledReArchiving();
- $countInvalidations = Db::fetchOne("SELECT COUNT(*) FROM " . Common::prefixTable('archive_invalidations'));
+ $countInvalidations = $this->getNumInvalidations();
$invalidationSites = Db::fetchAll("SELECT DISTINCT idsite FROM " . Common::prefixTable('archive_invalidations'));
$invalidationSites = array_column($invalidationSites, 'idsite');
@@ -1218,6 +1218,23 @@ class ArchiveInvalidatorTest extends IntegrationTestCase
$this->assertEquals([1,2,3,4,5,6,7,8,9,10], $invalidationSites);
}
+ private function getNumInvalidations()
+ {
+ return Db::fetchOne("SELECT COUNT(*) FROM " . Common::prefixTable('archive_invalidations'));
+ }
+
+ public function test_scheduleReArchiving_cleanupWhenReportGiven()
+ {
+ $this->invalidator->scheduleReArchiving([1, 2, 3], 'ExamplePlugin', '5');
+ $this->invalidator->applyScheduledReArchiving();
+ $this->assertEquals(729, $this->getNumInvalidations());
+
+ $this->invalidator->scheduleReArchiving([1, 2, 3], 'ExamplePlugin', '5');
+ $this->invalidator->applyScheduledReArchiving();
+ // should not end up having twice the amount of invalidations but delete existing
+ $this->assertEquals(729, $this->getNumInvalidations());
+
+ }
public function test_reArchiveReport_createsCorrectInvalidationEntries_ifNoReportSpecified()
{
Date::$now = strtotime('2020-06-16 12:00:00');