TYPO3 CMS  TYPO3_7-6
ConfigurationTest.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 
20 
25 {
29  protected $subject = null;
30 
31  /*
32  * @var TypoScriptRepository|\Prophecy\Prophecy\ObjectProphecy
33  */
35 
39  protected function setUp()
40  {
41  parent::setUp();
42  $this->typoScriptRepositoryProphecy = $this->prophesize(TypoScriptRepository::class);
43  $this->subject = $this->getAccessibleMock(Configuration::class, ['__none']);
44  $this->subject->_set('typoScriptRepository', $this->typoScriptRepositoryProphecy->reveal());
45  }
46 
50  protected function tearDown()
51  {
52  parent::tearDown();
53  unset($this->typoScriptRepositoryProphecy);
54  unset($this->subject);
55  }
56 
66  public function propertiesAreUpdatedFromTypoScript(array $typoScript, $globalCompatibilityMode, $globalThemeName, array $expected)
67  {
68  $this->typoScriptRepositoryProphecy
69  ->getModelConfigurationByScope('FORM', 'compatibilityMode')
70  ->willReturn($globalCompatibilityMode);
71 
72  $this->typoScriptRepositoryProphecy
73  ->getModelConfigurationByScope('FORM', 'themeName')
74  ->willReturn($globalThemeName);
75 
76  $this->subject->setTypoScript($typoScript);
77  $this->assertEquals($expected['prefix'], $this->subject->getPrefix());
78  $this->assertEquals($expected['compatibility'], $this->subject->getCompatibility());
79  $this->assertEquals($expected['contentElementRendering'], $this->subject->getContentElementRendering());
80  }
81 
86  {
87  return [
88  '#1' => [
89  [
90  'prefix' => '',
91  'themeName' => '',
92  'compatibilityMode' => false,
93  'disableContentElement' => false,
94  ],
95  false,
96  '',
97  [
98  'prefix' => 'form',
99  'themeName' => 'Default',
100  'compatibility' => false,
101  'contentElementRendering' => true,
102  ],
103  ],
104  '#2' => [
105  [
106  'prefix' => '',
107  'themeName' => '',
108  'compatibilityMode' => false,
109  'disableContentElement' => false,
110  ],
111  true,
112  '',
113  [
114  'prefix' => 'form',
115  'themeName' => 'Default',
116  'compatibility' => false,
117  'contentElementRendering' => true,
118  ],
119  ],
120  '#3' => [
121  [
122  'prefix' => 'somePrefix',
123  'themeName' => 'someTheme',
124  'compatibilityMode' => true,
125  'disableContentElement' => true,
126  ],
127  true,
128  '',
129  [
130  'prefix' => 'somePrefix',
131  'themeName' => 'someTheme',
132  'compatibility' => true,
133  'contentElementRendering' => false,
134  ],
135  ],
136  '#4' => [
137  [
138  'prefix' => 'somePrefix',
139  'themeName' => 'someTheme',
140  'compatibilityMode' => true,
141  'disableContentElement' => true,
142  ],
143  false,
144  '',
145  [
146  'prefix' => 'somePrefix',
147  'themeName' => 'someTheme',
148  'compatibility' => true,
149  'contentElementRendering' => false,
150  ],
151  ],
152  '#5' => [
153  [
154  'prefix' => 'somePrefix',
155  'themeName' => 'someTheme',
156  'compatibilityMode' => null,
157  'disableContentElement' => true,
158  ],
159  true,
160  '',
161  [
162  'prefix' => 'somePrefix',
163  'themeName' => 'someTheme',
164  'compatibility' => true,
165  'contentElementRendering' => false,
166  ],
167  ],
168  '#6' => [
169  [
170  'prefix' => 'somePrefix',
171  'themeName' => 'someTheme',
172  'compatibilityMode' => null,
173  'disableContentElement' => true,
174  ],
175  false,
176  '',
177  [
178  'prefix' => 'somePrefix',
179  'themeName' => 'someTheme',
180  'compatibility' => false,
181  'contentElementRendering' => false,
182  ],
183  ],
184  '#7' => [
185  [
186  'prefix' => '',
187  'themeName' => '',
188  'compatibilityMode' => false,
189  'disableContentElement' => false,
190  ],
191  false,
192  'globalTheme',
193  [
194  'prefix' => 'form',
195  'themeName' => 'globalTheme',
196  'compatibility' => false,
197  'contentElementRendering' => true,
198  ],
199  ],
200  ];
201  }
202 }
getAccessibleMock( $originalClassName, $methods=[], array $arguments=[], $mockClassName='', $callOriginalConstructor=true, $callOriginalClone=true, $callAutoload=true)
propertiesAreUpdatedFromTypoScript(array $typoScript, $globalCompatibilityMode, $globalThemeName, array $expected)