/** * Ensure reports directory exists, empty, and has write permissions * * @throws Magento_Exception */ public function cleanupReports() { $reportDir = $this->_config->getReportDir(); if (file_exists($reportDir) && !Varien_Io_File::rmdirRecursive($reportDir)) { throw new Magento_Exception("Cannot cleanup reports directory '{$reportDir}'."); } mkdir($reportDir, 0777, true); }
/** * Constructor * * @param Magento_Performance_Config $config * @param Magento_Shell $shell * @throws Magento_Exception */ public function __construct(Magento_Performance_Config $config, Magento_Shell $shell) { $installerScript = $config->getApplicationBaseDir() . '/dev/shell/install.php'; if (!is_file($installerScript)) { throw new Magento_Exception("File '{$installerScript}' is not found."); } $this->_installerScript = realpath($installerScript); $this->_config = $config; $this->_shell = $shell; }
/** * Compose optimal list of scenarios, so that Magento reinstalls will be reduced among scenario executions * * @return array */ protected function _getOptimizedScenarioList() { $optimizer = new Magento_Performance_Testsuite_Optimizer(); $scenarios = array(); foreach ($this->_config->getScenarios() as $scenarioFile) { $scenarios[$scenarioFile] = $this->_config->getScenarioFixtures($scenarioFile); } return $optimizer->run($scenarios); }
/** * Compose optimal order of scenarios, so that Magento reinstalls will be reduced among scenario executions * * @return array */ protected function _getOptimizedScenarioList() { $optimizer = new Magento_Performance_Testsuite_Optimizer(); $scenarios = $this->_config->getScenarios(); $fixtureSets = array(); foreach ($scenarios as $scenario) { /** @var $scenario Magento_Performance_Scenario */ $fixtureSets[] = $scenario->getFixtures(); } $keys = $optimizer->optimizeFixtureSets($fixtureSets); $result = array(); foreach ($keys as $key) { $result[] = $scenarios[$key]; } return $result; }
public function testGetReportDir() { $expectedReportDir = __DIR__ . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'report'; $this->assertEquals($expectedReportDir, $this->_object->getReportDir()); }