protected function execute(InputInterface $input, OutputInterface $output) { $this->getGlobalConfig($input->getOption('config')); $output->writeln("<info>Cleaning up " . Configuration::outputDir() . "...</info>"); FileSystem::doEmptyDir(Configuration::outputDir()); $output->writeln("Done"); }
protected function retrieveAndPrintHtml($suite) { $tempFile = str_replace('.', '', tempnam(sys_get_temp_dir(), 'C3')) . '.tar'; file_put_contents($tempFile, $this->getRemoteCoverageFile($this->module, 'html')); $destDir = \Codeception\Configuration::logDir() . $suite . '.remote.coverage'; if (is_dir($destDir)) { \Codeception\Util\FileSystem::doEmptyDir($destDir); } else { mkdir($destDir, 0777, true); } $phar = new \PharData($tempFile); $phar->extractTo($destDir); unlink($tempFile); }
protected function retrieveAndPrintHtml($suite) { $tempFile = tempnam(sys_get_temp_dir(), 'C3') . '.tar'; file_put_contents($tempFile, $this->c3Request('html')); $destDir = Configuration::outputDir() . $suite . '.remote.coverage'; if (is_dir($destDir)) { FileSystem::doEmptyDir($destDir); } else { mkdir($destDir, 0777, true); } $phar = new \PharData($tempFile); $phar->extractTo($destDir); unlink($tempFile); }
/** * Initialize the module after configuration has been loaded */ public function _initialize() { if (!class_exists('\\Imagick')) { throw new ModuleException(__CLASS__, 'Required class \\Imagick could not be found! Please install the PHP Image Magick extension to use this module.'); } $this->moduleFileSystemUtil = new RegressionFileSystem($this); if (self::$moduleInitTime === 0) { self::$moduleInitTime = time(); if ($this->config['automaticCleanup'] === true && is_dir($this->moduleFileSystemUtil->getFailImageDirectory())) { // cleanup fail image directory FileSystem::doEmptyDir($this->moduleFileSystemUtil->getFailImageDirectory()); } } $this->moduleFileSystemUtil->createDirectoryRecursive($this->moduleFileSystemUtil->getTempDirectory()); $this->moduleFileSystemUtil->createDirectoryRecursive($this->moduleFileSystemUtil->getReferenceImageDirectory()); $this->moduleFileSystemUtil->createDirectoryRecursive($this->moduleFileSystemUtil->getFailImageDirectory()); }
/** * Erases directory contents * * ``` php * <?php * $I->cleanDir('logs'); * ?> * ``` * * @param $dirname */ public function cleanDir($dirname) { $path = $this->absolutizePath($dirname); Util::doEmptyDir($path); }
function __c3_clear() { \Codeception\Util\FileSystem::doEmptyDir(C3_CODECOVERAGE_MEDIATE_STORAGE); }
public function _before() { \Codeception\Util\FileSystem::doEmptyDir('tests/data/included/_log'); file_put_contents('tests/data/included/_log/.gitkeep', ''); }