9 use Magento\Mtf\ObjectManagerInterface;
13 use Symfony\Component\Console\Input\InputInterface;
14 use Symfony\Component\Console\Output\OutputInterface;
33 private $objectManager;
47 ObjectManagerInterface $objectManager,
50 parent::__construct();
52 $this->urlAnalyzer = $urlAnalyzer;
63 $this->setName(
'troubleshooting:check-magento-admin')
64 ->setDescription(
'Check that app_backend_url is correct and admin can log in to Admin.');
75 protected function execute(InputInterface $input, OutputInterface $output)
77 \PHPUnit\Util\Configuration::getInstance(MTF_PHPUNIT_FILE)->handlePHPConfiguration();
78 $this->
output = $this->objectManager->create(
82 $this->
output->writeln(
"Verifying Magento Admin...");
84 if (isset($adminUrlAnalyzerMessages[
'error']) ===
false) {
85 $this->
output->outputMessages($this->urlAnalyzer->checkDomain($_ENV[
'app_backend_url']));
87 $this->
output->outputMessages($adminUrlAnalyzerMessages);
89 $this->
output->writeln(
"Admin verification finished.");
99 if (!isset($_ENV[
'app_backend_url'])) {
100 $messages[
'error'][] =
'app_backend_url parameter is absent in the phpunit.xml file. ' 101 .
'Please, copy parameter from phpunit.xml.dist.';
104 $this->
output->outputMessages($this->urlAnalyzer->fixLastSlash(
'app_backend_url'));
105 $url1 = $_ENV[
'app_backend_url'];
106 if (strpos($url1,
'/index.php') !==
false) {
107 $url2 = str_replace(
'/index.php',
'', $url1);
113 $urls = [$url1, $url2];
116 $_ENV[
'app_backend_url'] =
$url;
118 $config = \Magento\Mtf\ObjectManagerFactory::getObjectManager()->create(
123 if (strpos(
$response,
'404') !==
false) {
129 }
catch (\Exception $e) {
133 if ($isUrlValid ==
false) {
134 $messages[
'error'][] =
'Check correctness of app_backend_url in phpunit.xml.';
136 }
elseif ($url1 != $_ENV[
'app_backend_url']) {
137 return $this->urlAnalyzer->resolveIndexPhpProblem($_ENV[
'app_backend_url']);
output($string, $level=INFO, $label='')
execute(InputInterface $input, OutputInterface $output)
elseif(isset( $params[ 'redirect_parent']))
__construct(ObjectManagerInterface $objectManager, UrlAnalyzer $urlAnalyzer)