You are here

public function UrlMatcherTest::testMatchRegression 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::testMatchRegression()

File

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

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) {
  }
}