public function UrlMatcherTest::testMatchNonAlpha

File

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

Class

UrlMatcherTest

Namespace

Symfony\Component\Routing\Tests\Matcher

Code

public function testMatchNonAlpha() {
  $collection = new RouteCollection();
  $chars = '!"$%éà &\'()*+,./:;<=>@ABCDEFGHIJKLMNOPQRSTUVWXYZ\\[]^_`abcdefghijklmnopqrstuvwxyz{|}~-';
  $collection
    ->add('foo', new Route('/{foo}/bar', array(), array(
    'foo' => '[' . preg_quote($chars) . ']+',
  )));
  $matcher = new UrlMatcher($collection, new RequestContext());
  $this
    ->assertEquals(array(
    '_route' => 'foo',
    'foo' => $chars,
  ), $matcher
    ->match('/' . rawurlencode($chars) . '/bar'));
  $this
    ->assertEquals(array(
    '_route' => 'foo',
    'foo' => $chars,
  ), $matcher
    ->match('/' . strtr($chars, array(
    '%' => '%25',
  )) . '/bar'));
}