Browse Source

Fix failing test.

Marshalling oversize decimal values will result in float casting which
can lose precision. I'd like to remove that float casting but am
concerned that it will create backwards compatibility issues as people
would start getting strings instead of float values.
Mark Story 9 years ago
parent
commit
c0e8960160
1 changed files with 4 additions and 4 deletions
  1. 4 4
      tests/TestCase/ORM/QueryTest.php

+ 4 - 4
tests/TestCase/ORM/QueryTest.php

@@ -2924,15 +2924,15 @@ class QueryTest extends TestCase
     {
         $this->loadFixtures('Datatypes');
 
-        $big = '1234567890123456789';
+        $big = 1234567890123456789.2;
         $table = TableRegistry::get('Datatypes');
-        $entity = $table->newEntity([
-            'cost' => $big,
-        ]);
+        $entity = $table->newEntity([]);
+        $entity->cost = $big;
         $table->save($entity);
         $out = $table->find()->where([
             'cost' => $big
         ])->first();
+        $this->assertNotEmpty($out, 'Should get a record');
         $this->assertSame(sprintf('%F', $big), sprintf('%F', $out->cost));
     }