/** * @dataProvider getBreadcrumbManagerDataProvider * @param $expected * @param $menu * @param $route */ public function testGetBreadcrumbLabels($expected, $menu, $route) { $this->provider->expects($this->any())->method('get')->will($this->returnCallback(function ($menu) { switch ($menu) { case BreadcrumbManager::FRONTEND_MENU: $item = new MenuItem('frontend_menu__test', $this->factory); $item->setExtra('routes', ['another_route', '/another_route/', 'another*route', 'route_with_frontend_true']); $item1 = new MenuItem('frontend_menu__test1', $this->factory); $item2 = new MenuItem('frontend_menu__sub_item', $this->factory); $item1->addChild($item2); $item1->setExtra('routes', []); $item2->addChild($item); return $item1; case 'test_menu': $item = new MenuItem('test_menu__test', $this->factory); $item->setExtra('routes', ['another_route', '/another_route/', 'another*route', 'route_without_frontend']); $item1 = new MenuItem('test_menu__test1', $this->factory); $item2 = new MenuItem('test_menu__sub_item', $this->factory); $item1->addChild($item2); $item1->setExtra('routes', []); $item2->addChild($item); return $item1; } return null; })); $this->assertEquals($expected, $this->manager->getBreadcrumbLabels($menu, $route)); }