Browse Source

Adding more tests

Jose Lorenzo Rodriguez 10 years ago
parent
commit
eaea672d9b
1 changed files with 18 additions and 0 deletions
  1. 18 0
      tests/TestCase/ORM/QueryRegressionTest.php

+ 18 - 0
tests/TestCase/ORM/QueryRegressionTest.php

@@ -970,6 +970,24 @@ class QueryRegressionTest extends TestCase
     }
 
     /**
+     * Test that the typemaps used in function expressions
+     * create the correct results.
+     *
+     * @return void
+     */
+    public function testTypemapInFunctions2()
+    {
+        $table = TableRegistry::get('Comments');
+        $query = $table->find();
+        $query->select([
+            'id',
+            'max' => $query->func()->max('created', ['datetime'])
+        ]);
+        $result = $query->all()->first();
+        $this->assertEquals(new Time('2007-03-18 10:55:23'), $result['max']);
+    }
+
+    /**
      * Test that contain queries map types correctly.
      *
      * @return void