public function testRecusiveDelete()
 {
     $fullPath = sys_get_temp_dir() . FileSystemHelper::DS . 'OhCacheTests';
     mkdir($fullPath);
     touch($fullPath . FileSystemHelper::DS . '1');
     $this->assertFileExists($fullPath . FileSystemHelper::DS . '1');
     @mkdir($fullPath . FileSystemHelper::DS . 'dir');
     touch($fullPath . FileSystemHelper::DS . 'dir' . FileSystemHelper::DS . '2');
     $this->assertFileExists($fullPath . FileSystemHelper::DS . 'dir' . FileSystemHelper::DS . '2');
     @mkdir($fullPath . FileSystemHelper::DS . 'dir');
     $dir = new FileSystemHelper();
     $dir->recursivelyDeleteFromDirectory($fullPath . FileSystemHelper::DS . '1');
     $dir->recursivelyDeleteFromDirectory($fullPath);
     $this->assertFileNotExists($fullPath . FileSystemHelper::DS . '1');
     $this->assertFileNotExists($fullPath . FileSystemHelper::DS . 'dir' . FileSystemHelper::DS . '2');
 }
Пример #2
0
 /**
  * Flush the entire cache.
  *
  * @return boolean
  */
 public function flush()
 {
     try {
         $this->helper->recursivelyDeleteFromDirectory($this->path, true);
         return true;
         // @codeCoverageIgnoreStart
     } catch (\Exception $e) {
     }
     return false;
     // @codeCoverageIgnoreEnd
 }