/** * Test exception if one breadcrumb is missing its label */ public function testMalformedBreadcrumb() { $collection = new RouteCollection(); $route1Crumbs = array('breadcrumb' => array('parent_route' => 'bar')); $route2Crumbs = array('breadcrumb' => array('label' => 'Bar')); $collection->add('foo', new Route('/foo', array(), array(), $route1Crumbs)); $collection->add('bar', new Route('/bar', array(), array(), $route2Crumbs)); $this->delegatingLoader->expects($this->once())->method('load')->will($this->returnValue($collection)); $this->setExpectedException('\\InvalidArgumentException'); $this->loader->load('foobar'); }
/** * Test behaviour of loader when breadcrumbs are configured circular (a -> b -> a etc.) */ public function testCircularBreadcrumbs() { $routeFooName = 'foo'; $routeBarName = 'bar'; $routeFooCrumbs = array('breadcrumb' => array('label' => 'Foo', 'parent_route' => $routeBarName)); $routeBarCrumbs = array('breadcrumb' => array('label' => 'Bar', 'parent_route' => $routeFooName)); $collection = new RouteCollection(); $collection->add($routeFooName, new Route('/foo', array(), array(), $routeFooCrumbs)); $collection->add($routeBarName, new Route('/bar', array(), array(), $routeBarCrumbs)); $this->delegatingLoader->expects($this->once())->method('load')->will($this->returnValue($collection)); $this->setExpectedException('\\LogicException'); $this->loader->load('foobar'); }