public function testRenderArrayJoinConstraintComplexArray()
{
$model = 'lithium\\tests\\mocks\\data\\model\\MockQueryComment';
$query = new Query(compact('model') + array('type' => 'read', 'source' => 'comments', 'alias' => 'Comments', 'conditions' => array('Comment.id' => 1), 'joins' => array(array('mode' => 'LEFT', 'source' => 'posts', 'alias' => 'Post', 'constraints' => array("Comment.post_id" => array('<=' => 'Post.id', '>=' => 'Post.id'))))));
$expected = "SELECT * FROM {comments} AS {Comments} LEFT JOIN {posts} AS {Post} ON ";
$expected .= "({Comment}.{post_id} <= {Post}.{id} AND {Comment}.{post_id} >= {Post}.{id}) ";
$expected .= "WHERE {Comment}.{id} = 1;";
$result = $this->_db->renderCommand($query);
$this->assertEqual($expected, $result);
$query = new Query(compact('model') + array('type' => 'read', 'source' => 'comments', 'alias' => 'Comments', 'joins' => array(array('mode' => 'LEFT', 'source' => 'posts', 'alias' => 'Post', 'constraints' => array('Comment.post_id' => array('=>' => 'Post.id'))))));
$db = $this->_db;
$this->assertException("Unsupported operator `=>`.", function () use($db, $query) {
$db->renderCommand($query);
});
}