2 namespace TYPO3\CMS\Form\Tests\Unit\Mvc\Configuration
;
5 * This file is part of the TYPO3 CMS project.
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.
11 * For the full copyright and license information, please read the
12 * LICENSE.txt file that was distributed with this source code.
14 * The TYPO3 project - inspiring people to share!
17 use TYPO3\CMS\Form\Mvc\Configuration\Exception\CycleInheritancesException
;
18 use TYPO3\CMS\Form\Mvc\Configuration\InheritancesResolverService
;
23 class InheritancesResolverServiceTest
extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
26 * @var InheritancesResolverService
30 protected function setUp()
32 $this->subject
= new InheritancesResolverService();
38 public function getMergedConfigurationSimpleInheritance()
73 $this->assertSame($expected, $this->subject
->reset()->setReferenceConfiguration($input)->getResolvedConfiguration($input));
79 public function getMergedConfigurationSimpleInheritanceOverrideValue()
90 'key' => 'value override',
101 'key' => 'value override',
106 $this->assertSame($expected, $this->subject
->reset()->setReferenceConfiguration($input)->getResolvedConfiguration($input));
112 public function getMergedConfigurationSimpleInheritanceRemoveValue()
130 '__inheritances' => [
131 10 => 'Form.klaus01',
171 $this->assertSame($expected, $this->subject
->reset()->setReferenceConfiguration($input)->getResolvedConfiguration($input));
177 public function getMergedConfigurationSimpleMixin()
185 '__inheritances' => [
186 10 => 'Form.mixin01',
191 '__inheritances' => [
192 10 => 'Form.mixin01',
215 $this->assertSame($expected, $this->subject
->reset()->setReferenceConfiguration($input)->getResolvedConfiguration($input));
221 public function getMergedConfigurationAdvancedMixin()
226 'key01' => 'value01',
227 'key02' => 'value02',
230 '__inheritances' => [
231 10 => 'Form.mixin01',
235 'key03' => 'value03',
239 '__inheritances' => [
240 10 => 'Form.mixin01',
242 'key01' => 'value01 override 01',
245 '__inheritances' => [
246 10 => 'Form.klaus01',
247 20 => 'Form.mixin03',
249 'key01' => 'value01 override 02',
251 'horst01' => 'gerda01'
254 '__inheritances' => [
255 10 => 'Form.mixin02',
261 '__inheritances' => [
262 10 => 'Form.klaus02',
271 'key01' => 'value01',
272 'key02' => 'value02',
275 'key01' => 'value01',
276 'key02' => 'value02',
279 'key03' => 'value03',
282 'key01' => 'value01 override 01',
283 'key02' => 'value02',
286 'key01' => 'value01 override 02',
288 'horst01' => 'gerda01'
291 'key01' => 'value01',
296 'key01' => 'value01 override 02',
298 'horst01' => 'gerda01'
301 'key01' => 'value01',
308 $this->assertSame($expected, $this->subject
->reset()->setReferenceConfiguration($input)->getResolvedConfiguration($input));
314 public function getResolvedConfigurationThrowsExceptionIfCycleDepenciesOnSameLevelIsFound()
321 '__inheritances' => [
322 10 => 'TYPO3.CMS.Form.anotherKey',
326 '__inheritances' => [
327 10 => 'TYPO3.CMS.Form.someKey',
335 $this->expectException(CycleInheritancesException
::class);
336 $this->expectExceptionCode(1474900797);
338 $this->subject
->reset()->setReferenceConfiguration($input)->getResolvedConfiguration($input);
344 public function getResolvedConfigurationThrowsExceptionIfCycleDepenciesOnSameLevelWithGapIsFound()
351 '__inheritances' => [
352 10 => 'TYPO3.CMS.Form.klaus2',
356 '__inheritances' => [
357 10 => 'TYPO3.CMS.Form.mixin1',
361 '__inheritances' => [
362 10 => 'TYPO3.CMS.Form.mixin2',
366 '__inheritances' => [
367 10 => 'TYPO3.CMS.Form.klaus2',
375 $this->expectException(CycleInheritancesException
::class);
376 $this->expectExceptionCode(1474900799);
378 $this->subject
->reset()->setReferenceConfiguration($input)->getResolvedConfiguration($input);
384 public function getResolvedConfigurationThrowsExceptionIfCycleDepenciesOnHigherLevelIsFound()
393 '__inheritances' => [
394 10 => 'TYPO3.CMS.Form.mixin01',
399 '__inheritances' => [
400 10 => 'TYPO3.CMS.Form.klaus1',
403 '__inheritances' => [
404 10 => 'TYPO3.CMS.Form.mixin01',
405 20 => 'TYPO3.CMS.Form.mixin02',
410 'liselotte01' => 'value',
413 '__inheritances' => [
414 10 => 'TYPO3.CMS.Form.klaus2',
416 'liselotte02' => 'value',
423 $this->expectException(CycleInheritancesException
::class);
424 $this->expectExceptionCode(1474900797);
426 $this->subject
->reset()->setReferenceConfiguration($input)->getResolvedConfiguration($input);