/** * @covers Openbuildings\Kohana\Database_Query_Builder_Select::reset */ public function test_reset() { $query = new Database_Query_Builder_Select(array('name', 'price')); $this->assertEquals("SELECT *", $query->from('table1')->where('name', '=', 'text')->having('name', 'IS NOT', NULL)->group_by('name')->distinct(TRUE)->offset(100)->limit(100)->join('table2')->on('table1.name', '=', 'table2.name')->order_by('name', 'DESC')->union('table2')->reset()->compile()); }
/** * @covers Openbuildings\Kohana\Database_Query_Builder::_compile_conditions */ public function test_where_operands() { $query = new Database_Query_Builder_Select(); $this->assertEquals("SELECT * WHERE `table1`.`name` = 'test' AND `table1`.`name` IS NULL AND `table1`.`name` IS NOT NULL AND `table1`.`price` BETWEEN 10 AND 20 AND `table1`.`name` = 'other test'", $query->where('table1.name', '=', 'test')->where('table1.name', '=', NULL)->where('table1.name', '!=', NULL)->where('table1.price', 'BETWEEN', array(10, 20))->where(array('table1.name', 'test_name'), '=', 'other test')->compile()); }