Added unit tests for bug #13430: Cannot parse INSERT when VALUES has no space before...
authorXavier Perseguers <typo3@perseguers.ch>
Sat, 6 Feb 2010 21:51:46 +0000 (21:51 +0000)
committerXavier Perseguers <typo3@perseguers.ch>
Sat, 6 Feb 2010 21:51:46 +0000 (21:51 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Extensions/dbal/trunk@29762 735d13b6-9817-0410-8766-e36946ffe9aa

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

index 8025621..7789038 100644 (file)
@@ -1,3 +1,7 @@
+2010-02-06  Xavier Perseguers  <typo3@perseguers.ch>
+
+       * Added unit tests for bug #13430: Cannot parse INSERT when VALUES has no space before left parenthesis
+
 2010-02-05  Xavier Perseguers  <typo3@perseguers.ch>
 
        * Fixed bug #13422: Invalid quoting of numeric column names
index fff79c9..e520488 100644 (file)
@@ -206,6 +206,34 @@ class sqlparser_general_testcase extends BaseTestCase {
                $this->assertEquals($expected, $whereClause);
        }
 
+       /**
+        * @test
+        * http://bugs.typo3.org/view.php?id=13430
+        */
+       public function canParseInsertWithoutSpaceAfterValues() {
+               $parseString = "INSERT INTO static_country_zones VALUES('483', '0', 'NL', 'NLD', '528', 'DR', 'Drenthe', '');";
+               $components = $this->fixture->_callRef('parseINSERT', $parseString);
+
+               $this->assertTrue(is_array($components), $components);
+               $insert = $this->cleanSql($this->fixture->compileINSERT($components));
+               $expected = "INSERT INTO static_country_zones VALUES ('483', '0', 'NL', 'NLD', '528', 'DR', 'Drenthe', '')";
+               $this->assertEquals($expected, $insert);
+       }
+
+       /**
+        * @test
+        * http://bugs.typo3.org/view.php?id=13430
+        */
+       public function canParseInsertWithSpaceAfterValues() {
+               $parseString = "INSERT INTO static_country_zones VALUES ('483', '0', 'NL', 'NLD', '528', 'DR', 'Drenthe', '');";
+               $components = $this->fixture->_callRef('parseINSERT', $parseString);
+
+               $this->assertTrue(is_array($components), $components);
+               $insert = $this->cleanSql($this->fixture->compileINSERT($components));
+               $expected = "INSERT INTO static_country_zones VALUES ('483', '0', 'NL', 'NLD', '528', 'DR', 'Drenthe', '')";
+               $this->assertEquals($expected, $insert);
+       }
+
        ///////////////////////////////////////
        // Tests concerning JOINs
        ///////////////////////////////////////