You are here

public function UrlGeneratorTest::testUrlEncoding in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/routing/Tests/Generator/UrlGeneratorTest.php \Symfony\Component\Routing\Tests\Generator\UrlGeneratorTest::testUrlEncoding()

File

vendor/symfony/routing/Tests/Generator/UrlGeneratorTest.php, line 314

Class

UrlGeneratorTest

Namespace

Symfony\Component\Routing\Tests\Generator

Code

public function testUrlEncoding() {

  // This tests the encoding of reserved characters that are used for delimiting of URI components (defined in RFC 3986)
  // and other special ASCII chars. These chars are tested as static text path, variable path and query param.
  $chars = '@:[]/()*\'" +,;-._~&$<>|{}%\\^`!?foo=bar#id';
  $routes = $this
    ->getRoutes('test', new Route("/{$chars}/{varpath}", array(), array(
    'varpath' => '.+',
  )));
  $this
    ->assertSame('/app.php/@:%5B%5D/%28%29*%27%22%20+,;-._~%26%24%3C%3E|%7B%7D%25%5C%5E%60!%3Ffoo=bar%23id' . '/@:%5B%5D/%28%29*%27%22%20+,;-._~%26%24%3C%3E|%7B%7D%25%5C%5E%60!%3Ffoo=bar%23id' . '?query=%40%3A%5B%5D/%28%29%2A%27%22+%2B%2C%3B-._%7E%26%24%3C%3E%7C%7B%7D%25%5C%5E%60%21%3Ffoo%3Dbar%23id', $this
    ->getGenerator($routes)
    ->generate('test', array(
    'varpath' => $chars,
    'query' => $chars,
  )));
}