summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSimon Holywell <[email protected]>2013-08-28 12:24:09 +0100
committerSimon Holywell <[email protected]>2013-08-28 12:24:09 +0100
commitd477a0c8d5812695b118981cad4838ac1c2ad703 (patch)
tree2aa9611553c9a8fd6af6c4655c5303ff692fc507 /test
parentb1d868a6ad05c46e9444f4a06707c05b6bc2bf4d (diff)
parent8132c2125f7d1c69b69ac6c426b2a041584dbd59 (diff)
Merge branch 'vicvicvic-wherealias' of https://github.com/vicvicvic/idiorm into develop
Diffstat (limited to 'test')
-rw-r--r--test/QueryBuilderTest.php6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/QueryBuilderTest.php b/test/QueryBuilderTest.php
index 6888c85..6da0997 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 testJoinWithAliasesAndWhere() {
+ 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";