| Conditions | 3 |
| Paths | 2 |
| Total Lines | 30 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 11 | public function testMainFunctionality() { |
||
| 12 | $root = array( |
||
| 13 | 'a', |
||
| 14 | 'b', |
||
| 15 | array( |
||
| 16 | 'c1', |
||
| 17 | array('c2kind'), |
||
| 18 | 'c3' |
||
| 19 | ), |
||
| 20 | 'd' |
||
| 21 | ); |
||
| 22 | $it = new CallbackRecursiveIterator($root, function($e) { |
||
| 23 | return is_array($e) ? $e : false; |
||
| 24 | }); |
||
| 25 | $expected = array( |
||
| 26 | '|-a', |
||
| 27 | '|-b', |
||
| 28 | '|-Array', |
||
| 29 | '| |-c1', |
||
| 30 | '| |-Array', |
||
| 31 | '| | \-c2kind', |
||
| 32 | '| \-c3', |
||
| 33 | '\-d', |
||
| 34 | ); |
||
| 35 | $i = 0; |
||
| 36 | foreach(new \RecursiveTreeIterator($it) as $node) { |
||
| 37 | $this->assertEquals($expected[$i], $node); |
||
| 38 | $i += 1; |
||
| 39 | } |
||
| 40 | } |
||
| 41 | } |
||
| 43 |