diff options
author | Jamie Matthews <[email protected]> | 2010-10-25 19:02:45 +0100 |
---|---|---|
committer | Jamie Matthews <[email protected]> | 2010-10-25 19:02:45 +0100 |
commit | b54973b4e0f157c79b2d0e2062d233ba2260b1a8 (patch) | |
tree | 17e0e8f79876862e3f5a305d52f197d278f88d76 | |
parent | 09a8877d6781d199af128126956d251809f574ce (diff) |
Add test for multiple join sources
-rw-r--r-- | test/test_queries.php | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/test/test_queries.php b/test/test_queries.php index c045347..d72c101 100644 --- a/test/test_queries.php +++ b/test/test_queries.php @@ -140,6 +140,13 @@ $expected = "SELECT * FROM `widget` FULL OUTER JOIN `widget_handle` ON `widget_handle`.`widget_id` = `widget`.`id`"; Tester::check_equal("Full outer join", $expected); + ORM::for_table('widget') + ->join('widget_handle', array('widget_handle.widget_id', '=', 'widget.id')) + ->join('widget_nozzle', array('widget_nozzle.widget_id', '=', 'widget.id')) + ->find_many(); + $expected = "SELECT * FROM `widget` JOIN `widget_handle` ON `widget_handle`.`widget_id` = `widget`.`id` JOIN `widget_nozzle` ON `widget_nozzle`.`widget_id` = `widget`.`id`"; + Tester::check_equal("Multiple join sources", $expected); + ORM::for_table('widget')->join('widget_handle', array('wh.widget_id', '=', 'widget.id'), 'wh')->find_many(); $expected = "SELECT * FROM `widget` JOIN `widget_handle` `wh` ON `wh`.`widget_id` = `widget`.`id`"; Tester::check_equal("Join with alias", $expected); |