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:
authorStefan Giehl <stefan@matomo.org>2019-09-20 17:54:23 +0300
committerdiosmosis <diosmosis@users.noreply.github.com>2019-09-20 17:54:23 +0300
commitb00220e9c401a1a0da3a57422cd7c8b41fdb1691 (patch)
tree428ec1694593ac74ae3bada0cc4ccd9d5ab71c1e /plugins/CoreConsole
parenta3a61b5a7f1aa5b99fe6f32abbc7c7dbfc9533e1 (diff)
Ensure all plugins are archived when range archiving is triggered by core:archive (#14890)
* Ensure all plugins are archived when range archiving is triggered by core:archive * adds tests for range archiving
Diffstat (limited to 'plugins/CoreConsole')
-rw-r--r--plugins/CoreConsole/tests/System/ArchiveCronTest.php26
-rw-r--r--plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_range_archive__Actions.get_range.xml11
-rw-r--r--plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_range_archive__DevicesDetection.getType_range.xml122
-rw-r--r--plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_range_archive__VisitsSummary.get_range.xml12
4 files changed, 171 insertions, 0 deletions
diff --git a/plugins/CoreConsole/tests/System/ArchiveCronTest.php b/plugins/CoreConsole/tests/System/ArchiveCronTest.php
index 6832946e6b..a40218b669 100644
--- a/plugins/CoreConsole/tests/System/ArchiveCronTest.php
+++ b/plugins/CoreConsole/tests/System/ArchiveCronTest.php
@@ -8,6 +8,7 @@
namespace Piwik\Plugins\CoreConsole\tests\System;
use Interop\Container\ContainerInterface;
+use Piwik\Config;
use Piwik\Date;
use Piwik\Plugins\SitesManager\API;
use Piwik\Tests\Framework\TestCase\SystemTestCase;
@@ -110,6 +111,31 @@ class ArchiveCronTest extends SystemTestCase
}
}
+ public function testArchivePhpCronArchivesFullRanges()
+ {
+ $this->setLastRunArchiveOptions();
+
+ self::$fixture->getTestEnvironment()->overrideConfig('General', 'enable_browser_archiving_triggering', 0);
+ self::$fixture->getTestEnvironment()->overrideConfig('General', 'archiving_range_force_on_browser_request', 0);
+ self::$fixture->getTestEnvironment()->overrideConfig('General', 'archiving_custom_ranges', ['2012-08-09,2012-08-13']);
+ self::$fixture->getTestEnvironment()->save();
+
+ Config::getInstance()->General['enable_browser_archiving_triggering'] = 0;
+ Config::getInstance()->General['archiving_range_force_on_browser_request'] = 0;
+ Config::getInstance()->General['archiving_custom_ranges'][] = '';
+
+ $output = $this->runArchivePhpCron(['--force-periods' => 'range', '--force-idsites' => 1]);
+
+ $this->runApiTests(array(
+ 'VisitsSummary.get', 'Actions.get', 'DevicesDetection.getType'),
+ array('idSite' => '1',
+ 'date' => '2012-08-09,2012-08-13',
+ 'periods' => array('range'),
+ 'testSuffix' => '_range_archive'
+ )
+ );
+ }
+
public function test_archivePhpScript_DoesNotFail_WhenCommandHelpRequested()
{
$output = $this->runArchivePhpCron(array('--help' => null), PIWIK_INCLUDE_PATH . '/misc/cron/archive.php');
diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_range_archive__Actions.get_range.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_range_archive__Actions.get_range.xml
new file mode 100644
index 0000000000..8ea3b42ae1
--- /dev/null
+++ b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_range_archive__Actions.get_range.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<result>
+ <nb_pageviews>29</nb_pageviews>
+ <nb_uniq_pageviews>29</nb_uniq_pageviews>
+ <nb_downloads>4</nb_downloads>
+ <nb_uniq_downloads>4</nb_uniq_downloads>
+ <nb_outlinks>0</nb_outlinks>
+ <nb_uniq_outlinks>0</nb_uniq_outlinks>
+ <nb_searches>0</nb_searches>
+ <nb_keywords>0</nb_keywords>
+</result> \ No newline at end of file
diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_range_archive__DevicesDetection.getType_range.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_range_archive__DevicesDetection.getType_range.xml
new file mode 100644
index 0000000000..b70ccff568
--- /dev/null
+++ b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_range_archive__DevicesDetection.getType_range.xml
@@ -0,0 +1,122 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<result>
+ <row>
+ <label>Desktop</label>
+ <nb_visits>26</nb_visits>
+ <nb_actions>29</nb_actions>
+ <max_actions>3</max_actions>
+ <sum_visit_length>305</sum_visit_length>
+ <bounce_count>24</bounce_count>
+ <nb_visits_converted>25</nb_visits_converted>
+ <goals>
+ <row idgoal='1'>
+ <nb_conversions>25</nb_conversions>
+ <nb_visits_converted>25</nb_visits_converted>
+ <revenue>125</revenue>
+ </row>
+ </goals>
+ <nb_conversions>25</nb_conversions>
+ <revenue>125</revenue>
+ <sum_daily_nb_uniq_visitors>26</sum_daily_nb_uniq_visitors>
+ <sum_daily_nb_users>1</sum_daily_nb_users>
+ <segment>deviceType==desktop</segment>
+ <logo>plugins/Morpheus/icons/dist/devices/desktop.png</logo>
+ </row>
+ <row>
+ <label>Smartphone</label>
+ <nb_visits>2</nb_visits>
+ <nb_actions>2</nb_actions>
+ <max_actions>1</max_actions>
+ <sum_visit_length>0</sum_visit_length>
+ <bounce_count>2</bounce_count>
+ <nb_visits_converted>2</nb_visits_converted>
+ <goals>
+ <row idgoal='1'>
+ <nb_conversions>2</nb_conversions>
+ <nb_visits_converted>2</nb_visits_converted>
+ <revenue>10</revenue>
+ </row>
+ </goals>
+ <nb_conversions>2</nb_conversions>
+ <revenue>10</revenue>
+ <sum_daily_nb_uniq_visitors>2</sum_daily_nb_uniq_visitors>
+ <sum_daily_nb_users>0</sum_daily_nb_users>
+ <segment>deviceType==smartphone</segment>
+ <logo>plugins/Morpheus/icons/dist/devices/smartphone.png</logo>
+ </row>
+ <row>
+ <label>Unknown</label>
+ <nb_visits>2</nb_visits>
+ <nb_actions>2</nb_actions>
+ <max_actions>1</max_actions>
+ <sum_visit_length>0</sum_visit_length>
+ <bounce_count>2</bounce_count>
+ <nb_visits_converted>1</nb_visits_converted>
+ <goals>
+ <row idgoal='1'>
+ <nb_conversions>1</nb_conversions>
+ <nb_visits_converted>1</nb_visits_converted>
+ <revenue>5</revenue>
+ </row>
+ </goals>
+ <nb_conversions>1</nb_conversions>
+ <revenue>5</revenue>
+ <sum_daily_nb_uniq_visitors>2</sum_daily_nb_uniq_visitors>
+ <sum_daily_nb_users>0</sum_daily_nb_users>
+ <logo>plugins/Morpheus/icons/dist/devices/unknown.png</logo>
+ </row>
+ <row>
+ <label>Camera</label>
+ <nb_visits>0</nb_visits>
+ <segment>deviceType==camera</segment>
+ <logo>plugins/Morpheus/icons/dist/devices/camera.png</logo>
+ </row>
+ <row>
+ <label>Car browser</label>
+ <nb_visits>0</nb_visits>
+ <segment>deviceType==car+browser</segment>
+ <logo>plugins/Morpheus/icons/dist/devices/car_browser.png</logo>
+ </row>
+ <row>
+ <label>Console</label>
+ <nb_visits>0</nb_visits>
+ <segment>deviceType==console</segment>
+ <logo>plugins/Morpheus/icons/dist/devices/console.png</logo>
+ </row>
+ <row>
+ <label>Feature phone</label>
+ <nb_visits>0</nb_visits>
+ <segment>deviceType==feature+phone</segment>
+ <logo>plugins/Morpheus/icons/dist/devices/feature_phone.png</logo>
+ </row>
+ <row>
+ <label>Phablet</label>
+ <nb_visits>0</nb_visits>
+ <segment>deviceType==phablet</segment>
+ <logo>plugins/Morpheus/icons/dist/devices/phablet.png</logo>
+ </row>
+ <row>
+ <label>Portable media player</label>
+ <nb_visits>0</nb_visits>
+ <segment>deviceType==portable+media+player</segment>
+ <logo>plugins/Morpheus/icons/dist/devices/portable_media_player.png</logo>
+ </row>
+ <row>
+ <label>Smart display</label>
+ <nb_visits>0</nb_visits>
+ <segment>deviceType==smart+display</segment>
+ <logo>plugins/Morpheus/icons/dist/devices/smart_display.png</logo>
+ </row>
+ <row>
+ <label>Tablet</label>
+ <nb_visits>0</nb_visits>
+ <segment>deviceType==tablet</segment>
+ <logo>plugins/Morpheus/icons/dist/devices/tablet.png</logo>
+ </row>
+ <row>
+ <label>Tv</label>
+ <nb_visits>0</nb_visits>
+ <segment>deviceType==tv</segment>
+ <logo>plugins/Morpheus/icons/dist/devices/tv.png</logo>
+ </row>
+</result> \ No newline at end of file
diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_range_archive__VisitsSummary.get_range.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_range_archive__VisitsSummary.get_range.xml
new file mode 100644
index 0000000000..8cf54e7a39
--- /dev/null
+++ b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_range_archive__VisitsSummary.get_range.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<result>
+ <nb_visits>30</nb_visits>
+ <nb_actions>33</nb_actions>
+ <nb_visits_converted>28</nb_visits_converted>
+ <bounce_count>28</bounce_count>
+ <sum_visit_length>305</sum_visit_length>
+ <max_actions>3</max_actions>
+ <bounce_rate>93%</bounce_rate>
+ <nb_actions_per_visit>1.1</nb_actions_per_visit>
+ <avg_time_on_site>10</avg_time_on_site>
+</result> \ No newline at end of file