protected function tearDown()
 {
     $filesystem = new \Magento\Framework\Filesystem\Driver\File();
     if ($filesystem->isExists($this->_tmpDir)) {
         $filesystem->deleteDirectory($this->_tmpDir);
     }
 }
Example #2
0
 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);
     }
 }
Example #3
0
 /**
  * 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);
 }
Example #4
0
 /**
  * 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);
 }
Example #5
0
        fwrite($fh, "  - " . $file . PHP_EOL);
    }
}
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
 public static function tearDownAfterClass()
 {
     $filesystemAdapter = new \Magento\Framework\Filesystem\Driver\File();
     $filesystemAdapter->deleteDirectory(self::$logDir);
 }
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magentocommerce.com for more information.
 *
 * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
 * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 */
if (!defined('TESTS_TEMP_DIR')) {
    define('TESTS_TEMP_DIR', dirname(__DIR__) . '/tmp');
}
require __DIR__ . '/../../../../app/autoload.php';
require BP . '/app/functions.php';
(new \Magento\Framework\Autoload\IncludePath())->addIncludePath(array(__DIR__, realpath(__DIR__ . '/../testsuite'), realpath(BP . '/app'), realpath(BP . '/app/code'), realpath(BP . '/lib/internal')));
if (is_dir(TESTS_TEMP_DIR)) {
    $filesystemAdapter = new \Magento\Framework\Filesystem\Driver\File();
    $filesystemAdapter->deleteDirectory(TESTS_TEMP_DIR);
}
mkdir(TESTS_TEMP_DIR);
\Magento\Framework\Phrase::setRenderer(new \Magento\Framework\Phrase\Renderer\Placeholder());
function tool_autoloader($className)
{
    if (strpos($className, 'Magento\\Tools\\') === false) {
        return false;
    }
    $filePath = str_replace('\\', '/', $className);
    $filePath = BP . '/dev/tools/' . $filePath . '.php';
    if (file_exists($filePath)) {
        include_once $filePath;
    } else {
        return false;