‪TYPO3CMS  11.5
ExtensionPathSoftReferenceParserTest.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
21 {
23  {
24  return [
25  'Simple EXT: path has a match' => [
26  'EXT:foobar/Configuration/TypoScript/setup.typoscript',
27  [
28  'content' => 'EXT:foobar/Configuration/TypoScript/setup.typoscript',
29  'elements' => [
30  2 => [
31  'matchString' => 'EXT:foobar/Configuration/TypoScript/setup.typoscript',
32  ],
33  ],
34  ],
35  ],
36  'Multiple EXT: paths have matches' => [
37  '
38  @import \'EXT:foobar/Configuration/TypoScript/setup1.typoscript\'
39  foo = bar
40  @import "EXT:foobar/Configuration/TypoScript/setup2.typoscript"
41  # some comment
42  <INCLUDE_TYPOSCRIPT: source="FILE:EXT:foobar/Configuration/TypoScript/setup3.typoscript">
43  ',
44  [
45  'content' => '
46  @import \'EXT:foobar/Configuration/TypoScript/setup1.typoscript\'
47  foo = bar
48  @import "EXT:foobar/Configuration/TypoScript/setup2.typoscript"
49  # some comment
50  <INCLUDE_TYPOSCRIPT: source="FILE:EXT:foobar/Configuration/TypoScript/setup3.typoscript">
51  ',
52  'elements' => [
53  2 => [
54  'matchString' => 'EXT:foobar/Configuration/TypoScript/setup1.typoscript',
55  ],
56  5 => [
57  'matchString' => 'EXT:foobar/Configuration/TypoScript/setup2.typoscript',
58  ],
59  8 => [
60  'matchString' => 'EXT:foobar/Configuration/TypoScript/setup3.typoscript',
61  ],
62  ],
63  ],
64  ],
65  'No matches returns null' => [
66  '/foobar/Configuration/TypoScript/setup.typoscript',
67  null,
68  ],
69  ];
70  }
71 
76  public function ‪extensionPathSoftReferenceParserTest(string $content, ?array $expected): void
77  {
78  $subject = $this->‪getParserByKey('ext_fileref');
79  $result = $subject->parse('sys_template', 'include_static_file', 1, $content)->toNullableArray();
80  self::assertSame($expected, $result);
81  }
82 }
‪TYPO3\CMS\Core\Tests\Unit\DataHandling\SoftReference\ExtensionPathSoftReferenceParserTest\extensionPathSoftReferenceParserTest
‪extensionPathSoftReferenceParserTest(string $content, ?array $expected)
Definition: ExtensionPathSoftReferenceParserTest.php:76
‪TYPO3\CMS\Core\Tests\Unit\DataHandling\SoftReference\ExtensionPathSoftReferenceParserTest\extensionPathSoftReferenceParserDataProvider
‪extensionPathSoftReferenceParserDataProvider()
Definition: ExtensionPathSoftReferenceParserTest.php:22
‪TYPO3\CMS\Core\Tests\Unit\DataHandling\SoftReference\ExtensionPathSoftReferenceParserTest
Definition: ExtensionPathSoftReferenceParserTest.php:21
‪TYPO3\CMS\Core\Tests\Unit\DataHandling\SoftReference
Definition: AbstractSoftReferenceParserTest.php:18
‪TYPO3\CMS\Core\Tests\Unit\DataHandling\SoftReference\AbstractSoftReferenceParserTest
Definition: AbstractSoftReferenceParserTest.php:39
‪TYPO3\CMS\Core\Tests\Unit\DataHandling\SoftReference\AbstractSoftReferenceParserTest\getParserByKey
‪getParserByKey($softrefKey)
Definition: AbstractSoftReferenceParserTest.php:43