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