You are here

public function AbstractProfilerStorageTest::testPurge 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::testPurge()

File

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

Class

AbstractProfilerStorageTest

Namespace

Symfony\Component\HttpKernel\Tests\Profiler

Code

public function testPurge() {
  $profile = new Profile('token1');
  $profile
    ->setIp('127.0.0.1');
  $profile
    ->setUrl('http://example.com/');
  $profile
    ->setMethod('GET');
  $this
    ->getStorage()
    ->write($profile);
  $this
    ->assertTrue(false !== $this
    ->getStorage()
    ->read('token1'));
  $this
    ->assertCount(1, $this
    ->getStorage()
    ->find('127.0.0.1', '', 10, 'GET'));
  $profile = new Profile('token2');
  $profile
    ->setIp('127.0.0.1');
  $profile
    ->setUrl('http://example.net/');
  $profile
    ->setMethod('GET');
  $this
    ->getStorage()
    ->write($profile);
  $this
    ->assertTrue(false !== $this
    ->getStorage()
    ->read('token2'));
  $this
    ->assertCount(2, $this
    ->getStorage()
    ->find('127.0.0.1', '', 10, 'GET'));
  $this
    ->getStorage()
    ->purge();
  $this
    ->assertEmpty($this
    ->getStorage()
    ->read('token'), '->purge() removes all data stored by profiler');
  $this
    ->assertCount(0, $this
    ->getStorage()
    ->find('127.0.0.1', '', 10, 'GET'), '->purge() removes all items from index');
}