[TASK] Unify TypoScript-related helper methods 89/50589/13
authorBenni Mack <benni@typo3.org>
Thu, 10 Nov 2016 23:30:26 +0000 (00:30 +0100)
committerFrank Naegler <frank.naegler@typo3.org>
Wed, 29 Mar 2017 14:14:54 +0000 (16:14 +0200)
The method for OptionSplitting in TemplateService
is completely isolated from everything else, and creates
a very strong dependency to TSFE + TemplateService
in various places.

Additionally, the TypoScriptService of Extbase is used
in several places of the core and has nothing to do
with Extbase itself, thus, it can be moved to a central place
where these functions are called.

Moving this code to it's own service class in the core
helps to decouple TSFE, tmpl, Extbase and cObject more.

Resolves: #78650
Releases: master
Change-Id: I712c77c383171e93053caff0f89af8d1247f6d86
Reviewed-on: https://review.typo3.org/50589
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Frank Naegler <frank.naegler@typo3.org>
Tested-by: Frank Naegler <frank.naegler@typo3.org>
26 files changed:
composer.json
composer.lock
typo3/sysext/core/Classes/TypoScript/TemplateService.php
typo3/sysext/core/Classes/TypoScript/TypoScriptService.php [new file with mode: 0644]
typo3/sysext/core/Documentation/Changelog/master/Deprecation-78650-TemplateService-splitConfArray.rst [new file with mode: 0644]
typo3/sysext/core/Documentation/Changelog/master/Important-78650-TypoScriptServiceClassMovedFromExtbaseToCore.rst [new file with mode: 0644]
typo3/sysext/core/Tests/Unit/TypoScript/TemplateServiceTest.php
typo3/sysext/core/Tests/Unit/TypoScript/TypoScriptServiceTest.php [new file with mode: 0644]
typo3/sysext/css_styled_content/Classes/Controller/CssStyledContentController.php
typo3/sysext/extbase/Classes/Configuration/AbstractConfigurationManager.php
typo3/sysext/extbase/Classes/Service/TypoScriptService.php [deleted file]
typo3/sysext/extbase/Migrations/Code/ClassAliasMap.php [new file with mode: 0644]
typo3/sysext/extbase/Tests/Unit/Configuration/AbstractConfigurationManagerTest.php
typo3/sysext/extbase/Tests/Unit/Configuration/BackendConfigurationManagerTest.php
typo3/sysext/extbase/Tests/Unit/Configuration/FrontendConfigurationManagerTest.php
typo3/sysext/extbase/Tests/Unit/Service/TypoScriptServiceTest.php [deleted file]
typo3/sysext/extbase/composer.json
typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php
typo3/sysext/frontend/Classes/ContentObject/FluidTemplateContentObject.php
typo3/sysext/frontend/Classes/ContentObject/Menu/AbstractMenuContentObject.php
typo3/sysext/frontend/Classes/ContentObject/Menu/GraphicalMenuContentObject.php
typo3/sysext/frontend/Classes/ContentObject/Menu/TextMenuContentObject.php
typo3/sysext/frontend/Classes/Page/PageGenerator.php
typo3/sysext/frontend/Tests/Unit/ContentObject/FluidTemplateContentObjectTest.php
typo3/sysext/indexed_search/Classes/Controller/SearchController.php
typo3/sysext/recordlist/Classes/RecordList.php

