public function testEscapeScriptName()
 {
     $collection = new RouteCollection();
     $collection->add('foo', new Route('/foo'));
     $dumper = new ApacheMatcherDumper($collection);
     $this->assertStringEqualsFile(self::$fixturesPath . '/dumper/url_matcher2.apache', $dumper->dump(array('script_name' => 'ap p_d\\ ev.php')));
 }
 public function testDump()
 {
     $collection = new RouteCollection();
     // defaults and requirements
     $collection->add('foo', new Route('/foo/{bar}', array('def' => 'test'), array('bar' => 'baz|symfony')));
     // method requirement
     $collection->add('bar', new Route('/bar/{foo}', array(), array('_method' => 'GET|head')));
     // method requirement (again)
     $collection->add('baragain', new Route('/baragain/{foo}', array(), array('_method' => 'get|post')));
     // simple
     $collection->add('baz', new Route('/test/baz'));
     // simple with extension
     $collection->add('baz2', new Route('/test/baz.html'));
     // trailing slash
     $collection->add('baz3', new Route('/test/baz3/'));
     // trailing slash with variable
     $collection->add('baz4', new Route('/test/{foo}/'));
     // trailing slash and safe method
     $collection->add('baz5', new Route('/test/{foo}/', array(), array('_method' => 'get')));
     // trailing slash and unsafe method
     $collection->add('baz5unsafe', new Route('/testunsafe/{foo}/', array(), array('_method' => 'post')));
     // complex
     $collection->add('baz6', new Route('/test/baz', array('foo' => 'bar baz')));
     $dumper = new ApacheMatcherDumper($collection);
     $this->assertStringEqualsFile(self::$fixturesPath . '/dumper/url_matcher1.apache', $dumper->dump(), '->dump() dumps basic routes to the correct apache format.');
 }
 public function testDump()
 {
     $collection = new RouteCollection();
     $collection->add('foo', new Route('/foo/:bar', array('def' => 'test'), array('bar' => 'baz|symfony')));
     $collection->add('bar', new Route('/bar/:foo', array(), array('_method' => 'GET|head')));
     $dumper = new ApacheMatcherDumper($collection);
     $this->assertStringEqualsFile(self::$fixturesPath . '/dumper/url_matcher1.apache', $dumper->dump(), '->dump() dumps basic routes to the correct apache format.');
 }
 /**
  * @see Command
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $router = $this->container->get('router');
     $dumpOptions = array();
     if ($input->getArgument('script_name')) {
         $dumpOptions['script_name'] = $input->getArgument('script_name');
     }
     $dumper = new ApacheMatcherDumper($router->getRouteCollection());
     $output->writeln($dumper->dump($dumpOptions), Output::OUTPUT_RAW);
 }
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $formatter = $this->getHelper('formatter');
     $output->writeln($formatter->formatSection('warning', 'The router:dump-apache command is deprecated since version 2.5 and will be removed in 3.0', 'comment'));
     $router = $this->getContainer()->get('router');
     $dumpOptions = array();
     if ($input->getArgument('script_name')) {
         $dumpOptions['script_name'] = $input->getArgument('script_name');
     }
     if ($input->getOption('base-uri')) {
         $dumpOptions['base_uri'] = $input->getOption('base-uri');
     }
     $dumper = new ApacheMatcherDumper($router->getRouteCollection());
     $output->writeln($dumper->dump($dumpOptions), OutputInterface::OUTPUT_RAW);
 }
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $io = new SymfonyStyle($input, $output);
     $io->title('Router Apache Dumper');
     $io->caution('The router:dump-apache command is deprecated since version 2.5 and will be removed in 3.0.');
     $router = $this->getContainer()->get('router');
     $dumpOptions = array();
     if ($input->getArgument('script_name')) {
         $dumpOptions['script_name'] = $input->getArgument('script_name');
     }
     if ($input->getOption('base-uri')) {
         $dumpOptions['base_uri'] = $input->getOption('base-uri');
     }
     $dumper = new ApacheMatcherDumper($router->getRouteCollection());
     $io->writeln($dumper->dump($dumpOptions), OutputInterface::OUTPUT_RAW);
 }
 /**
  * @see Command
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $router = $this->container->get('router');
     $dumper = new ApacheMatcherDumper($router->getRouteCollection());
     $output->writeln($dumper->dump(), Output::OUTPUT_RAW);
 }