summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMichal Čihař <michal@cihar.com>2016-03-21 14:38:05 +0100
committerMichal Čihař <michal@cihar.com>2016-03-21 14:38:05 +0100
commit07c72515ad6fa716af710c4da4bdd0b29631af91 (patch)
treee03072d73524700debf59d4be709ea35fa7f6358 /tests
parentcb435b07eb8b8d0ee47c69b3519a1f40633f8180 (diff)
downloadsql-parser-07c72515ad6fa716af710c4da4bdd0b29631af91.zip
sql-parser-07c72515ad6fa716af710c4da4bdd0b29631af91.tar.gz
sql-parser-07c72515ad6fa716af710c4da4bdd0b29631af91.tar.bz2
Add testcase for alias in JOIN
See https://github.com/phpmyadmin/phpmyadmin/issues/11604 Signed-off-by: Michal Čihař <michal@cihar.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/Builder/SelectStatementTest.php19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/Builder/SelectStatementTest.php b/tests/Builder/SelectStatementTest.php
index c36150a..492d212 100644
--- a/tests/Builder/SelectStatementTest.php
+++ b/tests/Builder/SelectStatementTest.php
@@ -34,4 +34,23 @@ class SelectStatementTest extends TestCase
$stmt->build()
);
}
+
+ public function testBuilderAlias()
+ {
+ $parser = new Parser(
+ 'SELECT sgu.id, sgu.email_address FROM `sf_guard_user` sgu '
+ . 'RIGHT JOIN `student_course_booking` scb ON sgu.id = scb.user_id '
+ . 'WHERE `has_found_course` = \'1\' GROUP BY sgu.id '
+ . 'ORDER BY scb.id DESC LIMIT 0,300'
+ );
+ $stmt = $parser->statements[0];
+
+ $this->assertEquals(
+ 'SELECT sgu.id, sgu.email_address FROM `sf_guard_user` AS `sgu` '
+ . 'RIGHT JOIN `student_course_booking` AS `scb` ON sgu.id = scb.user_id '
+ . 'WHERE `has_found_course` = \'1\' GROUP BY sgu.id ASC '
+ . 'ORDER BY scb.id DESC LIMIT 300 ',
+ $stmt->build()
+ );
+ }
}