/** * Perform bootstrap actions required to completely setup the testing environment */ public function runBootstrap() { $this->_envBootstrap->emulateHttpRequest($_SERVER); $this->_envBootstrap->emulateSession($_SESSION); $profilerOutputFile = $this->_settings->getAsFile('TESTS_PROFILER_FILE'); if ($profilerOutputFile) { $this->_profilerBootstrap->registerFileProfiler($profilerOutputFile); } $profilerOutputFile = $this->_settings->getAsFile('TESTS_BAMBOO_PROFILER_FILE'); $profilerMetricsFile = $this->_settings->getAsFile('TESTS_BAMBOO_PROFILER_METRICS_FILE'); if ($profilerOutputFile && $profilerMetricsFile) { $this->_profilerBootstrap->registerBambooProfiler($profilerOutputFile, $profilerMetricsFile); } $memoryBootstrap = $this->_createMemoryBootstrap($this->_settings->get('TESTS_MEM_USAGE_LIMIT', 0), $this->_settings->get('TESTS_MEM_LEAK_LIMIT', 0)); $memoryBootstrap->activateStatsDisplaying(); $memoryBootstrap->activateLimitValidation(); $this->_docBlockBootstrap->registerAnnotations($this->_application); if ($this->_settings->getAsBoolean('TESTS_CLEANUP')) { $this->_application->cleanup(); } if ($this->_application->isInstalled()) { $this->_application->initialize(); } else { $this->_application->install(self::ADMIN_NAME, self::ADMIN_PASSWORD, self::ADMIN_ROLE_NAME); } }
public function testRunBootstrapProfilerEnabled() { $baseDir = $this->_integrationTestsDir; $this->_injectApplicationMock(array('TESTS_PROFILER_FILE' => 'profiler.csv', 'TESTS_BAMBOO_PROFILER_FILE' => 'profiler_bamboo.csv', 'TESTS_BAMBOO_PROFILER_METRICS_FILE' => 'profiler_metrics.php')); $this->_profilerBootstrap->expects($this->once())->method('registerFileProfiler')->with("{$baseDir}/profiler.csv"); $this->_profilerBootstrap->expects($this->once())->method('registerBambooProfiler')->with("{$baseDir}/profiler_bamboo.csv", "{$baseDir}/profiler_metrics.php"); $this->_object->runBootstrap(); }
public function testRunBootstrapProfilerEnabled() { $memoryBootstrap = $this->getMock('Magento\\TestFramework\\Bootstrap\\Memory', ['activateStatsDisplaying', 'activateLimitValidation'], [], '', false); $memoryBootstrap->expects($this->once())->method('activateStatsDisplaying'); $memoryBootstrap->expects($this->once())->method('activateLimitValidation'); $this->memoryFactory->expects($this->once())->method('create')->with(0, 0)->will($this->returnValue($memoryBootstrap)); $settingsMap = [['TESTS_PROFILER_FILE', '', 'profiler.csv'], ['TESTS_BAMBOO_PROFILER_FILE', '', 'profiler_bamboo.csv'], ['TESTS_BAMBOO_PROFILER_METRICS_FILE', '', 'profiler_metrics.php']]; $this->_settings->expects($this->any())->method('getAsFile')->will($this->returnValueMap($settingsMap)); $this->_profilerBootstrap->expects($this->once())->method('registerFileProfiler')->with("profiler.csv"); $this->_profilerBootstrap->expects($this->once())->method('registerBambooProfiler')->with("profiler_bamboo.csv", "profiler_metrics.php"); $this->_object->runBootstrap(); }
/** * Perform bootstrap actions required to completely setup the testing environment */ public function runBootstrap() { $this->_envBootstrap->emulateHttpRequest($_SERVER); $this->_envBootstrap->emulateSession($_SESSION); $profilerOutputFile = $this->_settings->getAsFile('TESTS_PROFILER_FILE'); if ($profilerOutputFile) { $this->_profilerBootstrap->registerFileProfiler($profilerOutputFile); } $profilerBambooOutputFile = $this->_settings->getAsFile('TESTS_BAMBOO_PROFILER_FILE'); $profilerBambooMetricsFile = $this->_settings->getAsFile('TESTS_BAMBOO_PROFILER_METRICS_FILE'); if ($profilerBambooOutputFile && $profilerBambooMetricsFile) { $this->_profilerBootstrap->registerBambooProfiler($profilerBambooOutputFile, $profilerBambooMetricsFile); } $memoryBootstrap = $this->memoryFactory->create($this->_settings->get('TESTS_MEM_USAGE_LIMIT', 0), $this->_settings->get('TESTS_MEM_LEAK_LIMIT', 0)); $memoryBootstrap->activateStatsDisplaying(); $memoryBootstrap->activateLimitValidation(); $this->_docBlockBootstrap->registerAnnotations($this->_application); }
public function testRegisterBambooProfiler() { $this->_driver->expects($this->once())->method('registerOutput')->with($this->isInstanceOf('Magento\\TestFramework\\Profiler\\OutputBamboo')); $this->_object->registerBambooProfiler('php://output', __DIR__ . '/_files/metrics.php'); }