@@ -24,6 +24,10 @@ class DoctorCommand extends Command
24
24
const CODECEPTION_AUTOLOAD_FILE = PROJECT_ROOT . '/vendor/codeception/codeception/autoload.php ' ;
25
25
const MFTF_CODECEPTION_CONFIG_FILE = ENV_FILE_PATH . 'codeception.yml ' ;
26
26
const SUITE = 'functional ' ;
27
+ const COLOR_LIGHT_GREEN = "\e[1;32m " ;
28
+ const COLOR_LIGHT_RED = "\e[1;31m " ;
29
+ const COLOR_LIGHT_DEFAULT = "\e[1;39m " ;
30
+ const COLOR_RESTORE = "\e[0m " ;
27
31
28
32
/**
29
33
* Command Output
@@ -60,6 +64,7 @@ protected function configure()
60
64
* @return integer
61
65
* @throws TestFrameworkException
62
66
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
67
+ * @SuppressWarnings(PHPMD.CyclomaticComplexity)
63
68
*/
64
69
protected function execute (InputInterface $ input , OutputInterface $ output )
65
70
{
@@ -109,11 +114,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
109
114
);
110
115
$ cmdStatus = $ cmdStatus && !$ status ? false : $ cmdStatus ;
111
116
112
- if ($ cmdStatus ) {
113
- return 0 ;
114
- } else {
115
- return 1 ;
116
- }
117
+ return $ cmdStatus ? 0 : 1 ;
117
118
}
118
119
119
120
/**
@@ -125,12 +126,14 @@ private function checkAuthenticationToMagentoAdmin()
125
126
{
126
127
$ result = false ;
127
128
try {
128
- $ this ->output ->writeln ("\nAuthenticating admin account by API ... " );
129
+ $ this ->output ->writeln (
130
+ "\n" . self ::COLOR_LIGHT_DEFAULT . "Authenticating admin account by API ... " . self ::COLOR_RESTORE
131
+ );
129
132
ModuleResolver::getInstance ()->getAdminToken ();
130
- $ this ->output ->writeln ('Successful ' );
133
+ $ this ->output ->writeln (self :: COLOR_LIGHT_GREEN . 'Successful ' . self :: COLOR_RESTORE );
131
134
$ result = true ;
132
135
} catch (TestFrameworkException $ e ) {
133
- $ this ->output ->writeln ($ e ->getMessage ());
136
+ $ this ->output ->writeln (self :: COLOR_LIGHT_RED . $ e ->getMessage () . self :: COLOR_RESTORE );
134
137
}
135
138
return $ result ;
136
139
}
@@ -145,14 +148,14 @@ private function checkAuthenticationToMagentoAdmin()
145
148
*/
146
149
private function checkContextOnStep ($ exceptionType , $ message )
147
150
{
148
- $ this ->output ->writeln ("\n$ message ... " );
151
+ $ this ->output ->writeln ("\n" . self :: COLOR_LIGHT_DEFAULT . $ message . self :: COLOR_RESTORE );
149
152
$ this ->runMagentoWebDriverDoctor ();
150
153
151
154
if (isset ($ this ->context [$ exceptionType ])) {
152
- $ this ->output ->write ( $ this ->context [$ exceptionType ] . "\n" );
155
+ $ this ->output ->writeln ( self :: COLOR_LIGHT_RED . $ this ->context [$ exceptionType ] . self :: COLOR_RESTORE );
153
156
return false ;
154
157
} else {
155
- $ this ->output ->writeln ('Successful ' );
158
+ $ this ->output ->writeln (self :: COLOR_LIGHT_GREEN . 'Successful ' . self :: COLOR_RESTORE );
156
159
return true ;
157
160
}
158
161
}
0 commit comments