mftf 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #!/usr/bin/env php
  2. <?php
  3. /**
  4. * Copyright © Magento, Inc. All rights reserved.
  5. * See COPYING.txt for license details.
  6. */
  7. if (PHP_SAPI !== 'cli') {
  8. echo 'bin/mftf must be run as a CLI application';
  9. exit(1);
  10. }
  11. $autoloadPath = realpath(__DIR__ . '/../../../autoload.php');
  12. $testBootstrapPath = realpath(__DIR__ . '/../dev/tests/functional/standalone_bootstrap.php');
  13. try {
  14. if (file_exists($autoloadPath)) {
  15. require_once $autoloadPath;
  16. } else {
  17. require_once $testBootstrapPath;
  18. }
  19. } catch (\Exception $e) {
  20. echo 'Autoload error: ' . $e->getMessage();
  21. exit(1);
  22. }
  23. try {
  24. $application = new Symfony\Component\Console\Application();
  25. $application->setName('Magento Functional Testing Framework CLI');
  26. $application->setVersion('2.3.14');
  27. /** @var \Magento\FunctionalTestingFramework\Console\CommandListInterface $commandList */
  28. $commandList = new \Magento\FunctionalTestingFramework\Console\CommandList;
  29. foreach ($commandList->getCommands() as $command) {
  30. $application->add($command);
  31. }
  32. $application->run();
  33. } catch (\Exception $e) {
  34. while ($e) {
  35. echo $e->getMessage();
  36. echo $e->getTraceAsString();
  37. echo "\n\n";
  38. $e = $e->getPrevious();
  39. }
  40. exit(1);
  41. }