From 2fafb2ac13aaf154c5a2be3f62f57febc242184b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20B=C3=BCrk?= <stefan@buerk.tech> Date: Thu, 11 Apr 2024 13:32:40 +0200 Subject: [PATCH] [TASK] Enable corrected test for default value parsing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Test covering the SQL file parser has been streamlined and enriched with #103602, adding a disabled test with a todo to enable it when the SuT is fixed. Turns out the parser already handles the case well, the patch just enables the test. Resolves: #103605 Related: #103602 Releases: main, 12.4 Change-Id: I4b39dce5265c2504a9dc5f11a70dfe94702d0451 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/83754 Tested-by: core-ci <typo3@b13.com> Tested-by: Stefan Bürk <stefan@buerk.tech> Reviewed-by: Stefan Bürk <stefan@buerk.tech> --- .../Parser/ColumnDefinitionAttributesTest.php | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/typo3/sysext/core/Tests/Unit/Database/Schema/Parser/ColumnDefinitionAttributesTest.php b/typo3/sysext/core/Tests/Unit/Database/Schema/Parser/ColumnDefinitionAttributesTest.php index 1207ef824873..be41cd0b114a 100644 --- a/typo3/sysext/core/Tests/Unit/Database/Schema/Parser/ColumnDefinitionAttributesTest.php +++ b/typo3/sysext/core/Tests/Unit/Database/Schema/Parser/ColumnDefinitionAttributesTest.php @@ -333,21 +333,21 @@ final class ColumnDefinitionAttributesTest extends UnitTestCase 'columnFormat' => 'dynamic', 'storage' => null, ], - // @todo Parsing default values with quoted quotes throws a "Error: Expected ... GOT: 'can" exception, but - // should work. Enable dataset along with the bugfix. - //"DEFAULT 'quoted single-quote \' can be parsed'" => [ - // 'columnAttribute' => "DEFAULT 'quoted single-quote (\') can be parsed'", - // 'allowNull' => true, - // 'hasDefaultValue' => true, - // 'defaultValue' => "quoted single-quote (') is parsed properly", - // 'autoIncrement' => false, - // 'createIndex' => false, - // 'createUniqueIndex' => false, - // 'isPrimaryKey' => false, - // 'comment' => null, - // 'columnFormat' => null, - // 'storage' => null, - //], + // MySQL and MariaDB way to quote ' for a value string is to use double single-quotes "''" instead of + // using some sort of escape sequences, which is covered by the following testcase. + "DEFAULT 'quoted single-quote '' can be parsed'" => [ + 'columnAttribute' => "DEFAULT 'quoted single-quote ('') can be parsed'", + 'allowNull' => true, + 'hasDefaultValue' => true, + 'defaultValue' => "quoted single-quote (') can be parsed", + 'autoIncrement' => false, + 'createIndex' => false, + 'createUniqueIndex' => false, + 'isPrimaryKey' => false, + 'comment' => null, + 'columnFormat' => null, + 'storage' => null, + ], "DEFAULT 'double-quote (\") can be parsed'" => [ 'columnAttribute' => "DEFAULT 'quoted single-quote (\") can be parsed'", 'allowNull' => true, -- GitLab