diff options
Diffstat (limited to 'test/QueryBuilderTest.php')
-rw-r--r-- | test/QueryBuilderTest.php | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/test/QueryBuilderTest.php b/test/QueryBuilderTest.php index bd888c0..a6e275b 100644 --- a/test/QueryBuilderTest.php +++ b/test/QueryBuilderTest.php @@ -373,6 +373,12 @@ class QueryBuilderTest extends PHPUnit_Framework_TestCase { $this->assertEquals($expected, ORM::get_last_query()); } + public function testJonWithAliasesAndWhere() { + ORM::for_table('widget')->table_alias('w')->join('widget_handle', array('wh.widget_id', '=', 'w.id'), 'wh')->where_equal('id', 1)->find_many(); + $expected = "SELECT * FROM `widget` `w` JOIN `widget_handle` `wh` ON `wh`.`widget_id` = `w`.`id` WHERE `w`.`id` = '1'"; + $this->assertEquals($expected, ORM::get_last_query()); + } + public function testJoinWithStringConstraint() { ORM::for_table('widget')->join('widget_handle', "widget_handle.widget_id = widget.id")->find_many(); $expected = "SELECT * FROM `widget` JOIN `widget_handle` ON widget_handle.widget_id = widget.id"; |