| @@ 43-59 (lines=17) @@ | ||
| 40 | $this->assertEquals($expected, $actual); |
|
| 41 | } |
|
| 42 | ||
| 43 | public function test_collection_gets_deep_nested_path_value() |
|
| 44 | { |
|
| 45 | $collection = [ |
|
| 46 | 'foo' => [ |
|
| 47 | 'bar' => [ |
|
| 48 | 'acme' => [ |
|
| 49 | 'name' => 'Acme Corp', |
|
| 50 | ] |
|
| 51 | ] |
|
| 52 | ], |
|
| 53 | ]; |
|
| 54 | $dotter = new ArrayDotCollection; |
|
| 55 | $expected = 'Acme Corp'; |
|
| 56 | $actual = $dotter->get($collection, 'foo.bar.acme.name'); |
|
| 57 | ||
| 58 | $this->assertEquals($expected, $actual); |
|
| 59 | } |
|
| 60 | ||
| 61 | public function test_collection_gets_nested_path_with_numeric_keys_value() |
|
| 62 | { |
|
| @@ 61-75 (lines=15) @@ | ||
| 58 | $this->assertEquals($expected, $actual); |
|
| 59 | } |
|
| 60 | ||
| 61 | public function test_collection_gets_nested_path_with_numeric_keys_value() |
|
| 62 | { |
|
| 63 | $collection = [ |
|
| 64 | 'foo' => [ |
|
| 65 | 'bar' => [ |
|
| 66 | ['name' => 'acme'], |
|
| 67 | ] |
|
| 68 | ], |
|
| 69 | ]; |
|
| 70 | $dotter = new ArrayDotCollection; |
|
| 71 | $expected = 'acme'; |
|
| 72 | $actual = $dotter->get($collection, 'foo.bar.name'); |
|
| 73 | ||
| 74 | $this->assertEquals($expected, $actual); |
|
| 75 | } |
|
| 76 | } |
|
| 77 | ||