index 78b8ceb..95faac5 100644 (file)
@@ -74,6 +74,7 @@
                "typo3/class-alias-loader": {
                        "always-add-alias-loader": true,
                        "class-alias-maps": [
+                               "typo3/sysext/extbase/Migrations/Code/ClassAliasMap.php",
                                "typo3/sysext/fluid/Migrations/Code/ClassAliasMap.php",
                                "typo3/sysext/rtehtmlarea/Migrations/Code/ClassAliasMap.php",
                                "typo3/sysext/version/Migrations/Code/ClassAliasMap.php"
index 52161d9..9772d83 100644 (file)
@@ -4,7 +4,7 @@
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
         "This file is @generated automatically"
     ],
-    "content-hash": "ab232a6d09f0439f2a225d779cc865fb",
+    "content-hash": "027d9b4728d85519493ad8f083a4a639",
     "packages": [
         {
             "name": "cogpowered/finediff",
index 0c955e1..c5be14b 100644 (file)
@@ -1309,67 +1309,15 @@ class TemplateService
      * @param int $splitCount The number of items for which to generated individual TypoScript arrays
      * @return array The individualized TypoScript array.
      * @see \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::IMGTEXT(), \TYPO3\CMS\Frontend\ContentObject\Menu\AbstractMenuContentObject::procesItemStates()
+     * @deprecated since TYPO3 v8, will be removed in TYPO3 v9, use TypoScriptService::explodeConfigurationForOptionSplit() instead
      */
     public function splitConfArray($conf, $splitCount)
     {
-        // Initialize variables:
-        $splitCount = (int)$splitCount;
-        $conf2 = [];
-        if ($splitCount && is_array($conf)) {
-            // Initialize output to carry at least the keys:
-            for ($aKey = 0; $aKey < $splitCount; $aKey++) {
-                $conf2[$aKey] = [];
-            }
-            // Recursive processing of array keys:
-            foreach ($conf as $cKey => $val) {
-                if (is_array($val)) {
-                    $tempConf = $this->splitConfArray($val, $splitCount);
-                    foreach ($tempConf as $aKey => $val2) {
-                        $conf2[$aKey][$cKey] = $val2;
-                    }
-                } else {
-                    // Splitting of all values on this level of the TypoScript object tree:
-                    if ($cKey === 'noTrimWrap' || (!strstr($val, '|*|') && !strstr($val, '||'))) {
-                        for ($aKey = 0; $aKey < $splitCount; $aKey++) {
-                            $conf2[$aKey][$cKey] = $val;
-                        }
-                    } else {
-                        $main = explode('|*|', $val);
-                        $lastC = 0;
-                        $middleC = 0;
-                        $firstC = 0;
-                        if ($main[0]) {
-                            $first = explode('||', $main[0]);
-                            $firstC = count($first);
-                        }
-                        $middle = [];
-                        if ($main[1]) {
-                            $middle = explode('||', $main[1]);
-                            $middleC = count($middle);
-                        }
-                        $last = [];
-                        $value = '';
-                        if ($main[2]) {
-                            $last = explode('||', $main[2]);
-                            $lastC = count($last);
-                            $value = $last[0];
-                        }
-                        for ($aKey = 0; $aKey < $splitCount; $aKey++) {
-                            if ($firstC && isset($first[$aKey])) {
-                                $value = $first[$aKey];
-                            } elseif ($middleC) {
-                                $value = $middle[($aKey - $firstC) % $middleC];
-                            }
-                            if ($lastC && $lastC >= $splitCount - $aKey) {
-                                $value = $last[$lastC - ($splitCount - $aKey)];
-                            }
-                            $conf2[$aKey][$cKey] = trim($value);
-                        }
-                    }
-                }
-            }
+        GeneralUtility::logDeprecatedFunction();
+        if (!is_array($conf)) {
+            return [];
         }
-        return $conf2;
+        return GeneralUtility::makeInstance(TypoScriptService::class)->explodeConfigurationForOptionSplit($conf, (int)$splitCount);
     }
 
     /**
diff --git a/typo3/sysext/core/Classes/TypoScript/TypoScriptService.php b/typo3/sysext/core/Classes/TypoScript/TypoScriptService.php
new file mode 100644 (file)
index 0000000..57cdbaf
--- /dev/null
@@ -0,0 +1,154 @@
+<?php
+declare(strict_types=1);
+namespace TYPO3\CMS\Core\TypoScript;
+
+/*
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+
+/**
+ * Utilities to manage and convert TypoScript
+ * Also contains the functionality in TypoScript called "optionSplit"
+ */
+class TypoScriptService
+{
+    /**
+     * Removes all trailing dots recursively from TS settings array
+     *
+     * Extbase converts the "classical" TypoScript (with trailing dot) to a format without trailing dot,
+     * to be more future-proof and not to have any conflicts with Fluid object accessor syntax.
+     *
+     * @param array $typoScriptArray The TypoScript array (e.g. array('foo' => 'TEXT', 'foo.' => array('bar' => 'baz')))
+     * @return array e.g. array('foo' => array('_typoScriptNodeValue' => 'TEXT', 'bar' => 'baz'))
+     */
+    public function convertTypoScriptArrayToPlainArray(array $typoScriptArray): array
+    {
+        foreach ($typoScriptArray as $key => $value) {
+            if (substr((string)$key, -1) === '.') {
+                $keyWithoutDot = substr((string)$key, 0, -1);
+                $typoScriptNodeValue = isset($typoScriptArray[$keyWithoutDot]) ? $typoScriptArray[$keyWithoutDot] : null;
+                if (is_array($value)) {
+                    $typoScriptArray[$keyWithoutDot] = $this->convertTypoScriptArrayToPlainArray($value);
+                    if ($typoScriptNodeValue !== null) {
+                        $typoScriptArray[$keyWithoutDot]['_typoScriptNodeValue'] = $typoScriptNodeValue;
+                    }
+                    unset($typoScriptArray[$key]);
+                } else {
+                    $typoScriptArray[$keyWithoutDot] = null;
+                }
+            }
+        }
+        return $typoScriptArray;
+    }
+
+    /**
+     * Returns an array with Typoscript the old way (with dot).
+     *
+     * Extbase converts the "classical" TypoScript (with trailing dot) to a format without trailing dot,
+     * to be more future-proof and not to have any conflicts with Fluid object accessor syntax.
+     * However, if you want to call legacy TypoScript objects, you somehow need the "old" syntax (because this is what TYPO3 is used to).
+     * With this method, you can convert the extbase TypoScript to classical TYPO3 TypoScript which is understood by the rest of TYPO3.
+     *
+     * @param array $plainArray An TypoScript Array with Extbase Syntax (without dot but with _typoScriptNodeValue)
+     * @return array array with TypoScript as usual (with dot)
+     * @api
+     */
+    public function convertPlainArrayToTypoScriptArray(array $plainArray): array
+    {
+        $typoScriptArray = [];
+        foreach ($plainArray as $key => $value) {
+            if (is_array($value)) {
+                if (isset($value['_typoScriptNodeValue'])) {
+                    $typoScriptArray[$key] = $value['_typoScriptNodeValue'];
+                    unset($value['_typoScriptNodeValue']);
+                }
+                $typoScriptArray[$key . '.'] = $this->convertPlainArrayToTypoScriptArray($value);
+            } else {
+                $typoScriptArray[$key] = $value === null ? '' : $value;
+            }
+        }
+        return $typoScriptArray;
+    }
+
+    /**
+     * Implementation of the "optionSplit" feature in TypoScript (used eg. for MENU objects)
+     * What it does is to split the incoming TypoScript array so that the values are exploded by certain
+     * strings ("||" and "|*|") and each part distributed into individual TypoScript arrays with a similar structure,
+     * but individualized values.
+     * The concept is known as "optionSplit" and is rather advanced to handle but quite powerful, in particular
+     * for creating menus in TYPO3.
+     *
+     * @param array $originalConfiguration A TypoScript array
+     * @param int $splitCount The number of items for which to generated individual TypoScript arrays
+     * @return array The individualized TypoScript array.
+     */
+    public function explodeConfigurationForOptionSplit(array $originalConfiguration, int $splitCount): array
+    {
+        $finalConfiguration = [];
+        if (!$splitCount) {
+            return $finalConfiguration;
+        }
+        // Initialize output to carry at least the keys
+        for ($aKey = 0; $aKey < $splitCount; $aKey++) {
+            $finalConfiguration[$aKey] = [];
+        }
+        // Recursive processing of array keys
+        foreach ($originalConfiguration as $cKey => $val) {
+            if (is_array($val)) {
+                $tempConf = $this->explodeConfigurationForOptionSplit($val, $splitCount);
+                foreach ($tempConf as $aKey => $val2) {
+                    $finalConfiguration[$aKey][$cKey] = $val2;
+                }
+            } else {
+                // Splitting of all values on this level of the TypoScript object tree:
+                if ($cKey === 'noTrimWrap' || (!strstr($val, '|*|') && !strstr($val, '||'))) {
+                    for ($aKey = 0; $aKey < $splitCount; $aKey++) {
+                        $finalConfiguration[$aKey][$cKey] = $val;
+                    }
+                } else {
+                    $main = explode('|*|', $val);
+                    $lastC = 0;
+                    $middleC = 0;
+                    $firstC = 0;
+                    if ($main[0]) {
+                        $first = explode('||', $main[0]);
+                        $firstC = count($first);
+                    }
+                    $middle = [];
+                    if ($main[1]) {
+                        $middle = explode('||', $main[1]);
+                        $middleC = count($middle);
+                    }
+                    $last = [];
+                    $value = '';
+                    if ($main[2]) {
+                        $last = explode('||', $main[2]);
+                        $lastC = count($last);
+                        $value = $last[0];
+                    }
+                    for ($aKey = 0; $aKey < $splitCount; $aKey++) {
+                        if ($firstC && isset($first[$aKey])) {
+                            $value = $first[$aKey];
+                        } elseif ($middleC) {
+                            $value = $middle[($aKey - $firstC) % $middleC];
+                        }
+                        if ($lastC && $lastC >= $splitCount - $aKey) {
+                            $value = $last[$lastC - ($splitCount - $aKey)];
+                        }
+                        $finalConfiguration[$aKey][$cKey] = trim($value);
+                    }
+                }
+            }
+        }
+        return $finalConfiguration;
+    }
+}
diff --git a/typo3/sysext/core/Documentation/Changelog/master/Deprecation-78650-TemplateService-splitConfArray.rst b/typo3/sysext/core/Documentation/Changelog/master/Deprecation-78650-TemplateService-splitConfArray.rst
new file mode 100644 (file)
index 0000000..38a57a0
--- /dev/null
@@ -0,0 +1,36 @@
+.. include:: ../../Includes.txt
+
+=====================================================
+Deprecation: #78650 - TemplateService->splitConfArray
+=====================================================
+
+See :issue:`78650`
+
+Description
+===========
+
+The method `TemplateService->splitConfArray` which used for building the "optionSplit" functionality
+has been marked as deprecated.
+
+The method is now moved to a new class called `TypoScriptService`, effectively removing the
+dependency on `$TSFE->tmpl` within a ContentObject.
+
+
+Impact
+======
+
+Calling `TemplateService->splitConfArray` will throw a deprecation warning.
+
+
+Affected Installations
+======================
+
+Any installation using an extension that calls this method.
+
+
+Migration
+=========
+
+Use the new method `TypoScriptService->explodeConfigurationForOptionSplit` instead.
+
+.. index:: PHP-API, TypoScript
diff --git a/typo3/sysext/core/Documentation/Changelog/master/Important-78650-TypoScriptServiceClassMovedFromExtbaseToCore.rst b/typo3/sysext/core/Documentation/Changelog/master/Important-78650-TypoScriptServiceClassMovedFromExtbaseToCore.rst
new file mode 100644 (file)
index 0000000..ee928b3
--- /dev/null
@@ -0,0 +1,18 @@
+.. include:: ../../Includes.txt
+
+======================================================================
+Important: #78650 - TypoScriptService class moved from Extbase to Core
+======================================================================
+
+See :issue:`78650`
+
+Description
+===========
+
+The PHP class `TypoScriptService` has been moved to the core extension, as it has no direct link
+to Extbase, and a lot of other system extensions are using the class.
+
+The old class name is still registered as a class alias, so extensions can call the class via
+the Extbase PHP namespace in TYPO3 v8 without any downsides.
+
+.. index:: PHP-API
index 291cc10..079ae7f 100644 (file)
@@ -223,123 +223,4 @@ class TemplateServiceTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
         $this->assertNull($this->templateService->getFileName('  '));
         $this->assertNull($this->templateService->getFileName('something/../else'));
     }
-
-    public function splitConfDataProvider()
-    {
-        return [
-            [
-                ['splitConfiguration' => 'a'],
-                3,
-                [
-                    0 => ['splitConfiguration' => 'a'],
-                    1 => ['splitConfiguration' => 'a'],
-                    2 => ['splitConfiguration' => 'a']
-                ]
-            ],
-            [
-                ['splitConfiguration' => 'a || b || c'],
-                5,
-                [
-                    0 => ['splitConfiguration' => 'a'],
-                    1 => ['splitConfiguration' => 'b'],
-                    2 => ['splitConfiguration' => 'c'],
-                    3 => ['splitConfiguration' => 'c'],
-                    4 => ['splitConfiguration' => 'c']
-                ]
-            ],
-            [
-                ['splitConfiguration' => 'a || b |*| c'],
-                5,
-                [
-                    0 => ['splitConfiguration' => 'a'],
-                    1 => ['splitConfiguration' => 'b'],
-                    2 => ['splitConfiguration' => 'c'],
-                    3 => ['splitConfiguration' => 'c'],
-                    4 => ['splitConfiguration' => 'c']
-                ]
-            ],
-            [
-                ['splitConfiguration' => 'a || b |*| c |*| d || e'],
-                7,
-                [
-                    0 => ['splitConfiguration' => 'a'],
-                    1 => ['splitConfiguration' => 'b'],
-                    2 => ['splitConfiguration' => 'c'],
-                    3 => ['splitConfiguration' => 'c'],
-                    4 => ['splitConfiguration' => 'c'],
-                    5 => ['splitConfiguration' => 'd'],
-                    6 => ['splitConfiguration' => 'e']
-                ]
-            ],
-            [
-                ['splitConfiguration' => 'a || b |*| c |*| d || e'],
-                4,
-                [
-                    0 => ['splitConfiguration' => 'a'],
-                    1 => ['splitConfiguration' => 'b'],
-                    2 => ['splitConfiguration' => 'd'],
-                    3 => ['splitConfiguration' => 'e']
-                ]
-            ],
-            [
-                ['splitConfiguration' => 'a || b |*| c |*| d || e'],
-                3,
-                [
-                    0 => ['splitConfiguration' => 'a'],
-                    1 => ['splitConfiguration' => 'd'],
-                    2 => ['splitConfiguration' => 'e']
-                ]
-            ],
-            [
-                ['splitConfiguration' => 'a || b |*||*| c || d'],
-                7,
-                [
-                    0 => ['splitConfiguration' => 'a'],
-                    1 => ['splitConfiguration' => 'b'],
-                    2 => ['splitConfiguration' => 'b'],
-                    3 => ['splitConfiguration' => 'b'],
-                    4 => ['splitConfiguration' => 'b'],
-                    5 => ['splitConfiguration' => 'c'],
-                    6 => ['splitConfiguration' => 'd']
-                ]
-            ],
-            [
-                ['splitConfiguration' => '|*||*| a || b'],
-                7,
-                [
-                    0 => ['splitConfiguration' => 'a'],
-                    1 => ['splitConfiguration' => 'a'],
-                    2 => ['splitConfiguration' => 'a'],
-                    3 => ['splitConfiguration' => 'a'],
-                    4 => ['splitConfiguration' => 'a'],
-                    5 => ['splitConfiguration' => 'a'],
-                    6 => ['splitConfiguration' => 'b']
-                ]
-            ],
-            [
-                ['splitConfiguration' => 'a |*| b || c |*|'],
-                7,
-                [
-                    0 => ['splitConfiguration' => 'a'],
-                    1 => ['splitConfiguration' => 'b'],
-                    2 => ['splitConfiguration' => 'c'],
-                    3 => ['splitConfiguration' => 'b'],
-                    4 => ['splitConfiguration' => 'c'],
-                    5 => ['splitConfiguration' => 'b'],
-                    6 => ['splitConfiguration' => 'c']
-                ]
-            ],
-        ];
-    }
-
-    /**
-     * @test
-     * @dataProvider splitConfDataProvider
-     * @see https://docs.typo3.org/typo3cms/TyposcriptReference/ObjectsAndProperties/Index.html#objects-optionsplit
-     */
-    public function splitConfArraytest($configuration, $splitCount, $expected)
-    {
-        $actual = $this->templateService->splitConfArray($configuration, $splitCount);
-        $this->assertSame($expected, $actual);
-    }
 }
diff --git a/typo3/sysext/core/Tests/Unit/TypoScript/TypoScriptServiceTest.php b/typo3/sysext/core/Tests/Unit/TypoScript/TypoScriptServiceTest.php
new file mode 100644 (file)
index 0000000..ac741c9
--- /dev/null
@@ -0,0 +1,417 @@
+<?php
+namespace TYPO3\CMS\Core\Tests\Unit\Service;
+
+/*
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+
+use TYPO3\CMS\Core\TypoScript\TypoScriptService;
+
+/**
+ * Test case
+ */
+class TypoScriptServiceTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
+{
+    /**
+     * data provider for convertTypoScriptArrayToPlainArray
+     * @return array
+     */
+    public function convertTypoScriptArrayToPlainArrayTestdata()
+    {
+        return [
+            'simple typoscript array' => [
+                'typoScriptSettings' => [
+                    '10.' => [
+                        'value' => 'Hello World!',
+                        'foo.' => [
+                            'bar' => 5
+                        ]
+                    ],
+                    '10' => 'TEXT'
+                ],
+                'expectedSettings' => [
+                    '10' => [
+                        'value' => 'Hello World!',
+                        'foo' => [
+                            'bar' => 5
+                        ],
+                        '_typoScriptNodeValue' => 'TEXT'
+                    ]
+                ]
+            ],
+            'typoscript with intermediate dots' => [
+                'typoScriptSettings' => [
+                    '10.' => [
+                        'value' => 'Hello World!',
+                        'foo.' => [
+                            'bar' => 5
+                        ]
+                    ],
+                    '10' => 'TEXT'
+                ],
+                'expectedSettings' => [
+                    '10' => [
+                        'value' => 'Hello World!',
+                        'foo' => [
+                            'bar' => 5
+                        ],
+                        '_typoScriptNodeValue' => 'TEXT'
+                    ]
+                ]
+            ],
+            'typoscript array with changed order' => [
+                'typoScriptSettings' => [
+                    '10' => 'TEXT',
+                    '10.' => [
+                        'value' => 'Hello World!',
+                        'foo.' => [
+                            'bar' => 5
+                        ]
+                    ]
+                ],
+                'expectedSettings' => [
+                    '10' => [
+                        'value' => 'Hello World!',
+                        'foo' => [
+                            'bar' => 5
+                        ],
+                        '_typoScriptNodeValue' => 'TEXT'
+                    ]
+                ]
+            ],
+            'nested typoscript array' => [
+                'typoScriptSettings' => [
+                    '10' => 'COA',
+                    '10.' => [
+                        '10' => 'TEXT',
+                        '10.' => [
+                            'value' => 'Hello World!',
+                            'foo.' => [
+                                'bar' => 5
+                            ]
+                        ],
+                        '20' => 'COA',
+                        '20.' => [
+                            '10' => 'TEXT',
+                            '10.' => [
+                                'value' => 'Test',
+                                'wrap' => '[|]'
+                            ],
+                            '20' => 'TEXT',
+                            '20.' => [
+                                'value' => 'Test',
+                                'wrap' => '[|]'
+                            ]
+                        ],
+                        '30' => 'custom'
+                    ]
+                ],
+                'expectedSettings' => [
+                    '10' => [
+                        '10' => [
+                            'value' => 'Hello World!',
+                            'foo' => [
+                                'bar' => 5
+                            ],
+                            '_typoScriptNodeValue' => 'TEXT'
+                        ],
+                        '20' => [
+                            '10' => [
+                                'value' => 'Test',
+                                'wrap' => '[|]',
+                                '_typoScriptNodeValue' => 'TEXT'
+                            ],
+                            '20' => [
+                                'value' => 'Test',
+                                'wrap' => '[|]',
+                                '_typoScriptNodeValue' => 'TEXT'
+                            ],
+                            '_typoScriptNodeValue' => 'COA'
+                        ],
+                        '30' => 'custom',
+                        '_typoScriptNodeValue' => 'COA'
+                    ]
+                ]
+            ],
+        ];
+    }
+
+    /**
+     * @test
+     * @dataProvider convertTypoScriptArrayToPlainArrayTestdata
+     * @param mixed $typoScriptSettings
+     * @param mixed $expectedSettings
+     */
+    public function convertTypoScriptArrayToPlainArrayRemovesTrailingDotsWithChangedOrderInTheTypoScriptArray($typoScriptSettings, $expectedSettings)
+    {
+        $typoScriptService = new TypoScriptService();
+        $processedSettings = $typoScriptService->convertTypoScriptArrayToPlainArray($typoScriptSettings);
+        $this->assertEquals($expectedSettings, $processedSettings);
+    }
+
+    /**
+     * Dataprovider for testcase "convertPlainArrayToTypoScriptArray"
+     *
+     * @return array
+     */
+    public function convertPlainArrayToTypoScriptArrayTestdata()
+    {
+        return [
+            'simple typoscript' => [
+                'extbaseTS' => [
+                    '10' => [
+                        'value' => 'Hallo',
+                        '_typoScriptNodeValue' => 'TEXT'
+                    ]
+                ],
+                'classic' => [
+                    '10' => 'TEXT',
+                    '10.' => [
+                        'value' => 'Hallo'
+                    ]
+                ]
+            ],
+            'typoscript with null value' => [
+                'extbaseTS' => [
+                    '10' => [
+                        'value' => 'Hallo',
+                        '_typoScriptNodeValue' => 'TEXT'
+                    ],
+                    '20' => null
+                ],
+                'classic' => [
+                    '10' => 'TEXT',
+                    '10.' => [
+                        'value' => 'Hallo'
+                    ],
+                    '20' => ''
+                ]
+            ],
+            'ts with dots in key' => [
+                'extbaseTS' => [
+                    '1.0' => [
+                        'value' => 'Hallo',
+                        '_typoScriptNodeValue' => 'TEXT'
+                    ]
+                ],
+                'classic' => [
+                    '1.0' => 'TEXT',
+                    '1.0.' => [
+                        'value' => 'Hallo'
+                    ]
+                ]
+            ],
+            'ts with backslashes in key' => [
+                'extbaseTS' => [
+                    '1\\0\\' => [
+                        'value' => 'Hallo',
+                        '_typoScriptNodeValue' => 'TEXT'
+                    ]
+                ],
+                'classic' => [
+                    '1\\0\\' => 'TEXT',
+                    '1\\0\\.' => [
+                        'value' => 'Hallo'
+                    ]
+                ]
+            ],
+            'bigger typoscript' => [
+                'extbaseTS' => [
+                    '10' => [
+                        '10' => [
+                            'value' => 'Hello World!',
+                            'foo' => [
+                                'bar' => 5
+                            ],
+                            '_typoScriptNodeValue' => 'TEXT'
+                        ],
+                        '20' => [
+                            '10' => [
+                                'value' => 'Test',
+                                'wrap' => '[|]',
+                                '_typoScriptNodeValue' => 'TEXT'
+                            ],
+                            '20' => [
+                                'value' => 'Test',
+                                'wrap' => '[|]',
+                                '_typoScriptNodeValue' => 'TEXT'
+                            ],
+                            '_typoScriptNodeValue' => 'COA'
+                        ],
+                        '_typoScriptNodeValue' => 'COA'
+                    ]
+                ],
+                'classic' => [
+                    '10' => 'COA',
+                    '10.' => [
+                        '10' => 'TEXT',
+                        '10.' => [
+                            'value' => 'Hello World!',
+                            'foo.' => [
+                                'bar' => 5
+                            ]
+                        ],
+                        '20' => 'COA',
+                        '20.' => [
+                            '10' => 'TEXT',
+                            '10.' => [
+                                'value' => 'Test',
+                                'wrap' => '[|]'
+                            ],
+                            '20' => 'TEXT',
+                            '20.' => [
+                                'value' => 'Test',
+                                'wrap' => '[|]'
+                            ]
+                        ]
+                    ]
+                ]
+            ],
+        ];
+    }
+
+    /**
+     * @test
+     * @dataProvider convertPlainArrayToTypoScriptArrayTestdata
+     * @param mixed $extbaseTS
+     * @param mixed $classic
+     */
+    public function convertPlainArrayToTypoScriptArray($extbaseTS, $classic)
+    {
+        $typoScriptService = new TypoScriptService();
+        $converted = $typoScriptService->convertPlainArrayToTypoScriptArray($extbaseTS);
+        $this->assertEquals($converted, $classic);
+    }
+
+    /**
+     * @return array
+     */
+    public function explodeConfigurationForOptionSplitProvider()
+    {
+        return [
+            [
+                ['splitConfiguration' => 'a'],
+                3,
+                [
+                    0 => ['splitConfiguration' => 'a'],
+                    1 => ['splitConfiguration' => 'a'],
+                    2 => ['splitConfiguration' => 'a']
+                ]
+            ],
+            [
+                ['splitConfiguration' => 'a || b || c'],
+                5,
+                [
+                    0 => ['splitConfiguration' => 'a'],
+                    1 => ['splitConfiguration' => 'b'],
+                    2 => ['splitConfiguration' => 'c'],
+                    3 => ['splitConfiguration' => 'c'],
+                    4 => ['splitConfiguration' => 'c']
+                ]
+            ],
+            [
+                ['splitConfiguration' => 'a || b |*| c'],
+                5,
+                [
+                    0 => ['splitConfiguration' => 'a'],
+                    1 => ['splitConfiguration' => 'b'],
+                    2 => ['splitConfiguration' => 'c'],
+                    3 => ['splitConfiguration' => 'c'],
+                    4 => ['splitConfiguration' => 'c']
+                ]
+            ],
+            [
+                ['splitConfiguration' => 'a || b |*| c |*| d || e'],
+                7,
+                [
+                    0 => ['splitConfiguration' => 'a'],
+                    1 => ['splitConfiguration' => 'b'],
+                    2 => ['splitConfiguration' => 'c'],
+                    3 => ['splitConfiguration' => 'c'],
+                    4 => ['splitConfiguration' => 'c'],
+                    5 => ['splitConfiguration' => 'd'],
+                    6 => ['splitConfiguration' => 'e']
+                ]
+            ],
+            [
+                ['splitConfiguration' => 'a || b |*| c |*| d || e'],
+                4,
+                [
+                    0 => ['splitConfiguration' => 'a'],
+                    1 => ['splitConfiguration' => 'b'],
+                    2 => ['splitConfiguration' => 'd'],
+                    3 => ['splitConfiguration' => 'e']
+                ]
+            ],
+            [
+                ['splitConfiguration' => 'a || b |*| c |*| d || e'],
+                3,
+                [
+                    0 => ['splitConfiguration' => 'a'],
+                    1 => ['splitConfiguration' => 'd'],
+                    2 => ['splitConfiguration' => 'e']
+                ]
+            ],
+            [
+                ['splitConfiguration' => 'a || b |*||*| c || d'],
+                7,
+                [
+                    0 => ['splitConfiguration' => 'a'],
+                    1 => ['splitConfiguration' => 'b'],
+                    2 => ['splitConfiguration' => 'b'],
+                    3 => ['splitConfiguration' => 'b'],
+                    4 => ['splitConfiguration' => 'b'],
+                    5 => ['splitConfiguration' => 'c'],
+                    6 => ['splitConfiguration' => 'd']
+                ]
+            ],
+            [
+                ['splitConfiguration' => '|*||*| a || b'],
+                7,
+                [
+                    0 => ['splitConfiguration' => 'a'],
+                    1 => ['splitConfiguration' => 'a'],
+                    2 => ['splitConfiguration' => 'a'],
+                    3 => ['splitConfiguration' => 'a'],
+                    4 => ['splitConfiguration' => 'a'],
+                    5 => ['splitConfiguration' => 'a'],
+                    6 => ['splitConfiguration' => 'b']
+                ]
+            ],
+            [
+                ['splitConfiguration' => 'a |*| b || c |*|'],
+                7,
+                [
+                    0 => ['splitConfiguration' => 'a'],
+                    1 => ['splitConfiguration' => 'b'],
+                    2 => ['splitConfiguration' => 'c'],
+                    3 => ['splitConfiguration' => 'b'],
+                    4 => ['splitConfiguration' => 'c'],
+                    5 => ['splitConfiguration' => 'b'],
+                    6 => ['splitConfiguration' => 'c']
+                ]
+            ],
+        ];
+    }
+
+    /**
+     * @test
+     * @dataProvider explodeConfigurationForOptionSplitProvider
+     * @see https://docs.typo3.org/typo3cms/TyposcriptReference/ObjectsAndProperties/Index.html#objects-optionsplit
+     */
+    public function explodeConfigurationForOptionSplitTest($configuration, $splitCount, $expected)
+    {
+        $serviceObject = new TypoScriptService();
+        $actual = $serviceObject->explodeConfigurationForOptionSplit($configuration, $splitCount);
+        $this->assertSame($expected, $actual);
+    }
+}
index 7f4fc5d..e0f4a2f 100644 (file)
@@ -14,6 +14,7 @@ namespace TYPO3\CMS\CssStyledContent\Controller;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\TypoScript\TypoScriptService;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Core\Utility\MathUtility;
 
@@ -269,6 +270,9 @@ class CssStyledContentController extends \TYPO3\CMS\Frontend\Plugin\AbstractPlug
         if (!$renderMethod || $renderMethod === 'table') {
             return $this->cObj->cObjGetSingle('IMGTEXT', $conf);
         }
+
+        $typoScriptService = GeneralUtility::makeInstance(TypoScriptService::class);
+
         $restoreRegisters = false;
         if (isset($conf['preRenderRegisters.'])) {
             $restoreRegisters = true;
@@ -416,7 +420,7 @@ class CssStyledContentController extends \TYPO3\CMS\Frontend\Plugin\AbstractPlug
         // Fetches pictures
         $splitArr = [];
         $splitArr['imgObjNum'] = $conf['imgObjNum'];
-        $splitArr = $this->frontendController->tmpl->splitConfArray($splitArr, $imgCount);
+        $splitArr = $typoScriptService->explodeConfigurationForOptionSplit($splitArr, (int)$imgCount);
         // Contains the width of every image row
         $imageRowsFinalWidths = [];
         // Array index of $imgsTag will be the same as in $imgs, but $imgsTag only contains the images that are actually shown
@@ -569,13 +573,13 @@ class CssStyledContentController extends \TYPO3\CMS\Frontend\Plugin\AbstractPlug
             if (isset($conf['addClassesCol.'])) {
                 $addClassesCol = $this->cObj->stdWrap($addClassesCol, $conf['addClassesCol.']);
             }
-            $addClassesColConf = $this->frontendController->tmpl->splitConfArray(['addClassesCol' => $addClassesCol], $colCount);
+            $addClassesColConf = $typoScriptService->explodeConfigurationForOptionSplit(['addClassesCol' => $addClassesCol], $colCount);
             // Apply optionSplit to the list of classes that we want to add to each image
             $addClassesImage = $conf['addClassesImage'];
             if (isset($conf['addClassesImage.'])) {
                 $addClassesImage = $this->cObj->stdWrap($addClassesImage, $conf['addClassesImage.']);
             }
-            $addClassesImageConf = $this->frontendController->tmpl->splitConfArray(['addClassesImage' => $addClassesImage], $imagesInColumns);
+            $addClassesImageConf = $typoScriptService->explodeConfigurationForOptionSplit(['addClassesImage' => $addClassesImage], $imagesInColumns);
             $rows = [];
             $currentImage = 0;
             // Iterate over the rows
@@ -688,7 +692,7 @@ class CssStyledContentController extends \TYPO3\CMS\Frontend\Plugin\AbstractPlug
             if (isset($conf['addClassesImage.'])) {
                 $addClassesImage = $this->cObj->stdWrap($addClassesImage, $conf['addClassesImage.']);
             }
-            $addClassesImageConf = $this->frontendController->tmpl->splitConfArray(['addClassesImage' => $addClassesImage], $colCount);
+            $addClassesImageConf = $typoScriptService->explodeConfigurationForOptionSplit(['addClassesImage' => $addClassesImage], $colCount);
             // Render the images
             $images = '';
             for ($c = 0; $c < $imageWrapCols; $c++) {
index 24095dc..b4c6887 100644 (file)
@@ -42,7 +42,7 @@ abstract class AbstractConfigurationManager implements \TYPO3\CMS\Core\Singleton
     protected $objectManager;
 
     /**
-     * @var \TYPO3\CMS\Extbase\Service\TypoScriptService
+     * @var \TYPO3\CMS\Core\TypoScript\TypoScriptService
      */
     protected $typoScriptService;
 
@@ -81,9 +81,9 @@ abstract class AbstractConfigurationManager implements \TYPO3\CMS\Core\Singleton
     }
 
     /**
-     * @param \TYPO3\CMS\Extbase\Service\TypoScriptService $typoScriptService
+     * @param \TYPO3\CMS\Core\TypoScript\TypoScriptService $typoScriptService
      */
-    public function injectTypoScriptService(\TYPO3\CMS\Extbase\Service\TypoScriptService $typoScriptService)
+    public function injectTypoScriptService(\TYPO3\CMS\Core\TypoScript\TypoScriptService $typoScriptService)
     {
         $this->typoScriptService = $typoScriptService;
     }
diff --git a/typo3/sysext/extbase/Classes/Service/TypoScriptService.php b/typo3/sysext/extbase/Classes/Service/TypoScriptService.php
deleted file mode 100644 (file)
index fd65911..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-<?php
-namespace TYPO3\CMS\Extbase\Service;
-
-/*
- * This file is part of the TYPO3 CMS project.
- *
- * It is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License, either version 2
- * of the License, or any later version.
- *
- * For the full copyright and license information, please read the
- * LICENSE.txt file that was distributed with this source code.
- *
- * The TYPO3 project - inspiring people to share!
- */
-
-/**
- * Utilities to manage and convert TypoScript
- */
-class TypoScriptService implements \TYPO3\CMS\Core\SingletonInterface
-{
-    /**
-     * Removes all trailing dots recursively from TS settings array
-     *
-     * Extbase converts the "classical" TypoScript (with trailing dot) to a format without trailing dot,
-     * to be more future-proof and not to have any conflicts with Fluid object accessor syntax.
-     *
-     * @param array $typoScriptArray The TypoScript array (e.g. array('foo' => 'TEXT', 'foo.' => array('bar' => 'baz')))
-     * @return array e.g. array('foo' => array('_typoScriptNodeValue' => 'TEXT', 'bar' => 'baz'))
-     * @api
-     */
-    public function convertTypoScriptArrayToPlainArray(array $typoScriptArray)
-    {
-        foreach ($typoScriptArray as $key => $value) {
-            if (substr($key, -1) === '.') {
-                $keyWithoutDot = substr($key, 0, -1);
-                $typoScriptNodeValue = isset($typoScriptArray[$keyWithoutDot]) ? $typoScriptArray[$keyWithoutDot] : null;
-                if (is_array($value)) {
-                    $typoScriptArray[$keyWithoutDot] = $this->convertTypoScriptArrayToPlainArray($value);
-                    if (!is_null($typoScriptNodeValue)) {
-                        $typoScriptArray[$keyWithoutDot]['_typoScriptNodeValue'] = $typoScriptNodeValue;
-                    }
-                    unset($typoScriptArray[$key]);
-                } else {
-                    $typoScriptArray[$keyWithoutDot] = null;
-                }
-            }
-        }
-        return $typoScriptArray;
-    }
-
-    /**
-     * Returns an array with Typoscript the old way (with dot).
-     *
-     * Extbase converts the "classical" TypoScript (with trailing dot) to a format without trailing dot,
-     * to be more future-proof and not to have any conflicts with Fluid object accessor syntax.
-     * However, if you want to call legacy TypoScript objects, you somehow need the "old" syntax (because this is what TYPO3 is used to).
-     * With this method, you can convert the extbase TypoScript to classical TYPO3 TypoScript which is understood by the rest of TYPO3.
-     *
-     * @param array $plainArray An TypoScript Array with Extbase Syntax (without dot but with _typoScriptNodeValue)
-     * @return array array with TypoScript as usual (with dot)
-     * @api
-     */
-    public function convertPlainArrayToTypoScriptArray(array $plainArray)
-    {
-        $typoScriptArray = [];
-        foreach ($plainArray as $key => $value) {
-            if (is_array($value)) {
-                if (isset($value['_typoScriptNodeValue'])) {
-                    $typoScriptArray[$key] = $value['_typoScriptNodeValue'];
-                    unset($value['_typoScriptNodeValue']);
-                }
-                $typoScriptArray[$key . '.'] = $this->convertPlainArrayToTypoScriptArray($value);
-            } else {
-                $typoScriptArray[$key] = is_null($value) ? '' : $value;
-            }
-        }
-        return $typoScriptArray;
-    }
-}
diff --git a/typo3/sysext/extbase/Migrations/Code/ClassAliasMap.php b/typo3/sysext/extbase/Migrations/Code/ClassAliasMap.php
new file mode 100644 (file)
index 0000000..ef8a64e
--- /dev/null
@@ -0,0 +1,4 @@
+<?php
+return [
+    'TYPO3\\CMS\\Extbase\\Service\\TypoScriptService' => \TYPO3\CMS\Core\TypoScript\TypoScriptService::class
+];
index cf37d2f..a04821c 100644 (file)
@@ -25,7 +25,7 @@ class AbstractConfigurationManagerTest extends \TYPO3\TestingFramework\Core\Unit
     protected $abstractConfigurationManager;
 
     /**
-     * @var \TYPO3\CMS\Extbase\Service\TypoScriptService|\PHPUnit_Framework_MockObject_MockObject|\TYPO3\TestingFramework\Core\AccessibleObjectInterface
+     * @var \TYPO3\CMS\Core\TypoScript\TypoScriptService|\PHPUnit_Framework_MockObject_MockObject|\TYPO3\TestingFramework\Core\AccessibleObjectInterface
      */
     protected $mockTypoScriptService;
 
@@ -113,7 +113,7 @@ class AbstractConfigurationManagerTest extends \TYPO3\TestingFramework\Core\Unit
     protected function setUp()
     {
         $this->abstractConfigurationManager = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Configuration\AbstractConfigurationManager::class, ['getContextSpecificFrameworkConfiguration', 'getTypoScriptSetup', 'getPluginConfiguration', 'getSwitchableControllerActions', 'getRecursiveStoragePids']);
-        $this->mockTypoScriptService = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Service\TypoScriptService::class);
+        $this->mockTypoScriptService = $this->getAccessibleMock(\TYPO3\CMS\Core\TypoScript\TypoScriptService::class);
         $this->abstractConfigurationManager->_set('typoScriptService', $this->mockTypoScriptService);
     }
 
index 2716d44..c327bfc 100644 (file)
@@ -26,7 +26,7 @@ class BackendConfigurationManagerTest extends \TYPO3\TestingFramework\Core\Unit\
     protected $backendConfigurationManager;
 
     /**
-     * @var \TYPO3\CMS\Extbase\Service\TypoScriptService|\PHPUnit_Framework_MockObject_MockObject|\TYPO3\TestingFramework\Core\AccessibleObjectInterface
+     * @var \TYPO3\CMS\Core\TypoScript\TypoScriptService|\PHPUnit_Framework_MockObject_MockObject|\TYPO3\TestingFramework\Core\AccessibleObjectInterface
      */
     protected $mockTypoScriptService;
 
@@ -36,7 +36,7 @@ class BackendConfigurationManagerTest extends \TYPO3\TestingFramework\Core\Unit\
     protected function setUp()
     {
         $this->backendConfigurationManager = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Configuration\BackendConfigurationManager::class, ['getTypoScriptSetup']);
-        $this->mockTypoScriptService = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Service\TypoScriptService::class);
+        $this->mockTypoScriptService = $this->getAccessibleMock(\TYPO3\CMS\Core\TypoScript\TypoScriptService::class);
         $this->backendConfigurationManager->_set('typoScriptService', $this->mockTypoScriptService);
     }
 
