diff options
author | diosmosis <diosmosis@users.noreply.github.com> | 2020-11-04 10:28:49 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-04 10:28:49 +0300 |
commit | c4315d221f9bb30538dc395fa9387e1f8c9892ee (patch) | |
tree | d24907c062eace4e154b3139cba288c86801c213 /tests | |
parent | 375dd9f6933dcf7eeb37df9d2d9f44d16f35a277 (diff) |
make sure date2 is always defined in ArchiveInvalidator::reArchiveReport (#16665)
* make sure date2 is always defined
* add test
Diffstat (limited to 'tests')
-rw-r--r-- | tests/PHPUnit/Integration/DataAccess/ArchiveInvalidatorTest.php | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/tests/PHPUnit/Integration/DataAccess/ArchiveInvalidatorTest.php b/tests/PHPUnit/Integration/DataAccess/ArchiveInvalidatorTest.php index 83b06802a1..b9e84b674b 100644 --- a/tests/PHPUnit/Integration/DataAccess/ArchiveInvalidatorTest.php +++ b/tests/PHPUnit/Integration/DataAccess/ArchiveInvalidatorTest.php @@ -1242,6 +1242,64 @@ class ArchiveInvalidatorTest extends IntegrationTestCase $this->assertEquals($expectedInvalidations, $actualInvalidations); } + public function test_reArchive_acceptsCustomStartDate() + { + Date::$now = strtotime('2020-06-16 12:00:00'); + + Config::getInstance()->General['rearchive_reports_in_past_last_n_months'] = 'last3'; + + $customStartDate = Date::yesterday()->subMonth(1)->setDay(1); + $this->invalidator->reArchiveReport([1], 'VisitsSummary', 'some.Report', $customStartDate); + + $expectedInvalidations = [ + array ( + 'idsite' => '1', + 'period' => '1', + 'name' => 'done.VisitsSummary', + 'report' => 'some.Report', + 'dates' => '2020-05-01,2020-05-01|2020-05-02,2020-05-02|2020-05-03,2020-05-03|2020-05-04,2020-05-04|2020-05-05,2020-05-05' + . '|2020-05-06,2020-05-06|2020-05-07,2020-05-07|2020-05-08,2020-05-08|2020-05-09,2020-05-09|2020-05-10,2020-05-10' + . '|2020-05-11,2020-05-11|2020-05-12,2020-05-12|2020-05-13,2020-05-13|2020-05-14,2020-05-14|2020-05-15,2020-05-15' + . '|2020-05-16,2020-05-16|2020-05-17,2020-05-17|2020-05-18,2020-05-18|2020-05-19,2020-05-19|2020-05-20,2020-05-20' + . '|2020-05-21,2020-05-21|2020-05-22,2020-05-22|2020-05-23,2020-05-23|2020-05-24,2020-05-24|2020-05-25,2020-05-25' + . '|2020-05-26,2020-05-26|2020-05-27,2020-05-27|2020-05-28,2020-05-28|2020-05-29,2020-05-29|2020-05-30,2020-05-30' + . '|2020-05-31,2020-05-31|2020-06-01,2020-06-01|2020-06-02,2020-06-02|2020-06-03,2020-06-03|2020-06-04,2020-06-04' + . '|2020-06-05,2020-06-05|2020-06-06,2020-06-06|2020-06-07,2020-06-07|2020-06-08,2020-06-08|2020-06-09,2020-06-09' + . '|2020-06-10,2020-06-10|2020-06-11,2020-06-11|2020-06-12,2020-06-12|2020-06-13,2020-06-13|2020-06-14,2020-06-14', + 'count' => '45', + ), + array ( + 'idsite' => '1', + 'period' => '2', + 'name' => 'done.VisitsSummary', + 'report' => 'some.Report', + 'dates' => '2020-05-04,2020-05-10|2020-05-11,2020-05-17|2020-05-18,2020-05-24|2020-05-25,2020-05-31|2020-04-27,2020-05-03' + . '|2020-06-01,2020-06-07|2020-06-08,2020-06-14', + 'count' => '7', + ), + array ( + 'idsite' => '1', + 'period' => '3', + 'name' => 'done.VisitsSummary', + 'report' => 'some.Report', + 'dates' => '2020-05-01,2020-05-31|2020-06-01,2020-06-30', + 'count' => '2', + ), + array ( + 'idsite' => '1', + 'period' => '4', + 'name' => 'done.VisitsSummary', + 'report' => 'some.Report', + 'dates' => '2020-01-01,2020-12-31', + 'count' => '1', + ), + ]; + + $actualInvalidations = $this->getInvalidatedArchiveTableEntriesSummary(); + + $this->assertEquals($expectedInvalidations, $actualInvalidations); + } + public function test_reArchive_alsoInvalidatesSegments() { Date::$now = strtotime('2020-06-16 12:00:00'); |