/** * {@inheritDoc} */ protected function execute(InputInterface $input, OutputInterface $output) { if ($input->getOption('base-url')) { $this->renderer->setBaseUrl($input->getOption('base-url')); } $counter = $this->renderer->render(); $output->writeln(sprintf('Rendered <info>%s</info> routes.', $counter)); if (true === $this->enableAssetic) { $this->executeAsseticDump($input, $output); } $this->executeAssetsInstall($input, $output); }
/** * Tests the render() method. * * Route collection returns two routes, one public and one private (prefixed with "_"), renderer * should only render the public route. * * @test * * @covers Cocur\Bundle\BuildBundle\Renderer\RoutesRenderer::render() * @covers Cocur\Bundle\BuildBundle\Renderer\RoutesRenderer::getRoutes() */ public function renderShouldRenderRoutesThatArePassedToTheConstructor() { $route = m::mock('Symfony\\Component\\Routing\\Route'); $routeCollection = m::mock('Symfony\\Component\\Routing\\RouteCollection'); $routeCollection->shouldReceive('get')->with('route1')->once()->andReturn($route); $this->router->shouldReceive('getRouteCollection')->once()->andReturn($routeCollection); $this->routeRenderer->shouldReceive('render')->with($route, 'route1')->once(); $renderer = new RoutesRenderer($this->routeRenderer, $this->router, ['route1']); $result = $renderer->render(); $this->assertEquals(1, $result); }