From 61e6c2713697b7ba2bcc1c3ecc6ca772535862e9 Mon Sep 17 00:00:00 2001 From: Ji Lu Date: Fri, 6 Dec 2019 12:32:16 -0600 Subject: [PATCH 1/2] MQE-1908: Change doctor command to work with Curl version of MagentoCLI --- .../Console/DoctorCommand.php | 13 +++++++++++-- .../Module/MagentoWebDriverDoctor.php | 15 ++++++++------- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/src/Magento/FunctionalTestingFramework/Console/DoctorCommand.php b/src/Magento/FunctionalTestingFramework/Console/DoctorCommand.php index 4bd05b836..0b144aabc 100644 --- a/src/Magento/FunctionalTestingFramework/Console/DoctorCommand.php +++ b/src/Magento/FunctionalTestingFramework/Console/DoctorCommand.php @@ -8,6 +8,7 @@ namespace Magento\FunctionalTestingFramework\Console; use Codeception\Configuration; +use Magento\FunctionalTestingFramework\Util\Path\UrlFormatter; use Symfony\Component\EventDispatcher\EventDispatcher; use Codeception\SuiteManager; use Magento\FunctionalTestingFramework\Config\MftfApplicationConfig; @@ -128,9 +129,17 @@ private function checkAuthenticationToMagentoAdmin() $this->ioStyle->success('Successful'); $result = true; } catch (TestFrameworkException $e) { + if (getenv('MAGENTO_BACKEND_BASE_URL')) { + $urlVar = 'MAGENTO_BACKEND_BASE_URL'; + } else { + $urlVar = 'MAGENTO_BASE_URL'; + } $this->ioStyle->error( - $e->getMessage() - . "\nPlease verify MAGENTO_ADMIN_USERNAME and MAGENTO_ADMIN_PASSWORD in .env." + $e->getMessage() . "\n" + . "Please verify the following configuration settings in .env:\n" + . $urlVar . ' = ' . getenv($urlVar) . "\n" + . "MAGENTO_ADMIN_USERNAME = " . $e->getContext()['MAGENTO_ADMIN_USERNAME'] . "\n" + . "MAGENTO_ADMIN_PASSWORD = " . $e->getContext()['MAGENTO_ADMIN_PASSWORD'] ); } return $result; diff --git a/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriverDoctor.php b/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriverDoctor.php index 98eb8bd4f..1407c957b 100644 --- a/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriverDoctor.php +++ b/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriverDoctor.php @@ -15,7 +15,7 @@ */ class MagentoWebDriverDoctor extends MagentoWebDriver { - const MAGENTO_CLI_COMMAND = 'list'; + const MAGENTO_CLI_COMMAND = 'info:currency:list'; const EXCEPTION_CONTEXT_SELENIUM = 'selenium'; const EXCEPTION_CONTEXT_ADMIN = 'admin'; const EXCEPTION_CONTEXT_STOREFRONT = 'store'; @@ -150,18 +150,19 @@ private function loadPageAtUrl($url) private function runMagentoCLI() { try { - $regex = '~^.*(?Magento CLI).*[\r\n]+(?Usage:).*~'; + $regex = '~^.*[\r\n]+.*(?Currency).*(?Code).*~'; $output = parent::magentoCLI(self::MAGENTO_CLI_COMMAND); preg_match($regex, $output, $matches); - if (isset($matches['name']) && isset($matches['usage'])) { + if (isset($matches['name']) && isset($matches['code'])) { return; } } catch (\Exception $e) { - throw new TestFrameworkException( - "Failed to run Magento CLI command\n" - . "Please reference Magento DevDoc to setup command.php and .htaccess files." - ); } + + throw new TestFrameworkException( + "Failed to run Magento CLI command\n" + . "Please reference Magento DevDoc to setup command.php and .htaccess files." + ); } } From a243dbdfb2cdfad597f3be78c9b872edc30bd195 Mon Sep 17 00:00:00 2001 From: Ji Lu Date: Fri, 6 Dec 2019 15:35:08 -0600 Subject: [PATCH 2/2] MQE-1908: Change doctor command to work with Curl version of MagentoCLI --- .../FunctionalTestingFramework/Console/DoctorCommand.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/Magento/FunctionalTestingFramework/Console/DoctorCommand.php b/src/Magento/FunctionalTestingFramework/Console/DoctorCommand.php index 0b144aabc..6fc9afa55 100644 --- a/src/Magento/FunctionalTestingFramework/Console/DoctorCommand.php +++ b/src/Magento/FunctionalTestingFramework/Console/DoctorCommand.php @@ -135,11 +135,8 @@ private function checkAuthenticationToMagentoAdmin() $urlVar = 'MAGENTO_BASE_URL'; } $this->ioStyle->error( - $e->getMessage() . "\n" - . "Please verify the following configuration settings in .env:\n" - . $urlVar . ' = ' . getenv($urlVar) . "\n" - . "MAGENTO_ADMIN_USERNAME = " . $e->getContext()['MAGENTO_ADMIN_USERNAME'] . "\n" - . "MAGENTO_ADMIN_PASSWORD = " . $e->getContext()['MAGENTO_ADMIN_PASSWORD'] + $e->getMessage() . "\nPlease verify if " . $urlVar . ", " + . "MAGENTO_ADMIN_USERNAME and MAGENTO_ADMIN_PASSWORD in .env are valid." ); } return $result;