public function testRenderWithClassAndTitle() { $this->pt2->setAttribute('class', 'parent2_class'); $this->pt2->setAttribute('title', 'parent2 title'); $rendered = '<ul class="root"><li class="first"><span>Parent 1</span><ul class="menu_level_1"><li class="first"><span>Child 1</span></li><li><span>Child 2</span></li><li class="last"><span>Child 3</span></li></ul></li><li class="parent2_class last" title="parent2 title"><span>Parent 2</span><ul class="menu_level_1"><li class="first last"><span>Child 4</span><ul class="menu_level_2"><li class="first last"><span>Grandchild 1</span></li></ul></li></ul></li></ul>'; $this->assertEquals($rendered, $this->renderer->render($this->menu)); }
private function active(\Knp\Menu\MenuItem $vm) { if (!$vm->isRoot()) { $vm->setExtra('active', true); $vm->setAttribute('class', 'active'); $this->active($vm->getParent()); } }