You are here

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

File

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

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'));
}