/**
  * Renders all public routes, that is, routes that do not start with "_".
  *
  * @return integer Number of rendered routes
  */
 public function render()
 {
     $counter = 0;
     foreach ($this->getRoutes() as $name => $route) {
         if ('_' !== substr($name, 0, 1)) {
             $this->routeRenderer->render($route, $name);
             $counter += 1;
         }
     }
     return $counter;
 }
 /**
  * Renders the page with the given controller name.
  *
  * @param string $controllerName Name of the controller
  */
 public function render($controllerName)
 {
     $controller = $this->getControllerName($controllerName);
     if (null === $controller) {
         throw new ControllerNotFoundException(sprintf('Could not find controller "%s".', $controllerName));
     }
     $route = $this->getRoute($controller);
     if (null === $route) {
         throw new RouteNotFoundException(sprintf('Could not find route for controller "%s".', $controllerName));
     }
     $this->routeRenderer->render($route[1], $route[0]);
 }
 /**
  * Tests the renderByName() method, but the route is not found.
  *
  * @test
  *
  * @covers Cocur\Bundle\BuildBundle\Renderer\RouteRenderer::renderByName()
  *
  * @expectedException Cocur\Bundle\BuildBundle\Exception\RouteNotFoundException
  */
 public function renderByNameShouldThrowExceptionIfRouteNotFound()
 {
     $route = m::mock('Symfony\\Component\\Routing\\Route');
     $routeCollection = m::mock('Symfony\\Component\\Routing\\RouteCollection');
     $routeCollection->shouldReceive('get')->with('invalid_route')->once()->andReturn(null);
     $this->router->shouldReceive('getRouteCollection')->once()->andReturn($routeCollection);
     $this->renderer->renderByName('invalid_route');
 }