You are here

public function UrlMatcherTest::testCannotRelyOnPrefix in Zircon Profile 8

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

File

vendor/symfony/routing/Tests/Matcher/UrlMatcherTest.php, line 348

Class

UrlMatcherTest

Namespace

Symfony\Component\Routing\Tests\Matcher

Code

public function testCannotRelyOnPrefix() {
  $coll = new RouteCollection();
  $subColl = new RouteCollection();
  $subColl
    ->add('bar', new Route('/bar'));
  $subColl
    ->addPrefix('/prefix');

  // overwrite the pattern, so the prefix is not valid anymore for this route in the collection
  $subColl
    ->get('bar')
    ->setPath('/new');
  $coll
    ->addCollection($subColl);
  $matcher = new UrlMatcher($coll, new RequestContext());
  $this
    ->assertEquals(array(
    '_route' => 'bar',
  ), $matcher
    ->match('/new'));
}