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
diff options
context:
space:
mode:
authordiosmosis <diosmosis@users.noreply.github.com>2020-01-08 11:05:41 +0300
committerMatthieu Aubry <mattab@users.noreply.github.com>2020-01-08 11:05:41 +0300
commit3c2b5f714f85457796e3e190781d3e592822ebf7 (patch)
tree5e7049fd0bac597481bfe70f972602af5c0220b9 /tests/PHPUnit/Unit
parent18b0815a78d158b45afbd752c7e21581321acb4c (diff)
Do not proceed with archiving if a valid archive exists for the parameter combination. (#14937)
* Do not proceed with archiving if a valid archive exists for the parameter combination. * test manually and get to work * Apply some review feedback. * apply more review feedback * Do not abort archiving if archive found for non-day period so segments will still archive. * Apply more review feedback. * Make new optimization aware of whole periods. * update submodule * In CronArchive modify lastN date parameter to use oldest invalidated archive. * Move date changing logic to method and unit test. * Fix test.
Diffstat (limited to 'tests/PHPUnit/Unit')
-rw-r--r--tests/PHPUnit/Unit/Archiver/RequestTest.php47
1 files changed, 47 insertions, 0 deletions
diff --git a/tests/PHPUnit/Unit/Archiver/RequestTest.php b/tests/PHPUnit/Unit/Archiver/RequestTest.php
new file mode 100644
index 0000000000..ae168023c2
--- /dev/null
+++ b/tests/PHPUnit/Unit/Archiver/RequestTest.php
@@ -0,0 +1,47 @@
+<?php
+/**
+ * Piwik - free/libre analytics platform
+ *
+ * @link https://matomo.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ *
+ */
+
+namespace Piwik\Tests\Unit\Archiver;
+
+
+use Piwik\Archiver\Request;
+
+class RequestTest extends \PHPUnit_Framework_TestCase
+{
+ /**
+ * @dataProvider getTestDataForChangeDate
+ */
+ public function test_changeDate_replacesDateProperly($url, $newDate, $expectedNewUrl)
+ {
+ $request = new Request($url);
+ $request->changeDate($newDate);
+ $this->assertEquals($expectedNewUrl, $request->getUrl());
+ }
+
+ public function getTestDataForChangeDate()
+ {
+ return [
+ [
+ 'http://abc.com/index.php?trigger=archivephp&method=API.get&date=2012-03-04',
+ 'last12',
+ 'http://abc.com/index.php?trigger=archivephp&method=API.get&date=last12',
+ ],
+ [
+ 'http://abc.com/index.php?trigger=archivephp&method=API.get&date=2012-03-04,2013-02-4&period=day',
+ 'previous18',
+ 'http://abc.com/index.php?trigger=archivephp&method=API.get&date=previous18&period=day',
+ ],
+ [
+ 'http://abc.com/index.php?date=lastN&period=day',
+ '2013-10-12,2013-11-19',
+ 'http://abc.com/index.php?date=2013-10-12,2013-11-19&period=day',
+ ],
+ ];
+ }
+} \ No newline at end of file