Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
13 changes: 11 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,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"
Copy link
Contributor

@soumyau soumyau Dec 6, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to avoid confusion with the display of invalid values, maybe just have this -
$this->ioStyle->error( $e->getMessage() . "\nPlease verify if " . $urlVar . ", " . "MAGENTO_ADMIN_USERNAME and MAGENTO_ADMIN_PASSWORD in .env are valid." );

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed.

. $urlVar . ' = ' . getenv($urlVar) . "\n"
. "MAGENTO_ADMIN_USERNAME = " . $e->getContext()['MAGENTO_ADMIN_USERNAME'] . "\n"
. "MAGENTO_ADMIN_PASSWORD = " . $e->getContext()['MAGENTO_ADMIN_PASSWORD']
);
}
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."
);
}
}