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