コード例 #1
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);
 }
コード例 #2
0
 /**
  * Compose optimal order of scenarios, so that Magento reinstalls will be reduced among scenario executions
  *
  * @return array
  */
 protected function _getOptimizedScenarioList()
 {
     $optimizer = new \Magento\TestFramework\Performance\Testsuite\Optimizer();
     $scenarios = $this->_config->getScenarios();
     $fixtureSets = array();
     foreach ($scenarios as $scenario) {
         /** @var $scenario \Magento\TestFramework\Performance\Scenario */
         $fixtureSets[] = $scenario->getFixtures();
     }
     $keys = $optimizer->optimizeFixtureSets($fixtureSets);
     $result = array();
     foreach ($keys as $key) {
         $result[] = $scenarios[$key];
     }
     return $result;
 }
コード例 #3
0
 /**
  * Install application according to installation options
  *
  * @return \Magento\TestFramework\Application
  * @throws \Magento\Framework\Exception
  */
 protected function _install()
 {
     $installOptions = $this->_config->getInstallOptions();
     $installOptionsNoValue = $this->_config->getInstallOptionsNoValue();
     if (!$installOptions) {
         throw new \Magento\Framework\Exception('Trying to install Magento, but installation options are not set');
     }
     // Populate install options with global options
     $baseUrl = 'http://' . $this->_config->getApplicationUrlHost() . $this->_config->getApplicationUrlPath();
     $installOptions = array_merge($installOptions, ['base_url' => $baseUrl, 'base_url_secure' => $baseUrl]);
     $installCmd = 'php -f %s install';
     $installCmdArgs = [$this->_script];
     foreach ($installOptions as $optionName => $optionValue) {
         $installCmd .= " --{$optionName}=%s";
         $installCmdArgs[] = $optionValue;
     }
     foreach ($installOptionsNoValue as $optionName) {
         $installCmd .= " --{$optionName}";
     }
     $this->_shell->execute($installCmd, $installCmdArgs);
     $this->_isInstalled = true;
     $this->_fixtures = [];
     return $this;
 }
コード例 #4
0
 /**
  * Install application according to installation options
  *
  * @return \Magento\TestFramework\Application
  * @throws \Magento\Framework\Exception
  */
 protected function _install()
 {
     $installOptions = $this->_config->getInstallOptions();
     if (!$installOptions) {
         throw new \Magento\Framework\Exception('Trying to install Magento, but installation options are not set');
     }
     // Populate install options with global options
     $baseUrl = 'http://' . $this->_config->getApplicationUrlHost() . $this->_config->getApplicationUrlPath();
     $installOptions = array_merge($installOptions, array('url' => $baseUrl, 'secure_base_url' => $baseUrl));
     $adminOptions = $this->_config->getAdminOptions();
     foreach ($adminOptions as $key => $val) {
         $installOptions['admin_' . $key] = $val;
     }
     $installCmd = 'php -f %s --';
     $installCmdArgs = array($this->_installerScript);
     foreach ($installOptions as $optionName => $optionValue) {
         $installCmd .= " --{$optionName} %s";
         $installCmdArgs[] = $optionValue;
     }
     $this->_shell->execute($installCmd, $installCmdArgs);
     $this->_isInstalled = true;
     $this->_fixtures = array();
     return $this;
 }
コード例 #5
0
ファイル: ConfigTest.php プロジェクト: nja78/magento2
 public function testGetReportDir()
 {
     $expectedReportDir = __DIR__ . '/_files/report';
     $this->assertEquals($expectedReportDir, $this->_object->getReportDir());
 }