Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Protected Member Functions
PhpUnitAnalyzer Class Reference
Inheritance diagram for PhpUnitAnalyzer:

Public Member Functions

 __construct (ObjectManagerInterface $objectManager)
 

Protected Member Functions

 configure ()
 
 execute (InputInterface $input, OutputInterface $output)
 

Detailed Description

PHPUnit analyzer based on the URL specified in the phpunit.xml.

Definition at line 16 of file PhpUnitAnalyzer.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( ObjectManagerInterface  $objectManager)
Parameters
ObjectManagerInterface$objectManager

Definition at line 28 of file PhpUnitAnalyzer.php.

29  {
30  parent::__construct();
31  $this->objectManager = $objectManager;
32  }
$objectManager
Definition: bootstrap.php:17

Member Function Documentation

◆ configure()

configure ( )
protected

Configure command.

Returns
void

Definition at line 39 of file PhpUnitAnalyzer.php.

40  {
41  parent::configure();
42  $this->setName('troubleshooting:check-phpunit-config-file')
43  ->setDescription('Check if phpunit file is available.');
44  }

◆ execute()

execute ( InputInterface  $input,
OutputInterface  $output 
)
protected

Execute command for checkout phpunit.xml config file availability.

Parameters
InputInterface$input
OutputInterface$output
Returns
void @SuppressWarnings(PHPMD.UnusedFormalParameter)

Definition at line 54 of file PhpUnitAnalyzer.php.

55  {
56  $output = $this->objectManager->create(
57  \Magento\Mtf\Console\Output::class,
58  ['output' => $output]
59  );
60  $output->writeln("Checking phpunit.xml file availability...");
61  $messages = [];
62  $configFileExists = false;
63  if (file_exists(MTF_PHPUNIT_FILE)) {
64  $configFileExists = true;
65  } else {
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.';
69  } else {
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;
73  }
74  }
75  }
76  if (!$configFileExists) {
77  $messages['error'][] = 'Cannot define phpunit configuration path.';
78  }
79  $output->outputMessages($messages);
80  $output->writeln("phpunit.xml check finished.");
81  }

The documentation for this class was generated from the following file: