/** * @depends testGetInstance */ public function testSetGetInstance() { Magento_Test_Bootstrap::setInstance($this->_bootstrap); $this->assertSame($this->_bootstrap, Magento_Test_Bootstrap::getInstance()); }
} if (defined('TESTS_MODULE_CONFIG_FILES') && TESTS_MODULE_CONFIG_FILES) { $moduleEtcFiles = TESTS_MODULE_CONFIG_FILES; } else { $moduleEtcFiles = "../../../app/etc/modules/*.xml"; } $developerMode = false; if (defined('TESTS_MAGENTO_DEVELOPER_MODE') && TESTS_MAGENTO_DEVELOPER_MODE == 'enabled') { $developerMode = true; } /* Enable profiler if necessary */ if (defined('TESTS_PROFILER_FILE') && TESTS_PROFILER_FILE) { Magento_Profiler::registerOutput(new Magento_Profiler_Output_Csvfile($testsBaseDir . DIRECTORY_SEPARATOR . TESTS_PROFILER_FILE)); } /* Enable profiler with bamboo friendly output format */ if (defined('TESTS_BAMBOO_PROFILER_FILE') && defined('TESTS_BAMBOO_PROFILER_METRICS_FILE')) { Magento_Profiler::registerOutput(new Magento_Test_Profiler_OutputBamboo($testsBaseDir . DIRECTORY_SEPARATOR . TESTS_BAMBOO_PROFILER_FILE, require $testsBaseDir . DIRECTORY_SEPARATOR . TESTS_BAMBOO_PROFILER_METRICS_FILE)); } /* * Activate custom DocBlock annotations. * Note: order of registering (and applying) annotations is important. * To allow config fixtures to deal with fixture stores, data fixtures should be processed before config fixtures. */ $eventManager = new Magento_Test_EventManager(array(new Magento_Test_Annotation_AppIsolation(), new Magento_Test_Event_Transaction(new Magento_Test_EventManager(array(new Magento_Test_Annotation_DbIsolation(), new Magento_Test_Annotation_DataFixture("{$testsBaseDir}/testsuite")))), new Magento_Test_Annotation_ConfigFixture())); Magento_Test_Event_PhpUnit::setDefaultEventManager($eventManager); Magento_Test_Event_Magento::setDefaultEventManager($eventManager); /* Bootstrap the application */ Magento_Test_Bootstrap::setInstance(new Magento_Test_Bootstrap($magentoBaseDir, $localXmlFile, $globalEtcFiles, $moduleEtcFiles, 'etc/integration-tests-config.xml', $testsTmpDir, $cleanupAction, $developerMode)); Utility_Files::init(new Utility_Files($magentoBaseDir)); /* Unset declared global variables to release PHPUnit from maintaining their values between tests */ unset($testsBaseDir, $testsTmpDir, $magentoBaseDir, $localXmlFile, $globalEtcFiles, $moduleEtcFiles, $eventManager);
$moduleEtcFiles = "../../../app/etc/modules/*.xml"; } $isCleanupEnabled = defined('TESTS_CLEANUP') && TESTS_CLEANUP == 'enabled'; $isDeveloperMode = defined('TESTS_MAGENTO_DEVELOPER_MODE') && TESTS_MAGENTO_DEVELOPER_MODE == 'enabled'; /* Enable profiler if necessary */ if (defined('TESTS_PROFILER_FILE') && TESTS_PROFILER_FILE) { $driver = new Magento_Profiler_Driver_Standard(); $driver->registerOutput(new Magento_Profiler_Driver_Standard_Output_Csvfile(array('baseDir' => $testsBaseDir, 'filePath' => TESTS_PROFILER_FILE))); Magento_Profiler::add($driver); } /* Enable profiler with bamboo friendly output format */ if (defined('TESTS_BAMBOO_PROFILER_FILE') && defined('TESTS_BAMBOO_PROFILER_METRICS_FILE')) { $driver = new Magento_Profiler_Driver_Standard(); $driver->registerOutput(new Magento_Test_Profiler_OutputBamboo(array('baseDir' => $testsBaseDir, 'filePath' => TESTS_BAMBOO_PROFILER_FILE, 'metrics' => require $testsBaseDir . DIRECTORY_SEPARATOR . TESTS_BAMBOO_PROFILER_METRICS_FILE))); Magento_Profiler::add($driver); } /* * Activate custom DocBlock annotations. * Note: order of registering (and applying) annotations is important. * To allow config fixtures to deal with fixture stores, data fixtures should be processed before config fixtures. */ $eventManager = new Magento_Test_EventManager(array(new Magento_Test_ClearProperties(), new Magento_Test_Annotation_AppIsolation(), new Magento_Test_Event_Transaction(new Magento_Test_EventManager(array(new Magento_Test_Annotation_DbIsolation(), new Magento_Test_Annotation_DataFixture("{$testsBaseDir}/testsuite")))), new Magento_Test_Annotation_ConfigFixture())); Magento_Test_Event_PhpUnit::setDefaultEventManager($eventManager); Magento_Test_Event_Magento::setDefaultEventManager($eventManager); /* Initialize object manager instance */ Mage::initializeObjectManager(null, new Magento_Test_ObjectManager()); /* Bootstrap the application */ Magento_Test_Bootstrap::setInstance(new Magento_Test_Bootstrap($magentoBaseDir, $testsBaseDir, $localXmlFile, $globalEtcFiles, $moduleEtcFiles, 'etc/integration-tests-config.xml', $testsTmpDir, new Magento_Shell(), $isCleanupEnabled, $isDeveloperMode)); Utility_Files::init(new Utility_Files($magentoBaseDir)); /* Unset declared global variables to release PHPUnit from maintaining their values between tests */ unset($testsBaseDir, $testsTmpDir, $magentoBaseDir, $localXmlFile, $globalEtcFiles, $moduleEtcFiles, $eventManager);
if (defined('TESTS_GLOBAL_CONFIG_FILES') && TESTS_GLOBAL_CONFIG_FILES) { $globalEtcFiles = TESTS_GLOBAL_CONFIG_FILES; } else { $globalEtcFiles = "../../../app/etc/*.xml"; } $globalEtcFiles .= ';etc/integration-tests-config.xml'; if (defined('TESTS_MODULE_CONFIG_FILES') && TESTS_MODULE_CONFIG_FILES) { $moduleEtcFiles = TESTS_MODULE_CONFIG_FILES; } else { $moduleEtcFiles = "../../../app/etc/modules/*.xml"; } $developerMode = false; if (defined('TESTS_MAGENTO_DEVELOPER_MODE') && TESTS_MAGENTO_DEVELOPER_MODE == 'enabled') { $developerMode = true; } Magento_Test_Bootstrap::setInstance(new Magento_Test_Bootstrap(realpath("{$baseDir}/../../../"), $localXmlFile, $globalEtcFiles, $moduleEtcFiles, "{$baseDir}/tmp", $cleanupAction, $developerMode)); /* Enable profiler if necessary */ if (defined('TESTS_PROFILER_FILE') && TESTS_PROFILER_FILE) { Magento_Profiler::registerOutput(new Magento_Profiler_Output_Csvfile($baseDir . DIRECTORY_SEPARATOR . TESTS_PROFILER_FILE)); } /* Enable profiler with bamboo friendly output format */ if (defined('TESTS_BAMBOO_PROFILER_FILE') && defined('TESTS_BAMBOO_PROFILER_METRICS_FILE')) { Magento_Profiler::registerOutput(new Magento_Test_Profiler_OutputBamboo($baseDir . DIRECTORY_SEPARATOR . TESTS_BAMBOO_PROFILER_FILE, require $baseDir . DIRECTORY_SEPARATOR . TESTS_BAMBOO_PROFILER_METRICS_FILE)); } /* Activate custom annotations in doc comments */ /* * Note: order of registering (and applying) annotations is important. * To allow config fixtures to deal with fixture stores, data fixtures should be processed before config fixtures. */ Magento_Test_Listener::registerObserver('Magento_Test_Listener_Annotation_Isolation'); Magento_Test_Listener::registerObserver('Magento_Test_Listener_Annotation_Fixture');