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:
Diffstat (limited to 'tests/PHPUnit/System/SpecialDateParamsTest.php')
-rw-r--r--tests/PHPUnit/System/SpecialDateParamsTest.php78
1 files changed, 78 insertions, 0 deletions
diff --git a/tests/PHPUnit/System/SpecialDateParamsTest.php b/tests/PHPUnit/System/SpecialDateParamsTest.php
new file mode 100644
index 0000000000..f3508c2223
--- /dev/null
+++ b/tests/PHPUnit/System/SpecialDateParamsTest.php
@@ -0,0 +1,78 @@
+<?php
+/**
+ * Matomo - 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\System;
+
+use Piwik\Tests\Fixtures\VisitsInCurrentYear;
+use Piwik\Tests\Framework\TestCase\SystemTestCase;
+
+/**
+ * @group SpecialDateParams
+ * @group Core
+ */
+class SpecialDateParamsTest extends SystemTestCase
+{
+ public static $fixture = null; // initialized below class definition
+
+ /**
+ * @dataProvider getApiForTesting
+ */
+ public function testApi($api, $params)
+ {
+ $this->runApiTests($api, $params);
+ }
+
+ public function getApiForTesting()
+ {
+ return [
+ [
+ ['VisitsSummary.getVisits', 'Actions.getPageTitles'],
+ [
+ 'idSite' => self::$fixture->idSite,
+ 'date' => 'last week',
+ 'periods' => ['day'],
+ 'testSuffix' => '_lastweek',
+ ],
+ ],
+ [
+ ['VisitsSummary.getVisits', 'Actions.getPageTitles'],
+ [
+ 'idSite' => self::$fixture->idSite,
+ 'date' => 'last month',
+ 'periods' => ['day'],
+ 'testSuffix' => '_lastmonth',
+ ],
+ ],
+ [
+ ['VisitsSummary.getVisits', 'Actions.getPageTitles'],
+ [
+ 'idSite' => self::$fixture->idSite,
+ 'date' => 'lastyear',
+ 'periods' => ['day'],
+ 'testSuffix' => '_lastyear',
+ ],
+ ],
+ [
+ ['VisitsSummary.getVisits', 'Actions.getPageTitles'],
+ [
+ 'idSite' => self::$fixture->idSite,
+ 'date' => 'last-year,lastWeek',
+ 'periods' => ['range'],
+ 'testSuffix' => '_range',
+ ],
+ ],
+ ];
+ }
+
+ public static function getOutputPrefix()
+ {
+ return 'specialDateParams';
+ }
+}
+
+SpecialDateParamsTest::$fixture = new VisitsInCurrentYear(); \ No newline at end of file