diff --git a/cake/tests/cases/libs/model/datasources/dbo_source.test.php b/cake/tests/cases/libs/model/datasources/dbo_source.test.php index 25702cc94..e1ec93b1c 100644 --- a/cake/tests/cases/libs/model/datasources/dbo_source.test.php +++ b/cake/tests/cases/libs/model/datasources/dbo_source.test.php @@ -1623,6 +1623,14 @@ class DboSourceTest extends UnitTestCase { $result = $this->db->conditions($conditions); $expected = " WHERE `User`.`first_name` = 'Firstname' AND `User`.`last_name` = 'Lastname'"; $this->assertEqual($result, $expected); + + $conditions = array( + 'Thread.project_id' => 5, + 'Thread.buyer_id' => 14, + '1=1 GROUP BY Thread.project_id' + ); + $result = $this->db->conditions($conditions); + $this->assertPattern('/^\s*WHERE\s+`Thread`.`project_id`\s*=\s*5\s+AND\s+`Thread`.`buyer_id`\s*=\s*14\s+AND\s+1\s*=\s*1\s+GROUP BY `Thread`.`project_id`$/', $result); } function testFieldParsing() { $result = $this->db->fields($this->model, 'Vendor', "Vendor.id, COUNT(Model.vendor_id) AS `Vendor`.`count`"); @@ -1684,6 +1692,10 @@ class DboSourceTest extends UnitTestCase { $result = $this->db->fields($this->model, null, 'COUNT(*)'); $expected = array('COUNT(*)'); $this->assertEqual($result, $expected); + + $result = $this->db->fields($this->model, null, 'SUM(Thread.unread_buyer) AS ' . $this->db->name('sum_unread_buyer')); + $expected = array('SUM(`Thread`.`unread_buyer`) AS `sum_unread_buyer`'); + $this->assertEqual($result, $expected); } function testMergeAssociations() {