/** * Reset the system to the original state. * * @return void */ protected function tearDown() { parent::tearDown(); if (is_dir($this->tmpDir)) { $directoryHandler = opendir($this->tmpDir); while (false !== ($file = readdir($directoryHandler))) { if ($file != '.' && $file != '..') { unlink($this->tmpDir . DIRECTORY_SEPARATOR . $file); } } closedir($directoryHandler); rmdir($this->tmpDir); } else { trigger_error('Expected tmp dir does not exist.', E_USER_WARNING); } }