Browse Source

Fix failing unit tests.

I'm not sure if these changes maintain the original intent of the tests. It looks like they were written specifically to see if the integer would be preserved in a string of text. Either way, the tests have been updated to reflect the framework changes and should pass now.
Dustin Haggard 7 years ago
parent
commit
4a08af5a33

+ 4 - 4
tests/TestCase/Database/ConnectionTest.php

@@ -468,7 +468,7 @@ class ConnectionTest extends TestCase
         $title = 'changed the title!';
         $body = new \DateTime('2012-01-01');
         $values = compact('title', 'body');
-        $this->connection->update('things', $values, ['id' => '1-string-parsed-as-int'], ['body' => 'date', 'id' => 'integer']);
+        $this->connection->update('things', $values, ['id' => '1'], ['body' => 'date', 'id' => 'integer']);
         $result = $this->connection->execute('SELECT * FROM things WHERE title = :title AND body = :body', $values, ['body' => 'date']);
         $this->assertCount(1, $result);
         $row = $result->fetch('assoc');
@@ -495,17 +495,17 @@ class ConnectionTest extends TestCase
      */
     public function testDeleteWithConditions()
     {
-        $this->connection->delete('things', ['id' => '1-rest-is-omitted'], ['id' => 'integer']);
+        $this->connection->delete('things', ['id' => '1'], ['id' => 'integer']);
         $result = $this->connection->execute('SELECT * FROM things');
         $this->assertCount(1, $result);
         $result->closeCursor();
 
-        $this->connection->delete('things', ['id' => '1-rest-is-omitted'], ['id' => 'integer']);
+        $this->connection->delete('things', ['id' => '1'], ['id' => 'integer']);
         $result = $this->connection->execute('SELECT * FROM things');
         $this->assertCount(1, $result);
         $result->closeCursor();
 
-        $this->connection->delete('things', ['id' => '2-rest-is-omitted'], ['id' => 'integer']);
+        $this->connection->delete('things', ['id' => '2'], ['id' => 'integer']);
         $result = $this->connection->execute('SELECT * FROM things');
         $this->assertCount(0, $result);
         $result->closeCursor();

+ 2 - 2
tests/TestCase/Database/QueryTest.php

@@ -723,7 +723,7 @@ class QueryTest extends TestCase
             ->from('comments')
             ->where(
                 [
-                    'id' => '3something-crazy',
+                    'id' => '3',
                     'created <' => new \DateTime('2013-01-01 12:00')
                 ],
                 ['created' => 'datetime', 'id' => 'integer']
@@ -739,7 +739,7 @@ class QueryTest extends TestCase
             ->from('comments')
             ->where(
                 [
-                    'id' => '1something-crazy',
+                    'id' => '1',
                     'created <' => new \DateTime('2013-01-01 12:00')
                 ],
                 ['created' => 'datetime', 'id' => 'integer']