public function PhpFileCacheTest::tearDown

File

drupal/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Cache/PhpFileCacheTest.php, line 104

Class

PhpFileCacheTest
@group DCOM-101

Namespace

Doctrine\Tests\Common\Cache

Code

public function tearDown() {
  if (!$this->driver) {
    return;
  }
  $dir = $this->driver
    ->getDirectory();
  $ext = $this->driver
    ->getExtension();
  $iterator = new \RecursiveDirectoryIterator($dir);
  foreach (new \RecursiveIteratorIterator($iterator, \RecursiveIteratorIterator::CHILD_FIRST) as $file) {
    if ($file
      ->isFile()) {
      @unlink($file
        ->getRealPath());
    }
    else {
      @rmdir($file
        ->getRealPath());
    }
  }
}