Skip to content

Commit 61e6c27

Browse files
committed
MQE-1908: Change doctor command to work with Curl version of MagentoCLI
1 parent efed6e2 commit 61e6c27

File tree

2 files changed

+19
-9
lines changed

2 files changed

+19
-9
lines changed

src/Magento/FunctionalTestingFramework/Console/DoctorCommand.php

+11-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
namespace Magento\FunctionalTestingFramework\Console;
99

1010
use Codeception\Configuration;
11+
use Magento\FunctionalTestingFramework\Util\Path\UrlFormatter;
1112
use Symfony\Component\EventDispatcher\EventDispatcher;
1213
use Codeception\SuiteManager;
1314
use Magento\FunctionalTestingFramework\Config\MftfApplicationConfig;
@@ -128,9 +129,17 @@ private function checkAuthenticationToMagentoAdmin()
128129
$this->ioStyle->success('Successful');
129130
$result = true;
130131
} catch (TestFrameworkException $e) {
132+
if (getenv('MAGENTO_BACKEND_BASE_URL')) {
133+
$urlVar = 'MAGENTO_BACKEND_BASE_URL';
134+
} else {
135+
$urlVar = 'MAGENTO_BASE_URL';
136+
}
131137
$this->ioStyle->error(
132-
$e->getMessage()
133-
. "\nPlease verify MAGENTO_ADMIN_USERNAME and MAGENTO_ADMIN_PASSWORD in .env."
138+
$e->getMessage() . "\n"
139+
. "Please verify the following configuration settings in .env:\n"
140+
. $urlVar . ' = ' . getenv($urlVar) . "\n"
141+
. "MAGENTO_ADMIN_USERNAME = " . $e->getContext()['MAGENTO_ADMIN_USERNAME'] . "\n"
142+
. "MAGENTO_ADMIN_PASSWORD = " . $e->getContext()['MAGENTO_ADMIN_PASSWORD']
134143
);
135144
}
136145
return $result;

src/Magento/FunctionalTestingFramework/Module/MagentoWebDriverDoctor.php

+8-7
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616
class MagentoWebDriverDoctor extends MagentoWebDriver
1717
{
18-
const MAGENTO_CLI_COMMAND = 'list';
18+
const MAGENTO_CLI_COMMAND = 'info:currency:list';
1919
const EXCEPTION_CONTEXT_SELENIUM = 'selenium';
2020
const EXCEPTION_CONTEXT_ADMIN = 'admin';
2121
const EXCEPTION_CONTEXT_STOREFRONT = 'store';
@@ -150,18 +150,19 @@ private function loadPageAtUrl($url)
150150
private function runMagentoCLI()
151151
{
152152
try {
153-
$regex = '~^.*(?<name>Magento CLI).*[\r\n]+(?<usage>Usage:).*~';
153+
$regex = '~^.*[\r\n]+.*(?<name>Currency).*(?<code>Code).*~';
154154
$output = parent::magentoCLI(self::MAGENTO_CLI_COMMAND);
155155
preg_match($regex, $output, $matches);
156156

157-
if (isset($matches['name']) && isset($matches['usage'])) {
157+
if (isset($matches['name']) && isset($matches['code'])) {
158158
return;
159159
}
160160
} catch (\Exception $e) {
161-
throw new TestFrameworkException(
162-
"Failed to run Magento CLI command\n"
163-
. "Please reference Magento DevDoc to setup command.php and .htaccess files."
164-
);
165161
}
162+
163+
throw new TestFrameworkException(
164+
"Failed to run Magento CLI command\n"
165+
. "Please reference Magento DevDoc to setup command.php and .htaccess files."
166+
);
166167
}
167168
}

0 commit comments

Comments
 (0)