protected function tearDown()
 {
     parent::tearDown();
     $testPath = getenv('YAPEPBASE_TEST_TEMPPATH');
     if (empty($testPath)) {
         return;
     }
     if (file_exists($testPath)) {
         $fileHandler = new FileHandlerPhp();
         $fileHandler->removeDirectory($testPath, true);
     }
 }
Esempio n. 2
0
 /**
  * Deletes every data in the storage.
  *
  * @throws \YapepBase\Exception\StorageException   If the Storage is read only.
  *
  * @return void
  */
 public function clear()
 {
     if ($this->readOnly) {
         throw new StorageException('Trying to write to a read only storage');
     }
     $startTime = microtime(true);
     try {
         $this->fileHandler->removeDirectory($this->path, true);
     } catch (FileException $e) {
         throw new StorageException('Unable to remove the directory: ' . $this->path, 0, $e);
     }
     $debugger = Application::getInstance()->getDiContainer()->getDebugger();
     if (!$this->debuggerDisabled && $debugger !== false) {
         $debugger->addItem(new StorageItem('file', 'file.' . $this->currentConfigurationName, StorageItem::METHOD_CLEAR, null, microtime(true) - $startTime));
     }
 }