public function UrlMatcherTest::testMatchRegression

File

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

Class

UrlMatcherTest

Namespace

Symfony\Component\Routing\Tests\Matcher

Code

public function testMatchRegression() {
  $coll = new RouteCollection();
  $coll
    ->add('foo', new Route('/foo/{foo}'));
  $coll
    ->add('bar', new Route('/foo/bar/{foo}'));
  $matcher = new UrlMatcher($coll, new RequestContext());
  $this
    ->assertEquals(array(
    'foo' => 'bar',
    '_route' => 'bar',
  ), $matcher
    ->match('/foo/bar/bar'));
  $collection = new RouteCollection();
  $collection
    ->add('foo', new Route('/{bar}'));
  $matcher = new UrlMatcher($collection, new RequestContext());
  try {
    $matcher
      ->match('/');
    $this
      ->fail();
  } catch (ResourceNotFoundException $e) {
  }
}