Пример #1
0
 public function testGetCurrentItem()
 {
     $this->ch4->setCurrent(true);
     $this->assertSame($this->ch4, $this->ch4->getCurrentItem());
     $this->assertSame($this->ch4, $this->menu->getCurrentItem());
     $this->assertNull($this->pt1->getCurrentItem());
 }
 public function testGetBreadcrumbs()
 {
     $item = new MenuItem('test', $this->factory);
     $subItem = new MenuItem('sub_item_test', $this->factory);
     $subItem->setCurrent(true);
     $item->addChild($subItem);
     $this->provider->expects($this->once())->method('get')->with('test', array('check_access' => false))->will($this->returnValue($item));
     $this->matcher->expects($this->any())->method('isCurrent')->with($subItem)->will($this->returnValue(true));
     $breadcrumbs = $this->manager->getBreadcrumbs('test', false);
     $this->assertEquals('sub_item_test', $breadcrumbs[0]['label']);
 }
 public function testRenderWithCurrentItem()
 {
     $this->ch2->setCurrent(true);
     $rendered = '<ul class="root"><li class="current_ancestor first"><span>Parent 1</span><ul class="menu_level_1"><li class="first"><span>Child 1</span></li><li class="current"><span>Child 2</span></li><li class="last"><span>Child 3</span></li></ul></li><li class="last"><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));
 }