index d2ba77e..e866aa3 100644 (file)
@@ -31,7 +31,7 @@ class FrontendConfigurationManagerTest extends \TYPO3\TestingFramework\Core\Unit
     protected $frontendConfigurationManager;
 
     /**
-     * @var \TYPO3\CMS\Extbase\Service\TypoScriptService|\PHPUnit_Framework_MockObject_MockObject|\TYPO3\TestingFramework\Core\AccessibleObjectInterface
+     * @var \TYPO3\CMS\Core\TypoScript\TypoScriptService|\PHPUnit_Framework_MockObject_MockObject|\TYPO3\TestingFramework\Core\AccessibleObjectInterface
      */
     protected $mockTypoScriptService;
 
@@ -47,7 +47,7 @@ class FrontendConfigurationManagerTest extends \TYPO3\TestingFramework\Core\Unit
             ->getMock();
         $this->frontendConfigurationManager = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Configuration\FrontendConfigurationManager::class, ['dummy']);
         $this->frontendConfigurationManager->_set('contentObject', $this->mockContentObject);
-        $this->mockTypoScriptService = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Service\TypoScriptService::class);
+        $this->mockTypoScriptService = $this->getAccessibleMock(\TYPO3\CMS\Core\TypoScript\TypoScriptService::class);
         $this->frontendConfigurationManager->_set('typoScriptService', $this->mockTypoScriptService);
     }
 
