/**
* Tests with a simple linear hierarchy.
*/
public function testSimpleHierarchy() { // Add some links with parent on the previous one and test some values.
// <tools>
// - test1
// -- test2
// --- test3
$this->
addMenuLink('test1', ''
);
$this->
assertMenuLink('test1',
['has_children' => 0, 'depth' => 1
]);
$this->
addMenuLink('test2', 'test1'
);
$this->
assertMenuLink('test1',
['has_children' => 1, 'depth' => 1
],
[],
['test2'
]);
$this->
assertMenuLink('test2',
['has_children' => 0, 'depth' => 2
],
['test1'
]);
$this->
addMenuLink('test3', 'test2'
);
$this->
assertMenuLink('test1',
['has_children' => 1, 'depth' => 1
],
[],
['test2', 'test3'
]);
$this->
assertMenuLink('test2',
['has_children' => 1, 'depth' => 2
],
['test1'
],
['test3'
]);
$this->
assertMenuLink('test3',
['has_children' => 0, 'depth' => 3
],
['test2', 'test1'
]);
}