public function UrlMatcherTest::testCannotRelyOnPrefix

File

drupal/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Matcher/UrlMatcherTest.php, line 333

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')
    ->setPattern('/new');
  $coll
    ->addCollection($subColl);
  $matcher = new UrlMatcher($coll, new RequestContext());
  $this
    ->assertEquals(array(
    '_route' => 'bar',
  ), $matcher
    ->match('/new'));
}