Browse Source

Fix tests for postgres.

Identifier quoting rules are a pain in postgres.
Mark Story 10 years ago
parent
commit
bbb829a2a7
1 changed files with 7 additions and 5 deletions
  1. 7 5
      tests/TestCase/ORM/QueryTest.php

+ 7 - 5
tests/TestCase/ORM/QueryTest.php

@@ -1473,8 +1473,10 @@ class QueryTest extends TestCase
         $counter->select([
                 'total' => $counter->func()->count('*')
             ])
-            ->where(['ArticlesTags.tag_id' => 1])
-            ->where(['ArticlesTags.article_id = Articles.id']);
+            ->where([
+                'ArticlesTags.tag_id' => 1,
+                'ArticlesTags.article_id' => new IdentifierExpression('Articles.id')
+            ]);
 
         $result = $table->find('all')
             ->select([
@@ -1498,12 +1500,12 @@ class QueryTest extends TestCase
         $table = TableRegistry::get('Articles');
         $query = $table->find();
         $query->select([
-            'admin' => $query->func()->concat(
-                ['Articles.title' => 'literal', 'test'],
+            'title' => $query->func()->concat(
+                ['title' => 'literal', 'test'],
                 ['string']
             ),
         ]);
-        $query->where(['Articles.id' => 1]);
+        $query->where(['id' => 1]);
         $this->assertCount(1, $query->all());
         $this->assertEquals(1, $query->count());
     }