More tidying.
[yaffs-website] / vendor / symfony / translation / Tests / Util / ArrayConverterTest.php
1 <?php
2
3 /*
4  * This file is part of the Symfony package.
5  *
6  * (c) Fabien Potencier <fabien@symfony.com>
7  *
8  * For the full copyright and license information, please view the LICENSE
9  * file that was distributed with this source code.
10  */
11
12 namespace Symfony\Component\Translation\Tests\Util;
13
14 use PHPUnit\Framework\TestCase;
15 use Symfony\Component\Translation\Util\ArrayConverter;
16
17 class ArrayConverterTest extends TestCase
18 {
19     /**
20      * @dataProvider messagesData
21      */
22     public function testDump($input, $expectedOutput)
23     {
24         $this->assertEquals($expectedOutput, ArrayConverter::expandToTree($input));
25     }
26
27     public function messagesData()
28     {
29         return array(
30             array(
31                 // input
32                 array(
33                     'foo1' => 'bar',
34                     'foo.bar' => 'value',
35                 ),
36                 // expected output
37                 array(
38                     'foo1' => 'bar',
39                     'foo' => array('bar' => 'value'),
40                 ),
41             ),
42             array(
43                 // input
44                 array(
45                     'foo.bar' => 'value1',
46                     'foo.bar.test' => 'value2',
47                 ),
48                 // expected output
49                 array(
50                     'foo' => array(
51                         'bar' => 'value1',
52                         'bar.test' => 'value2',
53                     ),
54                 ),
55             ),
56             array(
57                 // input
58                 array(
59                     'foo.level2.level3.level4' => 'value1',
60                     'foo.level2' => 'value2',
61                     'foo.bar' => 'value3',
62                 ),
63                 // expected output
64                 array(
65                     'foo' => array(
66                         'level2' => 'value2',
67                         'level2.level3.level4' => 'value1',
68                         'bar' => 'value3',
69                     ),
70                 ),
71             ),
72         );
73     }
74 }