9 use Magento\Mtf\ObjectManagerInterface;
10 use Magento\Mtf\Util\Protocol\CurlInterface;
12 use Symfony\Component\Console\Input\InputInterface;
13 use Symfony\Component\Console\Output\OutputInterface;
25 private $objectManager;
32 private $commandPath =
'dev/tests/functional/utils/command.php?command=';
46 ObjectManagerInterface $objectManager,
49 parent::__construct();
62 $this->setName(
'troubleshooting:check-htaccess')
63 ->setDescription(
'Check .htaccess file is present. It is needed to run cli commands via browser url.');
76 \PHPUnit\Util\Configuration::getInstance(MTF_PHPUNIT_FILE)->handlePHPConfiguration();
77 $output = $this->objectManager->create(
82 $output->writeln(
"Checking .htaccess file...");
83 $this->curl->write($_ENV[
'app_frontend_url'] . $this->commandPath, [], CurlInterface::GET);
85 $responseCode = $this->curl->getInfo(CURLINFO_HTTP_CODE);
86 if ($responseCode != 200) {
87 $message[
'error'][] =
'Your .htaccess file doesn\'t exist. ' 88 .
'Please, create it from to .htaccess.sample.';
92 }
catch (\Exception $e) {
93 $output->outputMessages([
'error' => [$e->getMessage()]]);
95 $output->writeln(
".htaccess check finished.");
__construct(ObjectManagerInterface $objectManager, CurlTransport $curl)
execute(InputInterface $input, OutputInterface $output)