| Conditions | 1 |
| Paths | 1 |
| Total Lines | 44 |
| Code Lines | 26 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 263 | public function testFlatToNestedChangeLevelName() |
||
| 264 | { |
||
| 265 | $flatTree = [ |
||
| 266 | [ |
||
| 267 | 'id' => '1', |
||
| 268 | 'parent' => null, |
||
| 269 | 'lvl' => 0, |
||
| 270 | ], |
||
| 271 | [ |
||
| 272 | 'id' => '1.1', |
||
| 273 | 'parent' => '1', |
||
| 274 | 'lvl' => 1, |
||
| 275 | ], |
||
| 276 | [ |
||
| 277 | 'id' => '1.2', |
||
| 278 | 'parent' => '1', |
||
| 279 | 'lvl' => 1, |
||
| 280 | ], |
||
| 281 | ]; |
||
| 282 | $result = Utilities::flatToNested($flatTree, 'lvl'); |
||
| 283 | |||
| 284 | $this->assertEquals( |
||
| 285 | [ |
||
| 286 | [ |
||
| 287 | 'id' => '1', |
||
| 288 | 'parent' => null, |
||
| 289 | 'lvl' => 0, |
||
| 290 | '_children' => [ |
||
| 291 | [ |
||
| 292 | 'id' => '1.1', |
||
| 293 | 'parent' => '1', |
||
| 294 | 'lvl' => 1, |
||
| 295 | '_children' => [], |
||
| 296 | ], |
||
| 297 | [ |
||
| 298 | 'id' => '1.2', |
||
| 299 | 'parent' => '1', |
||
| 300 | 'lvl' => 1, |
||
| 301 | '_children' => [], |
||
| 302 | ], |
||
| 303 | ], |
||
| 304 | ], |
||
| 305 | ], $result); |
||
| 306 | } |
||
| 307 | } |
||
| 308 |