/** * @covers TokenManager\TokenManager::clean */ public function testTokenManagerClean() { $options = array('dir' => $this->tokenDirPath, 'prefix' => '1234', 'minTimeout' => 1, 'maxTimeout' => 1); $this->cleanTokenDir($options['dir']); $tokenManager = new TokenManager($options); $token = $tokenManager->get(); $tokenFile = $options['dir'] . $options['prefix'] . $token; sleep(2); $nb = $tokenManager->clean(); $this->assertEquals(1, $nb); $this->assertFalse(file_exists($tokenFile)); }