You are here

public function RouteCollectionTest::testAddPrefixOverridesDefaultsAndRequirements in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/routing/Tests/RouteCollectionTest.php \Symfony\Component\Routing\Tests\RouteCollectionTest::testAddPrefixOverridesDefaultsAndRequirements()

File

vendor/symfony/routing/Tests/RouteCollectionTest.php, line 164

Class

RouteCollectionTest

Namespace

Symfony\Component\Routing\Tests

Code

public function testAddPrefixOverridesDefaultsAndRequirements() {
  $collection = new RouteCollection();
  $collection
    ->add('foo', $foo = new Route('/foo.{_format}'));
  $collection
    ->add('bar', $bar = new Route('/bar.{_format}', array(), array(
    '_format' => 'json',
  )));
  $collection
    ->addPrefix('/admin', array(), array(
    '_format' => 'html',
  ));
  $this
    ->assertEquals('html', $collection
    ->get('foo')
    ->getRequirement('_format'), '->addPrefix() overrides existing requirements');
  $this
    ->assertEquals('html', $collection
    ->get('bar')
    ->getRequirement('_format'), '->addPrefix() overrides existing requirements');
}