| @@ 37-51 (lines=15) @@ | ||
| 34 | $this->assertEquals('fighters', $result); |
|
| 35 | } |
|
| 36 | ||
| 37 | public function testWillFindUsingDotNotation() |
|
| 38 | { |
|
| 39 | $data = [ |
|
| 40 | 'i' => [ |
|
| 41 | "can't" => [ |
|
| 42 | 'get' => [ |
|
| 43 | 'no' => 'satisfaction', |
|
| 44 | ], |
|
| 45 | ], |
|
| 46 | ], |
|
| 47 | ]; |
|
| 48 | $key = "i.can't.get.no"; |
|
| 49 | $result = Arr::get($data, $key); |
|
| 50 | $this->assertEquals('satisfaction', $result); |
|
| 51 | } |
|
| 52 | } |
|
| 53 | ||
| @@ 29-44 (lines=16) @@ | ||
| 26 | ); |
|
| 27 | } |
|
| 28 | ||
| 29 | public function testWillReturnTrueIfFoundUsingDotNotation() |
|
| 30 | { |
|
| 31 | $data = [ |
|
| 32 | 'i' => [ |
|
| 33 | "can't" => [ |
|
| 34 | 'get' => [ |
|
| 35 | 'no' => 'satisfaction', |
|
| 36 | ], |
|
| 37 | ], |
|
| 38 | ], |
|
| 39 | ]; |
|
| 40 | $key = "i.can't.get.no"; |
|
| 41 | $this->assertTrue( |
|
| 42 | Arr::has($data, $key) |
|
| 43 | ); |
|
| 44 | } |
|
| 45 | } |
|
| 46 | ||