public function remove()
{
// Truncate to notify isBootstrapped() about the new state.
if (!ftruncate($this->fileHandle, 0)) {
throw new StorageException("Could not truncate {$this->path}");
}
if (!unlink($this->path)) {
throw new StorageException("Could not delete {$this->path}");
}
}
/** * Tests deleting fails. * * @test * @expectedException bandwidthThrottle\tokenBucket\storage\StorageException */ public function testRemoveFails() { $data = new vfsStreamFile("data"); $root = vfsStream::setup('test'); $root->chmod(0); $root->addChild($data); $storage = new FileStorage(vfsStream::url("test/data")); $storage->remove(); }