Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
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...
commit a9bb4eefae5ff2ec192043601c1042a1b07ca59d 1 parent 596c751
@markstory markstory authored
View
19 cake/tests/cases/libs/model/datasources/dbo/dbo_postgres.test.php
@@ -572,7 +572,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',
@@ -807,4 +807,21 @@ function testQuoteDistinctInFunction() {
$expected = array('COUNT(DISTINCT FUNC("id"))');
$this->assertEqual($result, $expected);
}
+
+/**
+ * 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.');
+ }
}
Please sign in to comment.
Something went wrong with that request. Please try again.