diff options
author | diosmosis <diosmosis@users.noreply.github.com> | 2020-12-17 06:38:58 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-17 06:38:58 +0300 |
commit | 7edc2c9864f1b2fe43324f247ea82564d1112319 (patch) | |
tree | d9417a43af5f33ec2b12b1404bfc616eefd561f5 /plugins/CoreConsole | |
parent | 9e6094647e7151ba00e34ae234d4f6890ab52c2e (diff) |
Apparently the segment needs to be double encoded when sent in the climulti:request command. (#16947)
* Apparently the segment needs to be double encoded when sent in the climulti:request command.
* add test
* add expected
* fix test
Diffstat (limited to 'plugins/CoreConsole')
5 files changed, 82 insertions, 2 deletions
diff --git a/plugins/CoreConsole/tests/System/ArchiveCronTest.php b/plugins/CoreConsole/tests/System/ArchiveCronTest.php index 35063a1951..034b58906a 100644 --- a/plugins/CoreConsole/tests/System/ArchiveCronTest.php +++ b/plugins/CoreConsole/tests/System/ArchiveCronTest.php @@ -39,6 +39,8 @@ class ArchiveCronTest extends SystemTestCase { const NEW_SEGMENT = 'operatingSystemCode==IOS'; const NEW_SEGMENT_NAME = 'segmentForToday'; + const ENCODED_SEGMENT = 'pageUrl=@%252F'; + const ENCODED_SEGMENT_NAME = 'segmentWithEncoding'; /** * @var ManySitesImportedLogs @@ -54,11 +56,13 @@ class ArchiveCronTest extends SystemTestCase private static function addNewSegmentToPast() { - // add one segment and set it's created/updated time to some time in the past so we don't re-archive for it Config::getInstance()->General['enable_browser_archiving_triggering'] = 0; + // add one segment and set it's created/updated time to some time in the past so we don't re-archive for it $idSegment = API::getInstance()->add(self::NEW_SEGMENT_NAME, self::NEW_SEGMENT, self::$fixture->idSite, $autoArchive = 1, $enabledAllUsers = 1); + // add another segment w/ special encoded value + $idSegment2 = API::getInstance()->add(self::ENCODED_SEGMENT_NAME, self::ENCODED_SEGMENT, self::$fixture->idSite, $autoArchive = 1, $enabledAllUsers = 1); Config::getInstance()->General['enable_browser_archiving_triggering'] = 1; - Db::exec("UPDATE " . Common::prefixTable('segment') . ' SET ts_created = \'2015-01-02 00:00:00\', ts_last_edit = \'2015-01-02 00:00:00\' WHERE idsegment = ' . $idSegment); + Db::exec("UPDATE " . Common::prefixTable('segment') . ' SET ts_created = \'2015-01-02 00:00:00\', ts_last_edit = \'2015-01-02 00:00:00\' WHERE idsegment IN (' . $idSegment . ", " . $idSegment2 . ")"); } private static function trackVisitsForToday() @@ -95,6 +99,12 @@ class ArchiveCronTest extends SystemTestCase 'segment' => self::NEW_SEGMENT, 'testSuffix' => '_' . self::NEW_SEGMENT_NAME)); + $results[] = array('VisitsSummary.get', array('idSite' => 'all', + 'date' => 'today', + 'periods' => ['day', 'week', 'month', 'year'], + 'segment' => self::ENCODED_SEGMENT, + 'testSuffix' => '_' . self::ENCODED_SEGMENT_NAME)); + // ExamplePlugin metric $results[] = ['ExamplePlugin.getExampleArchivedMetric', [ 'idSite' => 'all', diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentWithEncoding_noOptions__VisitsSummary.get_day.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentWithEncoding_noOptions__VisitsSummary.get_day.xml new file mode 100644 index 0000000000..907663817a --- /dev/null +++ b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentWithEncoding_noOptions__VisitsSummary.get_day.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="utf-8" ?> +<results> + <result idSite="1"> + <nb_uniq_visitors>1</nb_uniq_visitors> + <nb_users>0</nb_users> + <nb_visits>2</nb_visits> + <nb_actions>2</nb_actions> + <nb_visits_converted>2</nb_visits_converted> + <bounce_count>2</bounce_count> + <sum_visit_length>0</sum_visit_length> + <max_actions>1</max_actions> + <bounce_rate>100%</bounce_rate> + <nb_actions_per_visit>1</nb_actions_per_visit> + <avg_time_on_site>0</avg_time_on_site> + </result> + <result idSite="2" /> + <result idSite="3" /> +</results>
\ No newline at end of file diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentWithEncoding_noOptions__VisitsSummary.get_month.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentWithEncoding_noOptions__VisitsSummary.get_month.xml new file mode 100644 index 0000000000..907663817a --- /dev/null +++ b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentWithEncoding_noOptions__VisitsSummary.get_month.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="utf-8" ?> +<results> + <result idSite="1"> + <nb_uniq_visitors>1</nb_uniq_visitors> + <nb_users>0</nb_users> + <nb_visits>2</nb_visits> + <nb_actions>2</nb_actions> + <nb_visits_converted>2</nb_visits_converted> + <bounce_count>2</bounce_count> + <sum_visit_length>0</sum_visit_length> + <max_actions>1</max_actions> + <bounce_rate>100%</bounce_rate> + <nb_actions_per_visit>1</nb_actions_per_visit> + <avg_time_on_site>0</avg_time_on_site> + </result> + <result idSite="2" /> + <result idSite="3" /> +</results>
\ No newline at end of file diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentWithEncoding_noOptions__VisitsSummary.get_week.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentWithEncoding_noOptions__VisitsSummary.get_week.xml new file mode 100644 index 0000000000..907663817a --- /dev/null +++ b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentWithEncoding_noOptions__VisitsSummary.get_week.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="utf-8" ?> +<results> + <result idSite="1"> + <nb_uniq_visitors>1</nb_uniq_visitors> + <nb_users>0</nb_users> + <nb_visits>2</nb_visits> + <nb_actions>2</nb_actions> + <nb_visits_converted>2</nb_visits_converted> + <bounce_count>2</bounce_count> + <sum_visit_length>0</sum_visit_length> + <max_actions>1</max_actions> + <bounce_rate>100%</bounce_rate> + <nb_actions_per_visit>1</nb_actions_per_visit> + <avg_time_on_site>0</avg_time_on_site> + </result> + <result idSite="2" /> + <result idSite="3" /> +</results>
\ No newline at end of file diff --git a/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentWithEncoding_noOptions__VisitsSummary.get_year.xml b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentWithEncoding_noOptions__VisitsSummary.get_year.xml new file mode 100644 index 0000000000..079f977d9b --- /dev/null +++ b/plugins/CoreConsole/tests/System/expected/test_ArchiveCronTest_segmentWithEncoding_noOptions__VisitsSummary.get_year.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="utf-8" ?> +<results> + <result idSite="1"> + <nb_visits>2</nb_visits> + <nb_actions>2</nb_actions> + <nb_visits_converted>2</nb_visits_converted> + <bounce_count>2</bounce_count> + <sum_visit_length>0</sum_visit_length> + <max_actions>1</max_actions> + <bounce_rate>100%</bounce_rate> + <nb_actions_per_visit>1</nb_actions_per_visit> + <avg_time_on_site>0</avg_time_on_site> + </result> + <result idSite="2" /> + <result idSite="3" /> +</results>
\ No newline at end of file |