352d0fc3a21ee75204c7d91b2928fb597db2e139
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Tests / Functional / TypoScript / Parser / TypoScriptParserTest.php
1 <?php
2 namespace TYPO3\CMS\Core\Tests\Functional\TypoScript\Parser;
3
4 /*
5 * This file is part of the TYPO3 CMS project.
6 *
7 * It is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License, either version 2
9 * of the License, or any later version.
10 *
11 * For the full copyright and license information, please read the
12 * LICENSE.txt file that was distributed with this source code.
13 *
14 * The TYPO3 project - inspiring people to share!
15 */
16
17 /**
18 * Functional test for TypoScriptParser
19 */
20 class TypoScriptParserTest extends \TYPO3\Components\TestingFramework\Core\FunctionalTestCase
21 {
22 /**
23 * This tests triggers an error if the serialize(unserialize())) call
24 * within TypoScriptParser is removed. See forge issue #76919
25 *
26 * @test
27 */
28 public function hasFlakyReferences()
29 {
30 $typoScript = implode(LF, [
31 '',
32 '[GLOBAL]',
33 'RTE.default.proc.entryHTMLparser_db = 1',
34 'RTE.default.proc.entryHTMLparser_db {',
35 'tags {',
36 '}',
37 '}',
38
39 'RTE.default.FE < RTE.default',
40
41 'RTE.default.enableWordClean = 1',
42 'RTE.default.enableWordClean.HTMLparser < RTE.default.proc.entryHTMLparser_db',
43 '',
44 ]);
45
46 $typoScriptParser = new \TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser();
47 $typoScriptParser->parse($typoScript);
48 $res = ['TSconfig' => $typoScriptParser->setup];
49 // The issue only pops up if the TS was cached. This call simulates the unserialize(serialize())
50 // call done by the cache framework to trigger the issue.
51 $res = unserialize(serialize($res));
52 $res['TSconfig']['RTE.']['default.']['FE.']['proc.']['entryHTMLparser_db.']['tags.'] = 'This';
53 $this->assertEquals([], $res['TSconfig']['RTE.']['default.']['proc.']['entryHTMLparser_db.']['tags.']);
54 }
55 }