Skip to content
This repository
Browse code

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
Mark Story authored July 29, 2010
19  cake/tests/cases/libs/model/datasources/dbo/dbo_postgres.test.php
@@ -572,7 +572,7 @@ function testCakeSchema() {
572 572
 			date date,
573 573
 			CONSTRAINT test_suite_data_types_pkey PRIMARY KEY (id)
574 574
 		)');
575  
-		$model =& ClassRegistry::init('datatypes');
  575
+		$model = new Model(array('name' => 'Datatype', 'ds' => 'test_suite'));
576 576
 		$schema = new CakeSchema(array('connection' => 'test_suite'));
577 577
 		$result = $schema->read(array(
578 578
 			'connection' => 'test_suite',
@@ -807,4 +807,21 @@ function testQuoteDistinctInFunction() {
807 807
 		$expected = array('COUNT(DISTINCT FUNC("id"))');
808 808
 		$this->assertEqual($result, $expected);
809 809
 	}
  810
+
  811
+/**
  812
+ * test that saveAll works even with conditions that lack a model name.
  813
+ *
  814
+ * @return void
  815
+ */
  816
+	function testUpdateAllWithNonQualifiedConditions() {
  817
+		$this->loadFixtures('Article');
  818
+		$Article =& new Article();
  819
+		$result = $Article->updateAll(array('title' => "'Awesome'"), array('published' => 'Y'));
  820
+		$this->assertTrue($result);
  821
+
  822
+		$result = $Article->find('count', array(
  823
+			'conditions' => array('Article.title' => 'Awesome')
  824
+		));
  825
+		$this->assertEqual($result, 3, 'Article count is wrong or fixture has changed.');
  826
+	}
810 827
 }

0 notes on commit a9bb4ee

Please sign in to comment.
Something went wrong with that request. Please try again.