public function testRenderActiveNodes() { $parent = new Node('parent'); $parent->addChild(new Node('child 1', 'not-active'))->addChild(new Node('nested child of child 1', 'active'))->addChild(new Node('nested child of nested child of child 1', 'not-active')); $parent->addChild(new Node('child 2', 'not-active')); $parent->resolveActive(function ($link) { return $link === 'active'; }, TRUE); $view = $parent->renderActiveNodes(new NodeView()); $this->assertEquals('parent', $view->label, 'Parent is assigned to the base view'); $nodes = $view->children; $this->assertCount(2, $nodes, 'Only active nodes are rendered'); $this->assertEquals('child 1', array_shift($nodes)->label); $this->assertEquals('nested child of child 1', array_shift($nodes)->label); }