protected function tearDown() { $filesystem = new \Magento\Framework\Filesystem\Driver\File(); if ($filesystem->isExists($this->_tmpDir)) { $filesystem->deleteDirectory($this->_tmpDir); } }
protected function tearDown() { // Delete a directory, where tests do some temporary work $tmpDir = $this->_getBaseFixtureDir() . '/config_dist/tmp'; $filesystemAdapter = new \Magento\Framework\Filesystem\Driver\File(); if ($filesystemAdapter->isExists($tmpDir)) { $filesystemAdapter->deleteDirectory($tmpDir); } }
/** * Ensure reports directory exists, empty, and has write permissions * * @throws \Magento\Framework\Exception\LocalizedException */ public function cleanupReports() { $reportDir = $this->getConfig()->getReportDir(); try { $filesystemAdapter = new \Magento\Framework\Filesystem\Driver\File(); if ($filesystemAdapter->isExists($reportDir)) { $filesystemAdapter->deleteDirectory($reportDir); } } catch (\Magento\Framework\Exception\FileSystemException $e) { if (file_exists($reportDir)) { throw new \Magento\Framework\Exception\LocalizedException(new \Magento\Framework\Phrase("Cannot cleanup reports directory '%1'.", $reportDir)); } } mkdir($reportDir, 0777, true); }
/** * Ensure reports directory exists, empty, and has write permissions * * @throws \Magento\Framework\Exception */ public function cleanupReports() { $reportDir = $this->_config->getReportDir(); try { $filesystemAdapter = new \Magento\Framework\Filesystem\Driver\File(); if ($filesystemAdapter->isExists($reportDir)) { $filesystemAdapter->deleteDirectory($reportDir); } } catch (\Magento\Framework\Filesystem\FilesystemException $e) { if (file_exists($reportDir)) { throw new \Magento\Framework\Exception("Cannot cleanup reports directory '{$reportDir}'."); } } mkdir($reportDir, 0777, true); }
} } fwrite($fh, "test:" . PHP_EOL); foreach ($testFiles as $file) { fwrite($fh, " - " . $file . PHP_EOL); } if (count($serveFiles) > 0) { fwrite($fh, "serve:" . PHP_EOL); foreach ($serveFiles as $file) { fwrite($fh, " - " . $file . PHP_EOL); } } fclose($fh); $testOutput = __DIR__ . '/test-output'; $filesystemAdapter = new \Magento\Framework\Filesystem\Driver\File(); if ($filesystemAdapter->isExists($testOutput)) { $filesystemAdapter->deleteDirectory($testOutput); } mkdir($testOutput); $command = 'java -jar "' . $jsTestDriver . '" --config "' . $jsTestDriverConf . '" --reset --port ' . $port . ' --browser "' . $browser . '" --raiseOnFailure true --tests all --testOutput "' . $testOutput . '"'; echo $command . PHP_EOL; if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { system($command); } else { $commandFile = __DIR__ . '/run_js_tests.sh'; $fh = fopen($commandFile, 'w'); $shellCommand = 'LSOF=`/usr/sbin/lsof -i :' . $port . ' -t` if [ "$LSOF" != "" ]; then kill -9 $LSOF fi