Skip to content
Permalink
Browse files

Fixing failing test caused by registry pollution.

Adding a test case to prove that unqualified column names work with postgresql.  Closes #930
  • Loading branch information...
markstory committed Jul 29, 2010
1 parent 9933b1e commit 9ea6800ebabbd3f6f61b3c21e2cc7db992644505
Showing with 18 additions and 1 deletion.
  1. +18 −1 cake/tests/cases/libs/model/datasources/dbo/dbo_postgres.test.php
@@ -477,7 +477,7 @@ function testCakeSchema() {
date date,
CONSTRAINT test_suite_data_types_pkey PRIMARY KEY (id)
)');
$model =& ClassRegistry::init('datatypes');
$model = new Model(array('name' => 'Datatype', 'ds' => 'test_suite'));
$schema = new CakeSchema(array('connection' => 'test_suite'));
$result = $schema->read(array(
'connection' => 'test_suite',
@@ -653,5 +653,22 @@ function testAlterIndexes() {

$this->db->query($this->db->dropSchema($schema1));
}

/**
* test that saveAll works even with conditions that lack a model name.
*
* @return void
*/
function testUpdateAllWithNonQualifiedConditions() {
$this->loadFixtures('Article');
$Article =& new Article();
$result = $Article->updateAll(array('title' => "'Awesome'"), array('published' => 'Y'));
$this->assertTrue($result);

$result = $Article->find('count', array(
'conditions' => array('Article.title' => 'Awesome')
));
$this->assertEqual($result, 3, 'Article count is wrong or fixture has changed.');
}
}
?>

0 comments on commit 9ea6800

Please sign in to comment.
You can’t perform that action at this time.