diff --git a/cake/tests/cases/libs/model/datasources/dbo/dbo_postgres.test.php b/cake/tests/cases/libs/model/datasources/dbo/dbo_postgres.test.php index ab84540a2da..e789bae4abb 100644 --- a/cake/tests/cases/libs/model/datasources/dbo/dbo_postgres.test.php +++ b/cake/tests/cases/libs/model/datasources/dbo/dbo_postgres.test.php @@ -677,7 +677,7 @@ function testAlterIndexes() { */ function testVirtualFields() { $this->loadFixtures('Article', 'Comment'); - $Article =& ClassRegistry::init('Article'); + $Article = new Article; $Article->virtualFields = array( 'next_id' => 'Article.id + 1', 'complex' => 'Article.title || Article.body', @@ -690,5 +690,14 @@ function testVirtualFields() { $this->assertEqual($result['Article']['functional'], $result['Article']['title']); $this->assertEqual($result['Article']['subquery'], 6); } + + /** + * Tests additional order options for postgres + */ + function testOrderAdditionalParams() { + $result = $this->db->order(array('title' => 'DESC NULLS FIRSTS', 'body' => 'DESC')); + $expected = ' ORDER BY "title" DESC NULLS FIRSTS, "body" DESC'; + $this->assertEqual($result, $expected); + } } ?> \ No newline at end of file diff --git a/cake/tests/cases/libs/model/model_read.test.php b/cake/tests/cases/libs/model/model_read.test.php index 3efd9f4797e..bdcb4db2a67 100755 --- a/cake/tests/cases/libs/model/model_read.test.php +++ b/cake/tests/cases/libs/model/model_read.test.php @@ -76,7 +76,7 @@ function testFetchingNonUniqueFKJoinTableRecords() { function testGroupBy() { $db = ConnectionManager::getDataSource('test_suite'); $isStrictGroupBy = in_array($db->config['driver'], array('postgres', 'oracle')); - $message = '%s Postgresql and Oracle have strict GROUP BY and are incompatible with this test.'; + $message = '%s Postgres and Oracle have strict GROUP BY and are incompatible with this test.'; if ($this->skipIf($isStrictGroupBy, $message )) { return; @@ -4030,6 +4030,9 @@ function testFindAllWithConditionsHavingMixedDataTypes() { $result = $TestModel->find('all', compact('conditions', 'recursive', 'order')); $this->assertEqual($result, $expected); + if ($this->skipIf($this->db->config['driver'] == 'postgres', 'The rest of testFindAllWithConditionsHavingMixedDataTypes test is not compatible with Postgres')) { + return; + } $conditions = array('id' => array('1', 2, '3.0')); $order = 'Article.id ASC'; $result = $TestModel->find('all', compact('recursive', 'conditions', 'order')); @@ -7240,6 +7243,9 @@ function testVirtualFields() { $result = $Post->field('other_field'); $this->assertEqual($result, 4); + if ($this->skipIf($this->db->config['driver'] == 'postgres', 'The rest of virtualFieds test is not compatible with Postgres')) { + return; + } ClassRegistry::flush(); $Post =& ClassRegistry::init('Post');