diff --git a/typo3/sysext/extbase/Tests/Unit/Service/TypoScriptServiceTest.php b/typo3/sysext/extbase/Tests/Unit/Service/TypoScriptServiceTest.php
deleted file mode 100644 (file)
index a977060..0000000
+++ /dev/null
@@ -1,292 +0,0 @@
-<?php
-namespace TYPO3\CMS\Extbase\Tests\Unit\Service;
-
-/*
- * This file is part of the TYPO3 CMS project.
- *
- * It is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License, either version 2
- * of the License, or any later version.
- *
- * For the full copyright and license information, please read the
- * LICENSE.txt file that was distributed with this source code.
- *
- * The TYPO3 project - inspiring people to share!
- */
-
-/**
- * Test case
- */
-class TypoScriptServiceTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
-{
-    /**
-     * data provider for convertTypoScriptArrayToPlainArray
-     * @return array
-     */
-    public function convertTypoScriptArrayToPlainArrayTestdata()
-    {
-        return [
-            'simple typoscript array' => [
-                'typoScriptSettings' => [
-                    '10.' => [
-                        'value' => 'Hello World!',
-                        'foo.' => [
-                            'bar' => 5
-                        ]
-                    ],
-                    '10' => 'TEXT'
-                ],
-                'expectedSettings' => [
-                    '10' => [
-                        'value' => 'Hello World!',
-                        'foo' => [
-                            'bar' => 5
-                        ],
-                        '_typoScriptNodeValue' => 'TEXT'
-                    ]
-                ]
-            ],
-            'typoscript with intermediate dots' => [
-                'typoScriptSettings' => [
-                    '10.' => [
-                        'value' => 'Hello World!',
-                        'foo.' => [
-                            'bar' => 5
-                        ]
-                    ],
-                    '10' => 'TEXT'
-                ],
-                'expectedSettings' => [
-                    '10' => [
-                        'value' => 'Hello World!',
-                        'foo' => [
-                            'bar' => 5
-                        ],
-                        '_typoScriptNodeValue' => 'TEXT'
-                    ]
-                ]
-            ],
-            'typoscript array with changed order' => [
-                'typoScriptSettings' => [
-                    '10' => 'TEXT',
-                    '10.' => [
-                        'value' => 'Hello World!',
-                        'foo.' => [
-                            'bar' => 5
-                        ]
-                    ]
-                ],
-                'expectedSettings' => [
-                    '10' => [
-                        'value' => 'Hello World!',
-                        'foo' => [
-                            'bar' => 5
-                        ],
-                        '_typoScriptNodeValue' => 'TEXT'
-                    ]
-                ]
-            ],
-            'nested typoscript array' => [
-                'typoScriptSettings' => [
-                    '10' => 'COA',
-                    '10.' => [
-                        '10' => 'TEXT',
-                        '10.' => [
-                            'value' => 'Hello World!',
-                            'foo.' => [
-                                'bar' => 5
-                            ]
-                        ],
-                        '20' => 'COA',
-                        '20.' => [
-                            '10' => 'TEXT',
-                            '10.' => [
-                                'value' => 'Test',
-                                'wrap' => '[|]'
-                            ],
-                            '20' => 'TEXT',
-                            '20.' => [
-                                'value' => 'Test',
-                                'wrap' => '[|]'
-                            ]
-                        ],
-                        '30' => 'custom'
-                    ]
-                ],
-                'expectedSettings' => [
-                    '10' => [
-                        '10' => [
-                            'value' => 'Hello World!',
-                            'foo' => [
-                                'bar' => 5
-                            ],
-                            '_typoScriptNodeValue' => 'TEXT'
-                        ],
-                        '20' => [
-                            '10' => [
-                                'value' => 'Test',
-                                'wrap' => '[|]',
-                                '_typoScriptNodeValue' => 'TEXT'
-                            ],
-                            '20' => [
-                                'value' => 'Test',
-                                'wrap' => '[|]',
-                                '_typoScriptNodeValue' => 'TEXT'
-                            ],
-                            '_typoScriptNodeValue' => 'COA'
-                        ],
-                        '30' => 'custom',
-                        '_typoScriptNodeValue' => 'COA'
-                    ]
-                ]
-            ],
-        ];
-    }
-
-    /**
-     * @test
-     * @dataProvider convertTypoScriptArrayToPlainArrayTestdata
-     * @param mixed $typoScriptSettings
-     * @param mixed $expectedSettings
-     */
-    public function convertTypoScriptArrayToPlainArrayRemovesTrailingDotsWithChangedOrderInTheTypoScriptArray($typoScriptSettings, $expectedSettings)
-    {
-        $typoScriptService = new \TYPO3\CMS\Extbase\Service\TypoScriptService();
-        $processedSettings = $typoScriptService->convertTypoScriptArrayToPlainArray($typoScriptSettings);
-        $this->assertEquals($expectedSettings, $processedSettings);
-    }
-
-    /**
-     * Dataprovider for testcase "convertPlainArrayToTypoScriptArray"
-     *
-     * @return array
-     */
-    public function convertPlainArrayToTypoScriptArrayTestdata()
-    {
-        return [
-            'simple typoscript' => [
-                'extbaseTS' => [
-                    '10' => [
-                        'value' => 'Hallo',
-                        '_typoScriptNodeValue' => 'TEXT'
-                    ]
-                ],
-                'classic' => [
-                    '10' => 'TEXT',
-                    '10.' => [
-                        'value' => 'Hallo'
-                    ]
-                ]
-            ],
-            'typoscript with null value' => [
-                'extbaseTS' => [
-                    '10' => [
-                        'value' => 'Hallo',
-                        '_typoScriptNodeValue' => 'TEXT'
-                    ],
-                    '20' => null
-                ],
-                'classic' => [
-                    '10' => 'TEXT',
-                    '10.' => [
-                        'value' => 'Hallo'
-                    ],
-                    '20' => ''
-                ]
-            ],
-            'ts with dots in key' => [
-                'extbaseTS' => [
-                    '1.0' => [
-                        'value' => 'Hallo',
-                        '_typoScriptNodeValue' => 'TEXT'
-                    ]
-                ],
-                'classic' => [
-                    '1.0' => 'TEXT',
-                    '1.0.' => [
-                        'value' => 'Hallo'
-                    ]
-                ]
-            ],
-            'ts with backslashes in key' => [
-                'extbaseTS' => [
-                    '1\\0\\' => [
-                        'value' => 'Hallo',
-                        '_typoScriptNodeValue' => 'TEXT'
-                    ]
-                ],
-                'classic' => [
-                    '1\\0\\' => 'TEXT',
-                    '1\\0\\.' => [
-                        'value' => 'Hallo'
-                    ]
-                ]
-            ],
-            'bigger typoscript' => [
-                'extbaseTS' => [
-                    '10' => [
-                        '10' => [
-                            'value' => 'Hello World!',
-                            'foo' => [
-                                'bar' => 5
-                            ],
-                            '_typoScriptNodeValue' => 'TEXT'
-                        ],
-                        '20' => [
-                            '10' => [
-                                'value' => 'Test',
-                                'wrap' => '[|]',
-                                '_typoScriptNodeValue' => 'TEXT'
-                            ],
-                            '20' => [
-                                'value' => 'Test',
-                                'wrap' => '[|]',
-                                '_typoScriptNodeValue' => 'TEXT'
-                            ],
-                            '_typoScriptNodeValue' => 'COA'
-                        ],
-                        '_typoScriptNodeValue' => 'COA'
-                    ]
-                ],
-                'classic' => [
-                    '10' => 'COA',
-                    '10.' => [
-                        '10' => 'TEXT',
-                        '10.' => [
-                            'value' => 'Hello World!',
-                            'foo.' => [
-                                'bar' => 5
-                            ]
-                        ],
-                        '20' => 'COA',
-                        '20.' => [
-                            '10' => 'TEXT',
-                            '10.' => [
-                                'value' => 'Test',
-                                'wrap' => '[|]'
-                            ],
-                            '20' => 'TEXT',
-                            '20.' => [
-                                'value' => 'Test',
-                                'wrap' => '[|]'
-                            ]
-                        ]
-                    ]
-                ]
-            ],
-        ];
-    }
-
-    /**
-     * @test
-     * @dataProvider convertPlainArrayToTypoScriptArrayTestdata
-     * @param mixed $extbaseTS
-     * @param mixed $classic
-     */
-    public function convertPlainArrayToTypoScriptArray($extbaseTS, $classic)
-    {
-        $typoScriptService = new \TYPO3\CMS\Extbase\Service\TypoScriptService();
-        $converted = $typoScriptService->convertPlainArrayToTypoScriptArray($extbaseTS);
-        $this->assertEquals($converted, $classic);
-    }
-}
index d1f51a7..27ba789 100644 (file)
                                "partOfFactoryDefault": true,
                                "partOfMinimalUsableSystem": true
                        }
