public function testConditions() {
$query = new Query(array(
'type' => 'read', 'model' => $this->_model,
'conditions' => array(
'or' => array(
'id' => 'value1',
'title' => 'value2',
'and' => array('author_id' => '1', 'created' => '2'),
array('title' => 'value2'),
array('title' => null)
),
'id' => '3',
'author_id' => false
)
));
$sql = "SELECT * FROM {mock_database_posts} AS {MockDatabasePost} WHERE ";
$sql .= "({id} = 0 OR {title} = 'value2' OR ({author_id} = 1 AND {created} = '2')";
$sql .= " OR ({title} = 'value2') OR (title IS NULL)) AND {id} = 3 AND author_id = 0;";
$this->assertEqual($sql, $this->db->renderCommand($query));
$query = new Query(array(
'type' => 'read', 'model' => $this->_model,
'conditions' => array('title' => array('0900'))
));
$sql = "SELECT * FROM {mock_database_posts} AS {MockDatabasePost} WHERE title IN ('0900');";
$this->assertEqual($sql, $this->db->renderCommand($query));
}