Added unit test for bug #11093: bigint (int8) values get converted to int4 by int...
authorXavier Perseguers <typo3@perseguers.ch>
Tue, 10 Nov 2009 23:25:36 +0000 (23:25 +0000)
committerXavier Perseguers <typo3@perseguers.ch>
Tue, 10 Nov 2009 23:25:36 +0000 (23:25 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Extensions/dbal/trunk@26402 735d13b6-9817-0410-8766-e36946ffe9aa

typo3/sysext/dbal/ChangeLog
typo3/sysext/dbal/tests/db_general_testcase.php

index 100bd9f..8b166e2 100644 (file)
@@ -1,3 +1,7 @@
+2009-11-11  Xavier Perseguers  <typo3@perseguers.ch>
+
+       * Added unit test for bug #11093: bigint (int8) values get converted to int4 by int-cast 
+
 2009-11-10  Xavier Perseguers  <typo3@perseguers.ch>
 
        * Removed comments stating that SQL parser is experimental
index 169aec4..c5fbe66 100644 (file)
@@ -153,5 +153,45 @@ class db_general_testcase extends BaseTestCase {
                $expected = 'INSERT INTO tx_test_dbal ( foo, foobar ) VALUES ( \'99.12\', \'-120\' )';
                $this->assertEquals($expected, $query);
        }
+
+       /**
+        * @test
+        * @see http://bugs.typo3.org/view.php?id=11093
+        */
+       public function positive64BitIntegerIsSupported() {
+               $this->createFakeExtension('
+                       CREATE TABLE tx_test_dbal (
+                               foo int default \'0\',
+                               foobar bigint default \'0\'
+                       );
+               ');
+               $data = array(
+                       'foo'    => 9223372036854775807,
+                       'foobar' => 9223372036854775807,
+               );
+               $query = $this->cleanSql($GLOBALS['TYPO3_DB']->INSERTquery('tx_test_dbal', $data));
+               $expected = 'INSERT INTO tx_test_dbal ( foo, foobar ) VALUES ( \'9223372036854775807\', \'9223372036854775807\' )';
+               $this->assertEquals($expected, $query);
+       }
+
+       /**
+        * @test
+        * @see http://bugs.typo3.org/view.php?id=11093
+        */
+       public function negative64BitIntegerIsSupported() {
+               $this->createFakeExtension('
+                       CREATE TABLE tx_test_dbal (
+                               foo int default \'0\',
+                               foobar bigint default \'0\'
+                       );
+               ');
+               $data = array(
+                       'foo'    => -9223372036854775808,
+                       'foobar' => -9223372036854775808,
+               );
+               $query = $this->cleanSql($GLOBALS['TYPO3_DB']->INSERTquery('tx_test_dbal', $data));
+               $expected = 'INSERT INTO tx_test_dbal ( foo, foobar ) VALUES ( \'-9223372036854775808\', \'-9223372036854775808\' )';
+               $this->assertEquals($expected, $query);
+       }
 }
 ?>
\ No newline at end of file