+               },
+               "typo3/class-alias-loader": {
+                       "always-add-alias-loader": true,
+                       "class-alias-maps": [
+                               "Migrations/Code/ClassAliasMap.php"
+                       ]
+               },
+               "branch-alias": {
+                       "dev-master": "8.x-dev"
                }
        },
        "autoload": {
index f27b50a..39ee6b0 100644 (file)
@@ -42,6 +42,7 @@ use TYPO3\CMS\Core\Service\DependencyOrderingService;
 use TYPO3\CMS\Core\Service\MarkerBasedTemplateService;
 use TYPO3\CMS\Core\TimeTracker\TimeTracker;
 use TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser;
+use TYPO3\CMS\Core\TypoScript\TypoScriptService;
 use TYPO3\CMS\Core\Utility\ArrayUtility;
 use TYPO3\CMS\Core\Utility\DebugUtility;
 use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
@@ -1162,7 +1163,8 @@ class ContentObjectRenderer
 
             // apply option split to configurations
             $tsfe = $this->getTypoScriptFrontendController();
-            $srcLayoutOptionSplitted = $tsfe->tmpl->splitConfArray($conf['layout.'][$layoutKey . '.'], count($activeSourceCollections));
+            $typoScriptService = GeneralUtility::makeInstance(TypoScriptService::class);
+            $srcLayoutOptionSplitted = $typoScriptService->explodeConfigurationForOptionSplit((array)$conf['layout.'][$layoutKey . '.'], count($activeSourceCollections));
 
             // render sources
             foreach ($activeSourceCollections as $key => $sourceConfiguration) {
@@ -4219,7 +4221,8 @@ class ContentObjectRenderer
                 } else {
                     // init for replacement
                     $splitCount = preg_match_all($search, $content, $matches);
-                    $replaceArray = $this->getTypoScriptFrontendController()->tmpl->splitConfArray([$replace], $splitCount);
+                    $typoScriptService = GeneralUtility::makeInstance(TypoScriptService::class);
+                    $replaceArray = $typoScriptService->explodeConfigurationForOptionSplit([$replace], $splitCount);
                     $replaceCount = 0;
 
                     $replaceCallback = function ($match) use ($replaceArray, $search, &$replaceCount) {
@@ -4237,7 +4240,8 @@ class ContentObjectRenderer
 
                     // init for replacement
                     $splitCount = preg_match_all($searchPreg, $content, $matches);
-                    $replaceArray = $this->getTypoScriptFrontendController()->tmpl->splitConfArray([$replace], $splitCount);
+                    $typoScriptService = GeneralUtility::makeInstance(TypoScriptService::class);
+                    $replaceArray = $typoScriptService->explodeConfigurationForOptionSplit([$replace], $splitCount);
                     $replaceCount = 0;
 
                     $replaceCallback = function () use ($replaceArray, $search, &$replaceCount) {
index 3368d0d..f8f3295 100644 (file)
@@ -14,12 +14,12 @@ namespace TYPO3\CMS\Frontend\ContentObject;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\TypoScript\TypoScriptService;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Core\Utility\StringUtility;
 use TYPO3\CMS\Extbase\Configuration\ConfigurationManager;
 use TYPO3\CMS\Extbase\Mvc\Web\RequestBuilder;
 use TYPO3\CMS\Extbase\Object\ObjectManager;
-use TYPO3\CMS\Extbase\Service\TypoScriptService;
 use TYPO3\CMS\Fluid\View\StandaloneView;
 
 /**
index 041198f..c516cde 100644 (file)
@@ -19,6 +19,7 @@ use TYPO3\CMS\Core\Database\ConnectionPool;
 use TYPO3\CMS\Core\Database\RelationHandler;
 use TYPO3\CMS\Core\TimeTracker\TimeTracker;
 use TYPO3\CMS\Core\TypoScript\TemplateService;
+use TYPO3\CMS\Core\TypoScript\TypoScriptService;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Core\Utility\MathUtility;
 use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
@@ -1325,11 +1326,12 @@ abstract class AbstractMenuContentObject
             // Setting a blank array if NO=1 and there are no properties.
             $this->mconf['NO.'] = [];
         }
-        $NOconf = $this->tmpl->splitConfArray($this->mconf['NO.'], $splitCount);
+        $typoScriptService = GeneralUtility::makeInstance(TypoScriptService::class);
+        $NOconf = $typoScriptService->explodeConfigurationForOptionSplit((array)$this->mconf['NO.'], $splitCount);
         // Prepare rollOver settings, overriding normal settings
         $ROconf = [];
         if ($this->mconf['RO']) {
-            $ROconf = $this->tmpl->splitConfArray($this->mconf['RO.'], $splitCount);
+            $ROconf = $typoScriptService->explodeConfigurationForOptionSplit((array)$this->mconf['RO.'], $splitCount);
         }
         // Prepare IFSUB settings, overriding normal settings
         // IFSUB is TRUE if there exist submenu items to the current item
@@ -1340,9 +1342,9 @@ abstract class AbstractMenuContentObject
                 if ($this->isItemState('IFSUB', $key)) {
                     // if this is the first IFSUB element, we must generate IFSUB.
                     if ($IFSUBconf === null) {
-                        $IFSUBconf = $this->tmpl->splitConfArray($this->mconf['IFSUB.'], $splitCount);
+                        $IFSUBconf = $typoScriptService->explodeConfigurationForOptionSplit((array)$this->mconf['IFSUB.'], $splitCount);
                         if (!empty($this->mconf['IFSUBRO'])) {
-                            $IFSUBROconf = $this->tmpl->splitConfArray($this->mconf['IFSUBRO.'], $splitCount);
+                            $IFSUBROconf = $typoScriptService->explodeConfigurationForOptionSplit((array)$this->mconf['IFSUBRO.'], $splitCount);
                         }
                     }
                     // Substitute normal with ifsub
@@ -1366,10 +1368,10 @@ abstract class AbstractMenuContentObject
                 if ($this->isItemState('ACT', $key)) {
                     // If this is the first 'active', we must generate ACT.
                     if ($ACTconf === null) {
-                        $ACTconf = $this->tmpl->splitConfArray($this->mconf['ACT.'], $splitCount);
+                        $ACTconf = $typoScriptService->explodeConfigurationForOptionSplit((array)$this->mconf['ACT.'], $splitCount);
                         // Prepare active rollOver settings, overriding normal active settings
                         if (!empty($this->mconf['ACTRO'])) {
-                            $ACTROconf = $this->tmpl->splitConfArray($this->mconf['ACTRO.'], $splitCount);
+                            $ACTROconf = $typoScriptService->explodeConfigurationForOptionSplit((array)$this->mconf['ACTRO.'], $splitCount);
                         }
                     }
                     // Substitute normal with active
@@ -1394,10 +1396,10 @@ abstract class AbstractMenuContentObject
                 if ($this->isItemState('ACTIFSUB', $key)) {
                     // If this is the first 'active', we must generate ACTIFSUB.
                     if ($ACTIFSUBconf === null) {
-                        $ACTIFSUBconf = $this->tmpl->splitConfArray($this->mconf['ACTIFSUB.'], $splitCount);
+                        $ACTIFSUBconf = $typoScriptService->explodeConfigurationForOptionSplit((array)$this->mconf['ACTIFSUB.'], $splitCount);
                         // Prepare active rollOver settings, overriding normal active settings
                         if (!empty($this->mconf['ACTIFSUBRO'])) {
-                            $ACTIFSUBROconf = $this->tmpl->splitConfArray($this->mconf['ACTIFSUBRO.'], $splitCount);
+                            $ACTIFSUBROconf = $typoScriptService->explodeConfigurationForOptionSplit((array)$this->mconf['ACTIFSUBRO.'], $splitCount);
                         }
                     }
                     // Substitute normal with active
@@ -1423,9 +1425,9 @@ abstract class AbstractMenuContentObject
                     // from the other implementations as current would only exist one time and that's it
                     // (unless you use special-features of HMENU)
                     if ($CURconf === null) {
-                        $CURconf = $this->tmpl->splitConfArray($this->mconf['CUR.'], $splitCount);
+                        $CURconf = $typoScriptService->explodeConfigurationForOptionSplit((array)$this->mconf['CUR.'], $splitCount);
                         if (!empty($this->mconf['CURRO'])) {
-                            $CURROconf = $this->tmpl->splitConfArray($this->mconf['CURRO.'], $splitCount);
+                            $CURROconf = $typoScriptService->explodeConfigurationForOptionSplit((array)$this->mconf['CURRO.'], $splitCount);
                         }
                     }
                     // Substitute normal with current
@@ -1449,10 +1451,10 @@ abstract class AbstractMenuContentObject
                 if ($this->isItemState('CURIFSUB', $key)) {
                     // If this is the first 'current', we must generate CURIFSUB.
                     if ($CURIFSUBconf === null) {
-                        $CURIFSUBconf = $this->tmpl->splitConfArray($this->mconf['CURIFSUB.'], $splitCount);
+                        $CURIFSUBconf = $typoScriptService->explodeConfigurationForOptionSplit((array)$this->mconf['CURIFSUB.'], $splitCount);
                         // Prepare current rollOver settings, overriding normal current settings
                         if (!empty($this->mconf['CURIFSUBRO'])) {
-                            $CURIFSUBROconf = $this->tmpl->splitConfArray($this->mconf['CURIFSUBRO.'], $splitCount);
+                            $CURIFSUBROconf = $typoScriptService->explodeConfigurationForOptionSplit((array)$this->mconf['CURIFSUBRO.'], $splitCount);
                         }
                     }
                     // Substitute normal with active
@@ -1476,10 +1478,10 @@ abstract class AbstractMenuContentObject
                 if ($this->isItemState('USR', $key)) {
                     // if this is the first active, we must generate USR.
                     if ($USRconf === null) {
-                        $USRconf = $this->tmpl->splitConfArray($this->mconf['USR.'], $splitCount);
+                        $USRconf = $typoScriptService->explodeConfigurationForOptionSplit((array)$this->mconf['USR.'], $splitCount);
                         // Prepare active rollOver settings, overriding normal active settings
                         if (!empty($this->mconf['USRRO'])) {
-                            $USRROconf = $this->tmpl->splitConfArray($this->mconf['USRRO.'], $splitCount);
+                            $USRROconf = $typoScriptService->explodeConfigurationForOptionSplit((array)$this->mconf['USRRO.'], $splitCount);
                         }
                     }
                     // Substitute normal with active
@@ -1502,7 +1504,7 @@ abstract class AbstractMenuContentObject
                 if ($this->isItemState('SPC', $key)) {
                     // If this is the first spacer, we must generate SPC.
                     if ($SPCconf === null) {
-                        $SPCconf = $this->tmpl->splitConfArray($this->mconf['SPC.'], $splitCount);
+                        $SPCconf = $typoScriptService->explodeConfigurationForOptionSplit((array)$this->mconf['SPC.'], $splitCount);
                     }
                     // Substitute normal with spacer
                     if (isset($SPCconf[$key])) {
@@ -1520,10 +1522,10 @@ abstract class AbstractMenuContentObject
                 if ($this->isItemState('USERDEF1', $key)) {
                     // If this is the first active, we must generate USERDEF1.
                     if ($USERDEF1conf === null) {
-                        $USERDEF1conf = $this->tmpl->splitConfArray($this->mconf['USERDEF1.'], $splitCount);
+                        $USERDEF1conf = $typoScriptService->explodeConfigurationForOptionSplit((array)$this->mconf['USERDEF1.'], $splitCount);
                         // Prepare active rollOver settings, overriding normal active settings
                         if (!empty($this->mconf['USERDEF1RO'])) {
-                            $USERDEF1ROconf = $this->tmpl->splitConfArray($this->mconf['USERDEF1RO.'], $splitCount);
+                            $USERDEF1ROconf = $typoScriptService->explodeConfigurationForOptionSplit((array)$this->mconf['USERDEF1RO.'], $splitCount);
                         }
                     }
                     // Substitute normal with active
@@ -1547,10 +1549,10 @@ abstract class AbstractMenuContentObject
                 if ($this->isItemState('USERDEF2', $key)) {
                     // If this is the first active, we must generate USERDEF2.
                     if ($USERDEF2conf === null) {
-                        $USERDEF2conf = $this->tmpl->splitConfArray($this->mconf['USERDEF2.'], $splitCount);
+                        $USERDEF2conf = $typoScriptService->explodeConfigurationForOptionSplit((array)$this->mconf['USERDEF2.'], $splitCount);
                         // Prepare active rollOver settings, overriding normal active settings
                         if (!empty($this->mconf['USERDEF2RO'])) {
-                            $USERDEF2ROconf = $this->tmpl->splitConfArray($this->mconf['USERDEF2RO.'], $splitCount);
+                            $USERDEF2ROconf = $typoScriptService->explodeConfigurationForOptionSplit((array)$this->mconf['USERDEF2RO.'], $splitCount);
                         }
                     }
                     // Substitute normal with active
index 75cb0d2..b8c7807 100644 (file)
@@ -14,6 +14,7 @@ namespace TYPO3\CMS\Frontend\ContentObject\Menu;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\TypoScript\TypoScriptService;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
 use TYPO3\CMS\Frontend\Imaging\GifBuilder;
@@ -370,7 +371,8 @@ class GraphicalMenuContentObject extends AbstractMenuContentObject
         $this->WMresult = '';
         $this->INPfixMD5 = substr(md5(microtime() . $this->GMENU_fixKey), 0, 4);
         $this->WMmenuItems = count($this->result['NO']);
-        $this->WMsubmenuObjSuffixes = $this->tmpl->splitConfArray(['sOSuffix' => $this->mconf['submenuObjSuffixes']], $this->WMmenuItems);
+        $typoScriptService = GeneralUtility::makeInstance(TypoScriptService::class);
+        $this->WMsubmenuObjSuffixes = $typoScriptService->explodeConfigurationForOptionSplit(['sOSuffix' => $this->mconf['submenuObjSuffixes']], $this->WMmenuItems);
         $this->extProc_init();
         $tsfe = $this->getTypoScriptFrontendController();
         if (!isset($tsfe->additionalJavaScript['JSImgCode'])) {
index 0d4ea4e..5af87d6 100644 (file)
@@ -13,6 +13,8 @@ namespace TYPO3\CMS\Frontend\ContentObject\Menu;
  *
  * The TYPO3 project - inspiring people to share!
  */
+use TYPO3\CMS\Core\TypoScript\TypoScriptService;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
 
 /**
  * Extension class creating text based menus
@@ -57,7 +59,8 @@ class TextMenuContentObject extends AbstractMenuContentObject
         $this->WMresult = '';
         $this->INPfixMD5 = substr(md5(microtime() . 'tmenu'), 0, 4);
         $this->WMmenuItems = count($this->result);
-        $this->WMsubmenuObjSuffixes = $this->tmpl->splitConfArray(['sOSuffix' => $this->mconf['submenuObjSuffixes']], $this->WMmenuItems);
+        $typoScriptService = GeneralUtility::makeInstance(TypoScriptService::class);
+        $this->WMsubmenuObjSuffixes = $typoScriptService->explodeConfigurationForOptionSplit(['sOSuffix' => $this->mconf['submenuObjSuffixes']], $this->WMmenuItems);
         $this->extProc_init();
         foreach ($this->result as $key => $val) {
             $GLOBALS['TSFE']->register['count_HMENU_MENUOBJ']++;
index f860b86..51d530b 100644 (file)
@@ -17,10 +17,10 @@ namespace TYPO3\CMS\Frontend\Page;
 use TYPO3\CMS\Core\Page\PageRenderer;
 use TYPO3\CMS\Core\TimeTracker\TimeTracker;
 use TYPO3\CMS\Core\Type\File\ImageInfo;
+use TYPO3\CMS\Core\TypoScript\TypoScriptService;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Core\Utility\MathUtility;
 use TYPO3\CMS\Core\Utility\PathUtility;
-use TYPO3\CMS\Extbase\Service\TypoScriptService;
 use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
 use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;
 
index b85ef4c..5f9369f 100644 (file)
@@ -15,9 +15,9 @@ namespace TYPO3\CMS\Frontend\Tests\Unit\ContentObject;
  */
 
 use TYPO3\CMS\Core\Page\PageRenderer;
+use TYPO3\CMS\Core\TypoScript\TypoScriptService;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Extbase\Mvc\Request;
-use TYPO3\CMS\Extbase\Service\TypoScriptService;
 use TYPO3\CMS\Fluid\View\StandaloneView;
 use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
 use TYPO3\CMS\Frontend\ContentObject\FluidTemplateContentObject;
@@ -632,13 +632,13 @@ class FluidTemplateContentObjectTest extends \TYPO3\TestingFramework\Core\Unit\U
         ];
 
         /** @var TypoScriptService|\PHPUnit_Framework_MockObject_MockObject $typoScriptServiceMock */
-        $typoScriptServiceMock = $this->getMockBuilder(\TYPO3\CMS\Extbase\Service\TypoScriptService::class)->getMock();
+        $typoScriptServiceMock = $this->getMockBuilder(TypoScriptService::class)->getMock();
         $typoScriptServiceMock
             ->expects($this->once())
             ->method('convertTypoScriptArrayToPlainArray')
             ->with($configuration['settings.'])
             ->will($this->returnValue($expectedSettingsToBeSet));
-        GeneralUtility::setSingletonInstance(\TYPO3\CMS\Extbase\Service\TypoScriptService::class, $typoScriptServiceMock);
+        GeneralUtility::addInstance(TypoScriptService::class, $typoScriptServiceMock);
 
         $this->standaloneView
             ->expects($this->at(1))
index 8e92952..c605442 100644 (file)
@@ -146,7 +146,7 @@ class SearchController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControlle
     protected $enableMetaphoneSearch = false;
 
     /**
-     * @var \TYPO3\CMS\Extbase\Service\TypoScriptService
+     * @var \TYPO3\CMS\Core\TypoScript\TypoScriptService
      */
     protected $typoScriptService;
 
@@ -156,9 +156,9 @@ class SearchController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControlle
     protected $charsetConverter;
 
     /**
-     * @param \TYPO3\CMS\Extbase\Service\TypoScriptService $typoScriptService
+     * @param \TYPO3\CMS\Core\TypoScript\TypoScriptService $typoScriptService
      */
-    public function injectTypoScriptService(\TYPO3\CMS\Extbase\Service\TypoScriptService $typoScriptService)
+    public function injectTypoScriptService(\TYPO3\CMS\Core\TypoScript\TypoScriptService $typoScriptService)
     {
         $this->typoScriptService = $typoScriptService;
     }
index b903d69..ccc7f70 100644 (file)
@@ -30,9 +30,9 @@ use TYPO3\CMS\Core\Messaging\FlashMessage;
 use TYPO3\CMS\Core\Messaging\FlashMessageService;
 use TYPO3\CMS\Core\Page\PageRenderer;
 use TYPO3\CMS\Core\Type\Bitmask\Permission;
+use TYPO3\CMS\Core\TypoScript\TypoScriptService;
 use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
-use TYPO3\CMS\Extbase\Service\TypoScriptService;
 use TYPO3\CMS\Lang\LanguageService;
 
 /**