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:
-rw-r--r--core/DataTable.php5
-rw-r--r--plugins/Insights/DataTable/Filter/Insight.php13
-rw-r--r--tests/PHPUnit/Fixtures/ManyVisitsWithMockLocationProvider.php17
-rw-r--r--tests/PHPUnit/System/BlobReportLimitingTest.php6
-rw-r--r--tests/PHPUnit/System/expected/test_reportLimiting_rankingQueryDisabled__Insights.getInsightsOverview_day.xml59
5 files changed, 99 insertions, 1 deletions
diff --git a/core/DataTable.php b/core/DataTable.php
index 26d85a49e5..06352d98ee 100644
--- a/core/DataTable.php
+++ b/core/DataTable.php
@@ -432,6 +432,11 @@ class DataTable implements DataTableInterface, \IteratorAggregate, \ArrayAccess
return $this->totalsRow;
}
+ public function getSummaryRow()
+ {
+ return $this->summaryRow;
+ }
+
/**
* Returns the name of the column this table was sorted by (if any).
*
diff --git a/plugins/Insights/DataTable/Filter/Insight.php b/plugins/Insights/DataTable/Filter/Insight.php
index 8e13d5ecae..51e96193cf 100644
--- a/plugins/Insights/DataTable/Filter/Insight.php
+++ b/plugins/Insights/DataTable/Filter/Insight.php
@@ -95,8 +95,19 @@ class Insight extends DataTable\Filter\CalculateEvolutionFilter
$this->addRow($table, $row, $growthPercentage, $newValue, $oldValue, $difference, $isDisappeared, $isNew, $isMover);
}
+ protected function getPastRowFromCurrent($row)
+ {
+ if ($row->isSummaryRow()) {
+ return $this->pastDataTable->getSummaryRow();
+ }
+ return $this->pastDataTable->getRowFromLabel($row->getColumn('label'));
+ }
+
private function getRowFromTable(DataTable $table, DataTable\Row $row)
{
+ if ($row->isSummaryRow()) {
+ return $table->getSummaryRow();
+ }
return $table->getRowFromLabel($row->getColumn('label'));
}
@@ -116,4 +127,4 @@ class Insight extends DataTable\Filter\CalculateEvolutionFilter
$table->addRowFromArray(array(DataTable\Row::COLUMNS => $columns));
}
-} \ No newline at end of file
+}
diff --git a/tests/PHPUnit/Fixtures/ManyVisitsWithMockLocationProvider.php b/tests/PHPUnit/Fixtures/ManyVisitsWithMockLocationProvider.php
index 1ef910065c..02a0d7aecc 100644
--- a/tests/PHPUnit/Fixtures/ManyVisitsWithMockLocationProvider.php
+++ b/tests/PHPUnit/Fixtures/ManyVisitsWithMockLocationProvider.php
@@ -40,6 +40,7 @@ class ManyVisitsWithMockLocationProvider extends Fixture
$this->setMockLocationProvider();
$this->trackVisits();
$this->trackVisitsForNegativeOneRowAndSummary();
+ $this->trackVisitsForInsightsOverview();
ManyVisitsWithGeoIP::unsetLocationProvider();
}
@@ -272,4 +273,20 @@ class ManyVisitsWithMockLocationProvider extends Fixture
self::makeLocation('Yokohama', '14', 'JP'),
);
}
+
+ private function trackVisitsForInsightsOverview()
+ {
+ $t = Fixture::getTracker($this->idSite, '2015-03-03 06:00:00');
+ $t->enableBulkTracking();
+ $datesVisits = ['2015-03-03 06:00:00' => 700, '2015-03-04 06:00:00' => 1000];
+ foreach ($datesVisits as $dateTime => $visitCount) {
+ $t->setForceVisitDateTime($dateTime);
+ for ($i = 0; $i != $visitCount; ++$i) {
+ $t->setNewVisitorId();
+ $t->setUrl('http://somesite.com/' . $i);
+ $t->doTrackPageView('page title ' . $i);
+ }
+ }
+ Fixture::checkBulkTrackingResponse($t->doBulkTrack());
+ }
} \ No newline at end of file
diff --git a/tests/PHPUnit/System/BlobReportLimitingTest.php b/tests/PHPUnit/System/BlobReportLimitingTest.php
index 666ec84ea2..8d8a055b5e 100644
--- a/tests/PHPUnit/System/BlobReportLimitingTest.php
+++ b/tests/PHPUnit/System/BlobReportLimitingTest.php
@@ -130,6 +130,12 @@ class BlobReportLimitingTest extends SystemTestCase
'flat' => 1,
'expanded' => 0
))),
+
+ ['Insights.getInsightsOverview', [
+ 'idSite' => 1,
+ 'date' => '2015-03-04',
+ 'period' => ['day'],
+ ]],
);
}
diff --git a/tests/PHPUnit/System/expected/test_reportLimiting_rankingQueryDisabled__Insights.getInsightsOverview_day.xml b/tests/PHPUnit/System/expected/test_reportLimiting_rankingQueryDisabled__Insights.getInsightsOverview_day.xml
new file mode 100644
index 0000000000..3e8b4386bf
--- /dev/null
+++ b/tests/PHPUnit/System/expected/test_reportLimiting_rankingQueryDisabled__Insights.getInsightsOverview_day.xml
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<results>
+ <result defaultKeyName="Page URLs">
+ <row>
+ <label>Others</label>
+ <nb_visits>501</nb_visits>
+ <growth_percent>149.3%</growth_percent>
+ <growth_percent_numeric>149.3</growth_percent_numeric>
+ <grown>1</grown>
+ <value_old>201</value_old>
+ <value_new>501</value_new>
+ <difference>300</difference>
+ <importance>300</importance>
+ <isDisappeared>0</isDisappeared>
+ <isNew>0</isNew>
+ <isMover>1</isMover>
+ <isMoverAndShaker>1</isMoverAndShaker>
+ </row>
+ </result>
+ <result defaultKeyName="Page titles">
+ <row>
+ <label>Others</label>
+ <nb_visits>501</nb_visits>
+ <growth_percent>149.3%</growth_percent>
+ <growth_percent_numeric>149.3</growth_percent_numeric>
+ <grown>1</grown>
+ <value_old>201</value_old>
+ <value_new>501</value_new>
+ <difference>300</difference>
+ <importance>300</importance>
+ <isDisappeared>0</isDisappeared>
+ <isNew>0</isNew>
+ <isMover>1</isMover>
+ <isMoverAndShaker>1</isMoverAndShaker>
+ </row>
+ </result>
+ <result defaultKeyName="Downloads" />
+ <result defaultKeyName="Websites" />
+ <result defaultKeyName="Campaigns" />
+ <result defaultKeyName="Social Networks" />
+ <result defaultKeyName="Search Engines" />
+ <result defaultKeyName="Country">
+ <row>
+ <label>France</label>
+ <nb_visits>1</nb_visits>
+ <growth_percent>-100%</growth_percent>
+ <growth_percent_numeric>-100</growth_percent_numeric>
+ <grown>0</grown>
+ <value_old>1</value_old>
+ <value_new>0</value_new>
+ <difference>-1</difference>
+ <importance>1</importance>
+ <isDisappeared>1</isDisappeared>
+ <isNew>0</isNew>
+ <isMover>0</isMover>
+ <isMoverAndShaker>0</isMoverAndShaker>
+ </row>
+ </result>
+</results> \ No newline at end of file