summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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()
+ );
+ }
}