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()); }
/** * Copies directory with all contents * * ``` php * <?php * $I->copyDir('vendor','old_vendor'); * ?> * ``` * * @param $src * @param $dst */ public function copyDir($src, $dst) { Util::copyDir($src, $dst); }
/** * Erases directory contents * * ``` php * <?php * $I->cleanDir('logs'); * ?> * ``` * * @param $dirname */ public function cleanDir($dirname) { $path = $this->absolutizePath($dirname); Util::doEmptyDir($path); }
public function cleanup(TestEvent $e) { if (!$this->webDriverModule or !$this->dir) { return; } if (!$this->config['delete_successful']) { $this->persist($e); return; } // deleting successfully executed tests FileSystem::deleteDir($this->dir); }
function __c3_clear() { \Codeception\Util\FileSystem::doEmptyDir(C3_CODECOVERAGE_MEDIATE_STORAGE); }
protected function tearDown() { unset($_SERVER['HTTP_X_CODECEPTION_CODECOVERAGE_DEBUG']); unset($_SERVER['HTTP_X_CODECEPTION_CODECOVERAGE']); \Codeception\Util\FileSystem::deleteDir($this->c3_dir); }
public function _before() { \Codeception\Util\FileSystem::doEmptyDir('tests/data/included/_log'); file_put_contents('tests/data/included/_log/.gitkeep', ''); }