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:
authorBen Burgess <88810029+bx80@users.noreply.github.com>2021-10-14 06:49:21 +0300
committerGitHub <noreply@github.com>2021-10-14 06:49:21 +0300
commit90ca5b90508082dca94f91ca8d2c24997a4818b2 (patch)
treec17c97f6b430c594abb30e9183937e10349dd36e /tests/PHPUnit/Fixtures
parent22f2889e184c4edb3cace946c633821f637d46b6 (diff)
Visual indication of incomplete periods on charts (#18086)
Diffstat (limited to 'tests/PHPUnit/Fixtures')
-rw-r--r--tests/PHPUnit/Fixtures/SomeVisitsLastYearAndThisYear.php65
1 files changed, 65 insertions, 0 deletions
diff --git a/tests/PHPUnit/Fixtures/SomeVisitsLastYearAndThisYear.php b/tests/PHPUnit/Fixtures/SomeVisitsLastYearAndThisYear.php
new file mode 100644
index 0000000000..6619971e46
--- /dev/null
+++ b/tests/PHPUnit/Fixtures/SomeVisitsLastYearAndThisYear.php
@@ -0,0 +1,65 @@
+<?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\Fixtures;
+
+use Piwik\Date;
+use Piwik\Tests\Framework\Fixture;
+
+/**
+ * Fixture that adds one site and tracks one pageview for today.
+ */
+class SomeVisitsLastYearAndThisYear extends Fixture
+{
+ public $idSite = 1;
+ private $year;
+
+ public function setUp(): void
+ {
+ Fixture::createSuperUser();
+ $this->setUpWebsites();
+ $this->trackVisits();
+
+ $this->year = Date::today()->toString('Y');
+ }
+
+ public function tearDown(): void
+ {
+ // empty
+ }
+
+ private function setUpWebsites()
+ {
+ if (!self::siteCreated($idSite = 1)) {
+ $dt = Date::factory($this->year.'-01-01')->subYear(1);
+ self::createWebsite($dt);
+ }
+ }
+
+ private function trackVisits()
+ {
+
+ // This year, 5 visits
+ for ($i = 0;$i < 5;$i++) {
+ $dateTime = Date::factory($this->year.'-01-01')->toString();
+ $t = self::getTracker($this->idSite, $dateTime, $defaultInit = true);
+
+ $t->setUrl('http://example.org/index.htm');
+ self::checkResponse($t->doTrackPageView('0'));
+ }
+
+ // Last Year
+ for ($i = 0;$i < 5;$i++) {
+ $dateTime = Date::factory($this->year.'-01-01')->subYear(1)->toString();
+ $t = self::getTracker($this->idSite, $dateTime, $defaultInit = true);
+
+ $t->setUrl('http://example.org/index.htm');
+ self::checkResponse($t->doTrackPageView('0'));
+ }
+
+ }
+}