diff options
author | diosmosis <benaka@piwik.pro> | 2015-09-25 11:09:21 +0300 |
---|---|---|
committer | diosmosis <benaka@piwik.pro> | 2015-09-25 11:09:21 +0300 |
commit | a0e37cb91b8c4c9b833bbe083f34a3879f260a40 (patch) | |
tree | 719c35d8fdd6329ec4ce322e3975bba0874e6fb7 /plugins/SegmentEditor/tests/Integration | |
parent | c6d26d81ea91eb2eddac06c22f83c2f4322b6cd0 (diff) |
To provide better diagnostics to sysadmins, decorate segment SQL w/ any matching stored segment ID, even if not set to auto-archive and also decorate w/ special message if the SQL was triggered by core:archive.
Diffstat (limited to 'plugins/SegmentEditor/tests/Integration')
-rw-r--r-- | plugins/SegmentEditor/tests/Integration/SegmentQueryDecoratorTest.php | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/plugins/SegmentEditor/tests/Integration/SegmentQueryDecoratorTest.php b/plugins/SegmentEditor/tests/Integration/SegmentQueryDecoratorTest.php index eafa172dac..6d70acf2c5 100644 --- a/plugins/SegmentEditor/tests/Integration/SegmentQueryDecoratorTest.php +++ b/plugins/SegmentEditor/tests/Integration/SegmentQueryDecoratorTest.php @@ -44,7 +44,7 @@ class SegmentQueryDecoratorTest extends IntegrationTestCase $segmentEditorApi->add('segment 3', 'visitCount<2', 1, $autoArchive = true); $segmentEditorApi->add('segment 4', 'visitCount<2', 2, $autoArchive = true); - // test that segments w/ auto archive == false aren't included + // test that segments w/ auto archive == false are included $segmentEditorApi->add('segment 5', 'visitCount<2', 3, $autoArchive = false); $segmentEditorApi->add('segment 6', 'countryCode!=fr', 3, $autoArchive = false); } @@ -52,8 +52,12 @@ class SegmentQueryDecoratorTest extends IntegrationTestCase /** * @dataProvider getTestDataForSegmentSqlTest */ - public function test_SegmentSql_IsCorrectlyDecoratedWithIdSegment($segment, $expectedPrefix) + public function test_SegmentSql_IsCorrectlyDecoratedWithIdSegment($segment, $triggerValue, $expectedPrefix) { + if (!empty($triggerValue)) { + $_GET['trigger'] = $triggerValue; + } + $segment = new Segment($segment, array()); $query = $segment->getSelectQuery('*', 'log_visit'); @@ -69,10 +73,16 @@ class SegmentQueryDecoratorTest extends IntegrationTestCase public function getTestDataForSegmentSqlTest() { return array( - array('countryCode==fr', '/* idSegments = [2] */'), - array('visitCount<2', '/* idSegments = [1, 3, 4] */'), - array('', null), - array('countryCode!=fr', null), + array('countryCode==fr', null, '/* idSegments = [2] */'), + array('visitCount<2', null, '/* idSegments = [1, 3, 4, 5] */'), + array('', null, null), + array('countryCode!=fr', null, '/* idSegments = [6] */'), + + array('', 'archivephp', '/* trigger = CronArchive */'), + array('countryCode!=fr', 'archivephp', '/* trigger = CronArchive, idSegments = [6] */'), + + array('', 'garbage', null), + array('countryCode!=fr', 'garbage', '/* idSegments = [6] */'), ); } }
\ No newline at end of file |