public function MongoDbProfilerStorageTest::testCleanup in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/http-kernel/Tests/Profiler/MongoDbProfilerStorageTest.php \Symfony\Component\HttpKernel\Tests\Profiler\MongoDbProfilerStorageTest::testCleanup()
File
- vendor/
symfony/ http-kernel/ Tests/ Profiler/ MongoDbProfilerStorageTest.php, line 100
Class
Namespace
Symfony\Component\HttpKernel\Tests\ProfilerCode
public function testCleanup() {
$dt = new \DateTime('-2 day');
for ($i = 0; $i < 3; ++$i) {
$dt
->modify('-1 day');
$profile = new Profile('time_' . $i);
$profile
->setTime($dt
->getTimestamp());
$profile
->setMethod('GET');
self::$storage
->write($profile);
}
$records = self::$storage
->find('', '', 3, 'GET');
$this
->assertCount(1, $records, '->find() returns only one record');
$this
->assertEquals($records[0]['token'], 'time_2', '->find() returns the latest added record');
self::$storage
->purge();
}