You are here

public function BaseFileCacheTest::tearDown in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/BaseFileCacheTest.php \Doctrine\Tests\Common\Cache\BaseFileCacheTest::tearDown()

File

vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/BaseFileCacheTest.php, line 19

Class

BaseFileCacheTest

Namespace

Doctrine\Tests\Common\Cache

Code

public function tearDown() {
  if (!is_dir($this->directory)) {
    return;
  }
  $iterator = new RecursiveDirectoryIterator($this->directory);
  foreach (new RecursiveIteratorIterator($iterator, RecursiveIteratorIterator::CHILD_FIRST) as $file) {
    if ($file
      ->isFile()) {
      @unlink($file
        ->getRealPath());
    }
    elseif ($file
      ->isDir()) {
      @rmdir($file
        ->getRealPath());
    }
  }
}