diff options
Diffstat (limited to 'plugins/SegmentEditor/tests')
-rw-r--r-- | plugins/SegmentEditor/tests/Integration/SegmentQueryDecoratorTest.php | 15 | ||||
-rw-r--r-- | plugins/SegmentEditor/tests/Unit/SegmentQueryDecoratorTest.php | 6 |
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() |