| Conditions | 1 |
| Paths | 1 |
| Total Lines | 44 |
| Code Lines | 32 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 272 | public function testFlatToNestedChangeLevelName() |
||
| 273 | { |
||
| 274 | $flatTree = array( |
||
| 275 | array( |
||
| 276 | 'id' => '1', |
||
| 277 | 'parent' => null, |
||
| 278 | 'lvl' => 0, |
||
| 279 | ), |
||
| 280 | array( |
||
| 281 | 'id' => '1.1', |
||
| 282 | 'parent' => '1', |
||
| 283 | 'lvl' => 1, |
||
| 284 | ), |
||
| 285 | array( |
||
| 286 | 'id' => '1.2', |
||
| 287 | 'parent' => '1', |
||
| 288 | 'lvl' => 1, |
||
| 289 | ), |
||
| 290 | ); |
||
| 291 | $result = Utilities::flatToNested($flatTree, 'lvl'); |
||
| 292 | |||
| 293 | $this->assertEquals( |
||
| 294 | array( |
||
| 295 | array( |
||
| 296 | 'id' => '1', |
||
| 297 | 'parent' => null, |
||
| 298 | 'lvl' => 0, |
||
| 299 | '_children' => array( |
||
| 300 | array( |
||
| 301 | 'id' => '1.1', |
||
| 302 | 'parent' => '1', |
||
| 303 | 'lvl' => 1, |
||
| 304 | '_children' => array(), |
||
| 305 | ), |
||
| 306 | array( |
||
| 307 | 'id' => '1.2', |
||
| 308 | 'parent' => '1', |
||
| 309 | 'lvl' => 1, |
||
| 310 | '_children' => array(), |
||
| 311 | ), |
||
| 312 | ), |
||
| 313 | ), |
||
| 314 | ), |
||
| 315 | $result |
||
| 316 | ); |
||
| 319 |