9 use Magento\Mtf\ObjectManagerInterface;
10 use Symfony\Component\Console\Input\InputInterface;
11 use Symfony\Component\Console\Output\OutputInterface;
23 private $objectManager;
28 public function __construct(ObjectManagerInterface $objectManager)
30 parent::__construct();
42 $this->setName(
'troubleshooting:check-phpunit-config-file')
43 ->setDescription(
'Check if phpunit file is available.');
56 $output = $this->objectManager->create(
60 $output->writeln(
"Checking phpunit.xml file availability...");
62 $configFileExists =
false;
63 if (file_exists(MTF_PHPUNIT_FILE)) {
64 $configFileExists =
true;
66 if (file_exists(MTF_PHPUNIT_FILE .
'.dist')) {
67 if (!copy(MTF_PHPUNIT_FILE .
'.dist', MTF_PHPUNIT_FILE)) {
68 $messages[
'error'][] =
'Failed to copy phpunit.xml.dist to phpunit.xml.';
70 $messages[
'info'][] =
'phpunit.xml file has been created based on phpunit.xml.dist. ' 71 .
'Please, adjust your PHPUnit configuration to use new file.';
72 $configFileExists =
true;
76 if (!$configFileExists) {
77 $messages[
'error'][] =
'Cannot define phpunit configuration path.';
79 $output->outputMessages($messages);
80 $output->writeln(
"phpunit.xml check finished.");
execute(InputInterface $input, OutputInterface $output)
__construct(ObjectManagerInterface $objectManager)