You are here

public function AbstractProfilerStorageTest::testRetrieveByUrl in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/symfony/http-kernel/Tests/Profiler/AbstractProfilerStorageTest.php \Symfony\Component\HttpKernel\Tests\Profiler\AbstractProfilerStorageTest::testRetrieveByUrl()

File

vendor/symfony/http-kernel/Tests/Profiler/AbstractProfilerStorageTest.php, line 111

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