public function UrlMatcherTest::testDefaultRequirementForOptionalVariables

File

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

Class

UrlMatcherTest

Namespace

Symfony\Component\Routing\Tests\Matcher

Code

public function testDefaultRequirementForOptionalVariables() {
  $coll = new RouteCollection();
  $coll
    ->add('test', new Route('/{page}.{_format}', array(
    'page' => 'index',
    '_format' => 'html',
  )));
  $matcher = new UrlMatcher($coll, new RequestContext());
  $this
    ->assertEquals(array(
    'page' => 'my-page',
    '_format' => 'xml',
    '_route' => 'test',
  ), $matcher
    ->match('/my-page.xml'));
}