@@ -59,14 +59,14 @@ protected function configure()
59
59
* @param OutputInterface $output
60
60
* @return integer
61
61
* @throws TestFrameworkException
62
- * @SuppressWarnings(PHPMD.UnusedFormalParameter)
63
62
*/
64
63
protected function execute (InputInterface $ input , OutputInterface $ output )
65
64
{
66
65
$ cmdStatus = true ;
67
66
68
67
// Config application
69
68
$ verbose = $ output ->isVerbose ();
69
+ $ this ->input = $ input ;
70
70
$ this ->output = $ output ;
71
71
MftfApplicationConfig::create (
72
72
false ,
@@ -81,11 +81,31 @@ protected function execute(InputInterface $input, OutputInterface $output)
81
81
$ cmdStatus = $ cmdStatus && !$ status ? false : $ cmdStatus ;
82
82
83
83
// Check connection to Selenium
84
- $ status = $ this ->checkConnectionToSeleniumServer ();
84
+ $ status = $ this ->checkOnStep (
85
+ MagentoWebDriverDoctor::EXCEPTION_TYPE_SELENIUM ,
86
+ 'Checking connection to Selenium Server '
87
+ );
88
+ $ cmdStatus = $ cmdStatus && !$ status ? false : $ cmdStatus ;
89
+
90
+ // Check opening Magento Admin in web browser
91
+ $ status = $ this ->checkOnStep (
92
+ MagentoWebDriverDoctor::EXCEPTION_TYPE_MAGENTO_ADMIN ,
93
+ 'Checking opening Magento Admin in web browser controlled by Selenium '
94
+ );
95
+ $ cmdStatus = $ cmdStatus && !$ status ? false : $ cmdStatus ;
96
+
97
+ // Check opening Magento Storefront in web browser
98
+ $ status = $ this ->checkOnStep (
99
+ MagentoWebDriverDoctor::EXCEPTION_TYPE_MAGENTO_STOREFRONT ,
100
+ 'Checking opening Magento Storefront in web browser controlled by Selenium '
101
+ );
85
102
$ cmdStatus = $ cmdStatus && !$ status ? false : $ cmdStatus ;
86
103
87
104
// Check access to Magento CLI
88
- $ status = $ this ->checkAccessToMagentoCLI ();
105
+ $ status = $ this ->checkOnStep (
106
+ MagentoWebDriverDoctor::EXCEPTION_TYPE_MAGENTO_CLI ,
107
+ 'Checking access to Magento CLI '
108
+ );
89
109
$ cmdStatus = $ cmdStatus && !$ status ? false : $ cmdStatus ;
90
110
91
111
if ($ cmdStatus ) {
@@ -115,38 +135,18 @@ private function checkAuthenticationToMagentoAdmin()
115
135
}
116
136
117
137
/**
118
- * Check Connection to Selenium Server
119
- *
120
- * @return boolean
121
- */
122
- private function checkConnectionToSeleniumServer ()
123
- {
124
- // Check connection to Selenium through Codeception
125
- $ this ->output ->writeln ("\nChecking connection to Selenium Server ... " );
126
- $ this ->runMagentoWebDriverDoctor ();
127
-
128
- if (isset ($ this ->context [MagentoWebDriverDoctor::EXCEPTION_TYPE_SELENIUM ])) {
129
- $ this ->output ->write ($ this ->context [MagentoWebDriverDoctor::EXCEPTION_TYPE_SELENIUM ] . "\n" );
130
- return false ;
131
- } else {
132
- $ this ->output ->writeln ('Successful ' );
133
- return true ;
134
- }
135
- }
136
-
137
- /**
138
- * Check access to Magento CLI setup
138
+ * Check on a step context after runMagentoWebDriverDoctor
139
139
*
140
140
* @return boolean
141
+ * @throws TestFrameworkException
141
142
*/
142
- private function checkAccessToMagentoCLI ( )
143
+ private function checkOnStep ( $ exceptionType , $ message )
143
144
{
144
- // Check Magento CLI setup
145
- $ this ->output ->writeln ("\nChecking access to Magento CLI ... " );
145
+ $ this ->output ->writeln ("\n$ message ... " );
146
146
$ this ->runMagentoWebDriverDoctor ();
147
147
148
- if (isset ($ this ->context [MagentoWebDriverDoctor:: EXCEPTION_TYPE_MAGENTO_CLI ])) {
149
- $ this ->output ->write ($ this ->context [MagentoWebDriverDoctor:: EXCEPTION_TYPE_MAGENTO_CLI ] . "\n" );
148
+ if (isset ($ this ->context [$ exceptionType ])) {
149
+ $ this ->output ->write ($ this ->context [$ exceptionType ] . "\n" );
150
150
return false ;
151
151
} else {
152
152
$ this ->output ->writeln ('Successful ' );
@@ -158,6 +158,7 @@ private function checkAccessToMagentoCLI()
158
158
* Run diagnose through MagentoWebDriverDoctor
159
159
*
160
160
* @return void
161
+ * @throws TestFrameworkException
161
162
*/
162
163
private function runMagentoWebDriverDoctor ()
163
164
{
0 commit comments