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