Skip to content

Commit

Permalink
Fix failing postgres tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Walther Lalk committed Aug 13, 2014
1 parent b39e57e commit 6185092
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/TestCase/Database/QueryTest.php
Expand Up @@ -2736,6 +2736,12 @@ public function testSqlCaseStatement() {
->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),
Expand Down

0 comments on commit 6185092

Please sign in to comment.