mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 17:16:18 +00:00
Fixing some tests for Postgres Dbo and adding test cverage for extra params in order function, closes #353
This commit is contained in:
parent
a79ff508a6
commit
acccf964a5
2 changed files with 17 additions and 2 deletions
|
@ -677,7 +677,7 @@ class DboPostgresTest extends CakeTestCase {
|
|||
*/
|
||||
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 @@ class DboPostgresTest extends CakeTestCase {
|
|||
$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);
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -76,7 +76,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
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 @@ class ModelReadTest extends BaseModelTest {
|
|||
$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 @@ class ModelReadTest extends BaseModelTest {
|
|||
$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');
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue