‪TYPO3CMS  9.5
ModuleLoaderTest.php
Go to the documentation of this file.
1 <?php
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 
18 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
19 
23 class ‪ModuleLoaderTest extends UnitTestCase
24 {
25  protected function ‪setUp()
26  {
27  ‪$GLOBALS['LANG'] = new \stdClass();
28  ‪$GLOBALS['LANG']->lang = 'it';
29  }
30 
35  {
36  return [
37  'extbase only with string' => [
38  'extbasemodule',
39  'EXT:myext/Resources/Private/Language/modules.xlf',
40  [
41  'shortdescription' => 'EXT:myext/Resources/Private/Language/modules.xlf:mlang_labels_tablabel',
42  'description' => 'EXT:myext/Resources/Private/Language/modules.xlf:mlang_labels_tabdescr',
43  'title' => 'EXT:myext/Resources/Private/Language/modules.xlf:mlang_tabs_tab',
44  ],
45  ],
46  'array with LLLs and proper names' => [
47  'singlereferences',
48  [
49  'shortdescription' => 'EXT:myext/Resources/Private/Language/modules.xlf:myshortdescription',
50  'description' => 'EXT:myext/Resources/Private/Language/modules.xlf:mydescription',
51  'title' => 'EXT:myext/Resources/Private/Language/modules.xlf:mytitle',
52  ],
53  [
54  'shortdescription' => 'EXT:myext/Resources/Private/Language/modules.xlf:myshortdescription',
55  'description' => 'EXT:myext/Resources/Private/Language/modules.xlf:mydescription',
56  'title' => 'EXT:myext/Resources/Private/Language/modules.xlf:mytitle',
57  ],
58  ],
59  'XLF reference inside [ll_ref] - classic' => [
60  'classicmodule',
61  [
62  'll_ref' => 'EXT:myext/Resources/Private/Language/modules.xlf',
63  ],
64  [
65  'shortdescription' => 'EXT:myext/Resources/Private/Language/modules.xlf:mlang_labels_tablabel',
66  'description' => 'EXT:myext/Resources/Private/Language/modules.xlf:mlang_labels_tabdescr',
67  'title' => 'EXT:myext/Resources/Private/Language/modules.xlf:mlang_tabs_tab',
68  ],
69  ],
70  'XLF reference inside [default][ll_ref] - classic with default' => [
71  'classicmodule',
72  [
73  'default' => [
74  'll_ref' => 'EXT:myext/Resources/Private/Language/modules.xlf',
75  ],
76  ],
77  [
78  'shortdescription' => 'EXT:myext/Resources/Private/Language/modules.xlf:mlang_labels_tablabel',
79  'description' => 'EXT:myext/Resources/Private/Language/modules.xlf:mlang_labels_tabdescr',
80  'title' => 'EXT:myext/Resources/Private/Language/modules.xlf:mlang_tabs_tab',
81  ],
82  ],
83  'XLF reference inside [it][ll_ref] - classic with italian' => [
84  'classicmodule',
85  [
86  'it' => [
87  'll_ref' => 'EXT:myext/Resources/Private/Language/modules.xlf',
88  ],
89  ],
90  [
91  'shortdescription' => 'EXT:myext/Resources/Private/Language/modules.xlf:mlang_labels_tablabel',
92  'description' => 'EXT:myext/Resources/Private/Language/modules.xlf:mlang_labels_tabdescr',
93  'title' => 'EXT:myext/Resources/Private/Language/modules.xlf:mlang_tabs_tab',
94  ],
95  ],
96  'classic inline labels' => [
97  'classic_inline_labels',
98  [
99  'default' => [
100  'labels' => [
101  'tablabel' => 'My short description!',
102  'tabdescr' => 'My description!',
103  ],
104  'tabs' => [
105  'tab' => 'My title',
106  ],
107  ],
108  ],
109  [
110  'shortdescription' => 'My short description!',
111  'description' => 'My description!',
112  'title' => 'My title',
113  ],
114  ],
115  'classic inline labels in italian completely' => [
116  'classic_italian_labels',
117  [
118  'default' => [
119  'labels' => [
120  'tablabel' => 'My short description!',
121  'tabdescr' => 'My description!',
122  ],
123  'tabs' => [
124  'tab' => 'My title',
125  ],
126  ],
127  'it' => [
128  'labels' => [
129  'tablabel' => 'Mama Mia short description!',
130  'tabdescr' => 'Mama Mia description!',
131  ],
132  'tabs' => [
133  'tab' => 'Mama Mia',
134  ],
135  ],
136  ],
137  [
138  'shortdescription' => 'Mama Mia short description!',
139  'description' => 'Mama Mia description!',
140  'title' => 'Mama Mia',
141  ],
142  ],
143  'classic inline labels in italian partially' => [
144  'classic_italian_labels',
145  [
146  'default' => [
147  'labels' => [
148  'tablabel' => 'My short description!',
149  'tabdescr' => 'My original description!',
150  ],
151  'tabs' => [
152  'tab' => 'My title',
153  ],
154  ],
155  'it' => [
156  'labels' => [
157  'tablabel' => 'Mama Mia short description!',
158  ],
159  'tabs' => [
160  'tab' => 'Mama Mia',
161  ],
162  ],
163  ],
164  [
165  'shortdescription' => 'Mama Mia short description!',
166  'description' => 'My original description!',
167  'title' => 'Mama Mia',
168  ],
169  ],
170  ];
171  }
172 
181  public function ‪validateLabelsString($moduleName, $labels, array $expectedResult)
182  {
183  $moduleLoader = new ‪ModuleLoader();
184  $moduleLoader->addLabelsForModule($moduleName, $labels);
185  $this->assertEquals($expectedResult, $moduleLoader->getLabelsForModule($moduleName));
186  }
187 }
‪TYPO3\CMS\Backend\Tests\Unit\Module\ModuleLoaderTest
Definition: ModuleLoaderTest.php:24
‪TYPO3\CMS\Backend\Tests\Unit\Module\ModuleLoaderTest\setUp
‪setUp()
Definition: ModuleLoaderTest.php:25
‪TYPO3\CMS\Backend\Tests\Unit\Module\ModuleLoaderTest\addModuleLabelsDataProvider
‪array addModuleLabelsDataProvider()
Definition: ModuleLoaderTest.php:34
‪TYPO3\CMS\Backend\Module\ModuleLoader
Definition: ModuleLoader.php:32
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:5
‪TYPO3\CMS\Backend\Tests\Unit\Module\ModuleLoaderTest\validateLabelsString
‪validateLabelsString($moduleName, $labels, array $expectedResult)
Definition: ModuleLoaderTest.php:181
‪TYPO3\CMS\Backend\Tests\Unit\Module
Definition: ModuleLoaderTest.php:2