public function AbstractProfilerStorageTest::testRetrieveByUrl

File

drupal/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Profiler/AbstractProfilerStorageTest.php, line 110

Class

AbstractProfilerStorageTest

Namespace

Symfony\Component\HttpKernel\Tests\Profiler

Code

public function testRetrieveByUrl() {
  $profile = new Profile('simple_quote');
  $profile
    ->setIp('127.0.0.1');
  $profile
    ->setUrl('http://foo.bar/\'');
  $profile
    ->setMethod('GET');
  $this
    ->getStorage()
    ->write($profile);
  $profile = new Profile('double_quote');
  $profile
    ->setIp('127.0.0.1');
  $profile
    ->setUrl('http://foo.bar/"');
  $profile
    ->setMethod('GET');
  $this
    ->getStorage()
    ->write($profile);
  $profile = new Profile('backslash');
  $profile
    ->setIp('127.0.0.1');
  $profile
    ->setUrl('http://foo\\bar/');
  $profile
    ->setMethod('GET');
  $this
    ->getStorage()
    ->write($profile);
  $profile = new Profile('percent');
  $profile
    ->setIp('127.0.0.1');
  $profile
    ->setUrl('http://foo.bar/%');
  $profile
    ->setMethod('GET');
  $this
    ->getStorage()
    ->write($profile);
  $profile = new Profile('underscore');
  $profile
    ->setIp('127.0.0.1');
  $profile
    ->setUrl('http://foo.bar/_');
  $profile
    ->setMethod('GET');
  $this
    ->getStorage()
    ->write($profile);
  $profile = new Profile('semicolon');
  $profile
    ->setIp('127.0.0.1');
  $profile
    ->setUrl('http://foo.bar/;');
  $profile
    ->setMethod('GET');
  $this
    ->getStorage()
    ->write($profile);
  $this
    ->assertCount(1, $this
    ->getStorage()
    ->find('127.0.0.1', 'http://foo.bar/\'', 10, 'GET'), '->find() accepts single quotes in URLs');
  $this
    ->assertCount(1, $this
    ->getStorage()
    ->find('127.0.0.1', 'http://foo.bar/"', 10, 'GET'), '->find() accepts double quotes in URLs');
  $this
    ->assertCount(1, $this
    ->getStorage()
    ->find('127.0.0.1', 'http://foo\\bar/', 10, 'GET'), '->find() accepts backslash in URLs');
  $this
    ->assertCount(1, $this
    ->getStorage()
    ->find('127.0.0.1', 'http://foo.bar/;', 10, 'GET'), '->find() accepts semicolon in URLs');
  $this
    ->assertCount(1, $this
    ->getStorage()
    ->find('127.0.0.1', 'http://foo.bar/%', 10, 'GET'), '->find() does not interpret a "%" as a wildcard in the URL');
  $this
    ->assertCount(1, $this
    ->getStorage()
    ->find('127.0.0.1', 'http://foo.bar/_', 10, 'GET'), '->find() does not interpret a "_" as a wildcard in the URL');
}