public function AbstractProfilerStorageTest::testPurge in Zircon Profile 8
Same name and namespace in other branches
- 8.0 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
Namespace
Symfony\Component\HttpKernel\Tests\ProfilerCode
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');
}