Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
UpgradeTestsCommand.php
Go to the documentation of this file.
1 <?php
2 // @codingStandardsIgnoreFile
7 declare(strict_types = 1);
8 
10 
13 use Symfony\Component\Console\Command\Command;
14 use Symfony\Component\Console\Input\InputInterface;
15 use Symfony\Component\Console\Input\InputArgument;
16 use Symfony\Component\Console\Output\OutputInterface;
17 
18 class UpgradeTestsCommand extends Command
19 {
25  private $upgradeScriptsList;
26 
32  protected function configure()
33  {
34  $this->setName('upgrade:tests')
35  ->setDescription('This command will upgrade all tests in the provided path according to new MFTF Major version requirements.')
36  ->addArgument('path', InputArgument::REQUIRED, 'path to MFTF tests to upgrade');
37  $this->upgradeScriptsList = new UpgradeScriptList();
38  }
39 
48  protected function execute(InputInterface $input, OutputInterface $output)
49  {
51  $upgradeScriptObjects = $this->upgradeScriptsList->getUpgradeScripts();
52  foreach ($upgradeScriptObjects as $upgradeScriptObject) {
53  $upgradeOutput = $upgradeScriptObject->execute($input);
54  LoggingUtil::getInstance()->getLogger(get_class($upgradeScriptObject))->info($upgradeOutput);
55  $output->writeln($upgradeOutput);
56  }
57  }
58 }