Browse Source

Fix failing postgres tests

Walther Lalk 11 years ago
parent
commit
618509293d
1 changed files with 6 additions and 0 deletions
  1. 6 0
      tests/TestCase/Database/QueryTest.php

+ 6 - 0
tests/TestCase/Database/QueryTest.php

@@ -2736,6 +2736,12 @@ class QueryTest extends TestCase {
 					->add(['published' => 'N']), 1, 'integer'
 			);
 
+		//Postgres requires the case statement to be cast to a integer
+		if ($this->connection->driver() instanceof \Cake\Database\Driver\Postgres) {
+			$publishedCase = $query->func()->cast([$publishedCase, 'integer' => 'literal'])->type(' AS ');
+			$notPublishedCase = $query->func()->cast([$notPublishedCase, 'integer' => 'literal'])->type(' AS ');
+		}
+
 		$results = $query
 			->select([
 				'published' => $query->func()->sum($publishedCase),