Skip to content

MQE-1908: Change doctor command to work with Curl version of MagentoCLI #526

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/Magento/FunctionalTestingFramework/Console/DoctorCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -128,9 +129,14 @@ 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() . "\nPlease verify if " . $urlVar . ", "
. "MAGENTO_ADMIN_USERNAME and MAGENTO_ADMIN_PASSWORD in .env are valid."
);
}
return $result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -150,18 +150,19 @@ private function loadPageAtUrl($url)
private function runMagentoCLI()
{
try {
$regex = '~^.*(?<name>Magento CLI).*[\r\n]+(?<usage>Usage:).*~';
$regex = '~^.*[\r\n]+.*(?<name>Currency).*(?<code>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."
);
}
}