@@ 17-27 (lines=11) @@ | ||
14 | $this->assertEquals($expected, $actual); |
|
15 | } |
|
16 | ||
17 | public function test_collection_gets_shallow_path_value() |
|
18 | { |
|
19 | $collection = [ |
|
20 | 'foo' => 'bar', |
|
21 | ]; |
|
22 | $dotter = new ArrayDotCollection; |
|
23 | $expected = 'bar'; |
|
24 | $actual = $dotter->get($collection, 'foo'); |
|
25 | ||
26 | $this->assertEquals($expected, $actual); |
|
27 | } |
|
28 | ||
29 | public function test_collection_gets_nested_path_value() |
|
30 | { |
|
@@ 29-41 (lines=13) @@ | ||
26 | $this->assertEquals($expected, $actual); |
|
27 | } |
|
28 | ||
29 | public function test_collection_gets_nested_path_value() |
|
30 | { |
|
31 | $collection = [ |
|
32 | 'foo' => [ |
|
33 | 'bar' => 'acme' |
|
34 | ], |
|
35 | ]; |
|
36 | $dotter = new ArrayDotCollection; |
|
37 | $expected = 'acme'; |
|
38 | $actual = $dotter->get($collection, 'foo.bar'); |
|
39 | ||
40 | $this->assertEquals($expected, $actual); |
|
41 | } |
|
42 | ||
43 | public function test_collection_gets_deep_nested_path_value() |
|
44 | { |
@@ 7-19 (lines=13) @@ | ||
4 | ||
5 | class DotTest extends PHPUnit_Framework_TestCase |
|
6 | { |
|
7 | public function test_dot_resolves_array_collection_and_returns_expected_value() |
|
8 | { |
|
9 | $dot = new Dot; |
|
10 | $collection = [ |
|
11 | 'foo' => [ |
|
12 | 'bar' => 'acme', |
|
13 | ] |
|
14 | ]; |
|
15 | $expected = 'acme'; |
|
16 | $actual = $dot->get($collection, 'foo.bar'); |
|
17 | ||
18 | $this->assertEquals($expected, $actual); |
|
19 | } |
|
20 | ||
21 | /** |
|
22 | * @expectedException \InvalidArgumentException |