mkdir($targetDir, 0755, true); } copy($source, $destination); } } unset($iterator, $file); /* Bootstrap the application */ $settings = new \Magento\TestFramework\Bootstrap\Settings($testsBaseDir, get_defined_constants()); $shell = new \Magento\Framework\Shell(new \Magento\Framework\Shell\CommandRenderer(), $logger); $installConfigFile = $settings->getAsConfigFile('TESTS_INSTALL_CONFIG_FILE'); if (!file_exists($installConfigFile)) { $installConfigFile = $installConfigFile . '.dist'; } $globalConfigFile = $settings->getAsConfigFile('TESTS_GLOBAL_CONFIG_FILE'); if (!file_exists($installConfigFile)) { $installConfigFile = $installConfigFile . '.dist'; } $dirList = new \Magento\Framework\App\Filesystem\DirectoryList(BP); $application = new \Magento\TestFramework\WebApiApplication($shell, $dirList->getPath(DirectoryList::VAR_DIR), $installConfigFile, $globalConfigFile, BP . '/app/etc/', $settings->get('TESTS_MAGENTO_MODE'), AutoloaderRegistry::getAutoloader()); if (defined('TESTS_MAGENTO_INSTALLATION') && TESTS_MAGENTO_INSTALLATION === 'enabled') { if (defined('TESTS_CLEANUP') && TESTS_CLEANUP === 'enabled') { $application->cleanup(); } $application->install(); } $bootstrap = new \Magento\TestFramework\Bootstrap($settings, new \Magento\TestFramework\Bootstrap\Environment(), new \Magento\TestFramework\Bootstrap\WebapiDocBlock("{$integrationTestsDir}/testsuite"), new \Magento\TestFramework\Bootstrap\Profiler(new \Magento\Framework\Profiler\Driver\Standard()), $shell, $application, new \Magento\TestFramework\Bootstrap\MemoryFactory($shell)); $bootstrap->runBootstrap(); $application->initialize(); \Magento\TestFramework\Helper\Bootstrap::setInstance(new \Magento\TestFramework\Helper\Bootstrap($bootstrap)); \Magento\Framework\App\Utility\Files::setInstance(new \Magento\Framework\App\Utility\Files(BP)); unset($bootstrap, $application, $settings, $shell);
$shell = new \Magento\Framework\Shell(new \Magento\Framework\Shell\CommandRenderer(), new \Zend_Log($logWriter)); } else { $shell = new \Magento\Framework\Shell(new \Magento\Framework\Shell\CommandRenderer()); } $installConfigFile = $settings->getAsConfigFile('TESTS_INSTALL_CONFIG_FILE'); if (!file_exists($installConfigFile)) { $installConfigFile .= '.dist'; } $globalConfigFile = $settings->getAsConfigFile('TESTS_GLOBAL_CONFIG_FILE'); if (!file_exists($globalConfigFile)) { $globalConfigFile .= '.dist'; } $sandboxUniqueId = md5(sha1_file($installConfigFile)); $installDir = TESTS_TEMP_DIR . "/sandbox-{$settings->get('TESTS_PARALLEL_THREAD', 0)}-{$sandboxUniqueId}"; $application = new \Magento\TestFramework\Application($shell, $installDir, $installConfigFile, $globalConfigFile, $settings->get('TESTS_GLOBAL_CONFIG_DIR'), $settings->get('TESTS_MAGENTO_MODE'), AutoloaderRegistry::getAutoloader(), true); $bootstrap = new \Magento\TestFramework\Bootstrap($settings, new \Magento\TestFramework\Bootstrap\Environment(), new \Magento\TestFramework\Bootstrap\DocBlock("{$testsBaseDir}/testsuite"), new \Magento\TestFramework\Bootstrap\Profiler(new \Magento\Framework\Profiler\Driver\Standard()), $shell, $application, new \Magento\TestFramework\Bootstrap\MemoryFactory($shell)); $bootstrap->runBootstrap(); if ($settings->getAsBoolean('TESTS_CLEANUP')) { $application->cleanup(); } if (!$application->isInstalled()) { $application->install(); } $application->initialize([]); \Magento\TestFramework\Helper\Bootstrap::setInstance(new \Magento\TestFramework\Helper\Bootstrap($bootstrap)); \Magento\Framework\App\Utility\Files::setInstance(new Magento\Framework\App\Utility\Files($magentoBaseDir)); /* Unset declared global variables to release the PHPUnit from maintaining their values between tests */ unset($testsBaseDir, $magentoBaseDir, $logWriter, $settings, $shell, $application, $bootstrap); } catch (\Exception $e) { echo $e . PHP_EOL; exit(1);
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ require_once __DIR__ . '/../../../../app/bootstrap.php'; require_once __DIR__ . '/../../static/framework/Magento/TestFramework/Utility/Classes.php'; require_once __DIR__ . '/../../static/framework/Magento/TestFramework/Utility/AggregateInvoker.php'; $testsBaseDir = dirname(__DIR__); $testsTmpDir = "{$testsBaseDir}/tmp"; $magentoBaseDir = realpath("{$testsBaseDir}/../../../"); (new \Magento\Framework\Autoload\IncludePath())->addIncludePath(array("{$testsBaseDir}/framework", "{$testsBaseDir}/testsuite")); 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; } } spl_autoload_register('tool_autoloader'); /* Bootstrap the application */ $invariantSettings = array('TESTS_LOCAL_CONFIG_EXTRA_FILE' => 'etc/integration-tests-config.xml'); $bootstrap = new \Magento\TestFramework\Bootstrap(new \Magento\TestFramework\Bootstrap\Settings($testsBaseDir, $invariantSettings + get_defined_constants()), new \Magento\TestFramework\Bootstrap\Environment(), new \Magento\TestFramework\Bootstrap\DocBlock("{$testsBaseDir}/testsuite"), new \Magento\TestFramework\Bootstrap\Profiler(new \Magento\Framework\Profiler\Driver\Standard()), new \Magento\Framework\Shell(new \Magento\Framework\Shell\CommandRenderer()), $testsTmpDir); $bootstrap->runBootstrap(); \Magento\TestFramework\Helper\Bootstrap::setInstance(new \Magento\TestFramework\Helper\Bootstrap($bootstrap)); Magento\TestFramework\Utility\Files::setInstance(new Magento\TestFramework\Utility\Files($magentoBaseDir)); /* Unset declared global variables to release the PHPUnit from maintaining their values between tests */ unset($bootstrap);