[TASK] Fix CGL violations against ClassDocComment
[Packages/TYPO3.CMS.git] / typo3 / sysext / extensionmanager / Tests / Unit / Utility / ConfigurationUtilityTest.php
1 <?php
2 namespace TYPO3\CMS\Extensionmanager\Tests\Unit\Utility;
3
4 /***************************************************************
5 * Copyright notice
6 *
7 * (c) 2012 Oliver Hader <oliver.hader@typo3.org>
8 * All rights reserved
9 *
10 * This script is part of the TYPO3 project. The TYPO3 project is
11 * free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * The GNU General Public License can be found at
17 * http://www.gnu.org/copyleft/gpl.html.
18 *
19 * This script is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * This copyright notice MUST APPEAR in all copies of the script!
25 ***************************************************************/
26
27 /**
28 * Configuration utility test
29 *
30 * @package Extension Manager
31 * @subpackage Tests
32 */
33 class ConfigurationUtilityTest extends \TYPO3\CMS\Extbase\Tests\Unit\BaseTestCase {
34
35 /**
36 * @param array $configuration
37 * @param array $expected
38 * @dataProvider convertValuedToNestedConfigurationDataProvider
39 * @test
40 */
41 public function convertValuedToNestedConfiguration(array $configuration, array $expected) {
42 /** @var $fixture \TYPO3\CMS\Extensionmanager\Utility\ConfigurationUtility */
43 $fixture = $this->objectManager->get('TYPO3\\CMS\\Extensionmanager\\Utility\\ConfigurationUtility');
44 $this->assertEquals($expected, $fixture->convertValuedToNestedConfiguration($configuration));
45 }
46
47 /**
48 * @return array
49 */
50 public function convertValuedToNestedConfigurationDataProvider() {
51 return array(
52 'plain array' => array(
53 array(
54 'first' => array(
55 'value' => 'value1'
56 ),
57 'second' => array(
58 'value' => 'value2'
59 )
60 ),
61 array(
62 'first' => 'value1',
63 'second' => 'value2'
64 )
65 ),
66 'nested value with 2 levels' => array(
67 array(
68 'first.firstSub' => array(
69 'value' => 'value1'
70 ),
71 'second.secondSub' => array(
72 'value' => 'value2'
73 )
74 ),
75 array(
76 'first.' => array(
77 'firstSub' => 'value1'
78 ),
79 'second.' => array(
80 'secondSub' => 'value2'
81 )
82 )
83 ),
84 'nested value with 3 levels' => array(
85 array(
86 'first.firstSub.firstSubSub' => array(
87 'value' => 'value1'
88 ),
89 'second.secondSub.secondSubSub' => array(
90 'value' => 'value2'
91 )
92 ),
93 array(
94 'first.' => array(
95 'firstSub.' => array(
96 'firstSubSub' => 'value1'
97 )
98 ),
99 'second.' => array(
100 'secondSub.' => array(
101 'secondSubSub' => 'value2'
102 )
103 )
104 )
105 ),
106 'mixed nested value with 2 levels' => array(
107 array(
108 'first' => array(
109 'value' => 'firstValue'
110 ),
111 'first.firstSub' => array(
112 'value' => 'value1'
113 ),
114 'second.secondSub' => array(
115 'value' => 'value2'
116 )
117 ),
118 array(
119 'first' => 'firstValue',
120 'first.' => array(
121 'firstSub' => 'value1'
122 ),
123 'second.' => array(
124 'secondSub' => 'value2'
125 )
126 )
127 )
128 );
129 }
130
131 }
132
133
134 ?>