Configuration.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Mtf\Troubleshooting;
  7. use Magento\Mtf\App\State\State1;
  8. use Magento\Mtf\ObjectManagerInterface;
  9. use Symfony\Component\Console\Input\InputInterface;
  10. use Symfony\Component\Console\Output\OutputInterface;
  11. /**
  12. * Analyze Magento configuration.
  13. */
  14. class Configuration extends \Symfony\Component\Console\Command\Command
  15. {
  16. /**
  17. * Object manager instance.
  18. *
  19. * @var ObjectManagerInterface
  20. */
  21. private $objectManager;
  22. /**
  23. * Example Application State class.
  24. *
  25. * @var State1
  26. */
  27. private $state1;
  28. /**
  29. * @param ObjectManagerInterface $objectManager
  30. * @param State1 $state1
  31. */
  32. public function __construct(
  33. ObjectManagerInterface $objectManager,
  34. State1 $state1
  35. ) {
  36. parent::__construct();
  37. $this->objectManager = $objectManager;
  38. $this->state1 = $state1;
  39. }
  40. /**
  41. * Configure command.
  42. *
  43. * @return void
  44. */
  45. protected function configure()
  46. {
  47. parent::configure();
  48. $this->setName('troubleshooting:apply-magento-configuration')
  49. ->setDescription('Apply proper Magento configuration to run functional tests.');
  50. }
  51. /**
  52. * Execute command.
  53. *
  54. * @param InputInterface $input
  55. * @param OutputInterface $output
  56. * @return void
  57. * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  58. */
  59. protected function execute(InputInterface $input, OutputInterface $output)
  60. {
  61. $output = $this->objectManager->create(
  62. \Magento\Mtf\Console\Output::class,
  63. ['output' => $output]
  64. );
  65. $output->writeln("Applying Magento configuration...");
  66. $this->state1->apply();
  67. $output->outputMessages(
  68. ['info' => ['Magento configuration was updated in order to run functional tests without errors '
  69. . '(disabled WYSIWYG, enabled admin account sharing etc.).']
  70. ]
  71. );
  72. }
  73. }