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:
authorZoltan Flamis <flamisz@gmail.com>2021-03-15 05:34:03 +0300
committerGitHub <noreply@github.com>2021-03-15 05:34:03 +0300
commit1a688e5ec4c4c96f7017b59bb2dbfac78c7c81d1 (patch)
tree83ce44b8b03f6bc98d2df0d00aadfd4e1f5ccd19 /plugins/SegmentEditor/tests
parent069d2de9acb02bf337eb3d079e712a3071ee4f6d (diff)
modify SegmentQueryDecorator so extra comment information can be saved (#17337)
* modify SegmentQueryDecorator so extra comment information can be saved * Update LogAggregator.php * fix tests
Diffstat (limited to 'plugins/SegmentEditor/tests')
-rw-r--r--plugins/SegmentEditor/tests/Integration/SegmentQueryDecoratorTest.php15
-rw-r--r--plugins/SegmentEditor/tests/Unit/SegmentQueryDecoratorTest.php6
2 files changed, 12 insertions, 9 deletions
diff --git a/plugins/SegmentEditor/tests/Integration/SegmentQueryDecoratorTest.php b/plugins/SegmentEditor/tests/Integration/SegmentQueryDecoratorTest.php
index 7cf0c46de3..7cc9158cd0 100644
--- a/plugins/SegmentEditor/tests/Integration/SegmentQueryDecoratorTest.php
+++ b/plugins/SegmentEditor/tests/Integration/SegmentQueryDecoratorTest.php
@@ -72,22 +72,23 @@ class SegmentQueryDecoratorTest extends IntegrationTestCase
$this->assertStringStartsNotWith("/* idSegments", $sql);
} else {
$this->assertStringStartsWith($expectedPrefix, $sql);
+ $this->assertEquals(1, substr_count($sql, 'SELECT'));
}
}
public function getTestDataForSegmentSqlTest()
{
return array(
- array('countryCode==fr', null, '/* idSegments = [2] */'),
- array('visitCount<2', null, '/* idSegments = [1, 3, 4, 5] */'),
+ array('countryCode==fr', null, 'SELECT /* idSegments = [2] */'),
+ array('visitCount<2', null, 'SELECT /* idSegments = [1, 3, 4, 5] */'),
array('', null, null),
- array('countryCode!=fr', null, '/* idSegments = [6] */'),
+ array('countryCode!=fr', null, 'SELECT /* idSegments = [6] */'),
- array('', 'archivephp', '/* trigger = CronArchive */'),
- array('countryCode!=fr', 'archivephp', '/* trigger = CronArchive, idSegments = [6] */'),
+ array('', 'archivephp', 'SELECT /* trigger = CronArchive */'),
+ array('countryCode!=fr', 'archivephp', 'SELECT /* trigger = CronArchive, idSegments = [6] */'),
array('', 'garbage', null),
- array('countryCode!=fr', 'garbage', '/* idSegments = [6] */'),
+ array('countryCode!=fr', 'garbage', 'SELECT /* idSegments = [6] */'),
);
}
-} \ No newline at end of file
+}
diff --git a/plugins/SegmentEditor/tests/Unit/SegmentQueryDecoratorTest.php b/plugins/SegmentEditor/tests/Unit/SegmentQueryDecoratorTest.php
index 1f7b6a29c1..593bac5bed 100644
--- a/plugins/SegmentEditor/tests/Unit/SegmentQueryDecoratorTest.php
+++ b/plugins/SegmentEditor/tests/Unit/SegmentQueryDecoratorTest.php
@@ -68,7 +68,8 @@ class SegmentQueryDecoratorTest extends \PHPUnit\Framework\TestCase
$query = $this->decorator->getSelectQueryString($expression, '*', 'log_visit', '', array(), '', '', '');
- $this->assertStringStartsWith('/* idSegments = [3] */', $query['sql']);
+ $this->assertStringStartsWith('SELECT /* idSegments = [3] */', $query['sql']);
+ $this->assertEquals(1, substr_count($query['sql'], 'SELECT'));
}
public function test_getSelectQueryString_DecoratesSql_WhenMultipleStoredSegmentsMatchUsedSegment()
@@ -78,7 +79,8 @@ class SegmentQueryDecoratorTest extends \PHPUnit\Framework\TestCase
$query = $this->decorator->getSelectQueryString($expression, '*', 'log_visit', '', array(), '', '', '');
- $this->assertStringStartsWith('/* idSegments = [2, 4] */', $query['sql']);
+ $this->assertStringStartsWith('SELECT /* idSegments = [2, 4] */', $query['sql']);
+ $this->assertEquals(1, substr_count($query['sql'], 'SELECT'));
}
private function getMockSegmentEditorService()