| @@ 895-914 (lines=20) @@ | ||
| 892 | * |
|
| 893 | * @return void |
|
| 894 | */ |
|
| 895 | public function flatten() |
|
| 896 | { |
|
| 897 | $array = [ |
|
| 898 | 'db' => [ |
|
| 899 | 'host' => 'localhost', |
|
| 900 | 'login' => [ |
|
| 901 | 'username' => 'scott', |
|
| 902 | 'password' => 'tiger' |
|
| 903 | ] |
|
| 904 | ] |
|
| 905 | ]; |
|
| 906 | ||
| 907 | $expected = [ |
|
| 908 | 'db.host' => 'localhost', |
|
| 909 | 'db.login.username' => 'scott', |
|
| 910 | 'db.login.password' => 'tiger', |
|
| 911 | ]; |
|
| 912 | ||
| 913 | $this->assertSame($expected, A::flatten($array)); |
|
| 914 | } |
|
| 915 | ||
| 916 | /** |
|
| 917 | * Verify behavior of flatten() with custom delimiter. |
|
| @@ 924-943 (lines=20) @@ | ||
| 921 | * |
|
| 922 | * @return void |
|
| 923 | */ |
|
| 924 | public function flattenWithCustomDelimiter() |
|
| 925 | { |
|
| 926 | $array = [ |
|
| 927 | 'db' => [ |
|
| 928 | 'host' => 'localhost', |
|
| 929 | 'login' => [ |
|
| 930 | 'username' => 'scott', |
|
| 931 | 'password' => 'tiger' |
|
| 932 | ] |
|
| 933 | ] |
|
| 934 | ]; |
|
| 935 | ||
| 936 | $expected = [ |
|
| 937 | 'db/host' => 'localhost', |
|
| 938 | 'db/login/username' => 'scott', |
|
| 939 | 'db/login/password' => 'tiger', |
|
| 940 | ]; |
|
| 941 | ||
| 942 | $this->assertSame($expected, A::flatten($array, '/')); |
|
| 943 | } |
|
| 944 | ||
| 945 | /** |
|
| 946 | * @test |
|