@@ -102,8 +102,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int
102
102
* @param OutputInterface $output
103
103
* @return void
104
104
* @throws TestFrameworkException
105
- *
106
- * @SuppressWarnings(PHPMD.UnusedLocalVariable)
107
105
*/
108
106
private function runTests (array $ tests , OutputInterface $ output )
109
107
{
@@ -123,14 +121,7 @@ private function runTests(array $tests, OutputInterface $output)
123
121
);
124
122
}
125
123
$ fullCommand = $ codeceptionCommand . $ testsDirectory . $ testName . ' --verbose --steps ' ;
126
- $ process = new Process ($ fullCommand );
127
- $ process ->setWorkingDirectory (TESTS_BP );
128
- $ process ->setIdleTimeout (600 );
129
- $ process ->setTimeout (0 );
130
- $ subReturnCode = $ process ->run (function ($ type , $ buffer ) use ($ output ) {
131
- $ output ->write ($ buffer );
132
- });
133
- $ this ->returnCode = max ($ this ->returnCode , $ subReturnCode );
124
+ $ this ->returnCode = max ($ this ->returnCode , $ this ->executeTestCommand ($ fullCommand , $ output ));
134
125
}
135
126
}
136
127
@@ -140,23 +131,34 @@ private function runTests(array $tests, OutputInterface $output)
140
131
* @param array $suitesConfig
141
132
* @param OutputInterface $output
142
133
* @return void
143
- *
144
- * @SuppressWarnings(PHPMD.UnusedLocalVariable)
145
134
*/
146
135
private function runTestsInSuite (array $ suitesConfig , OutputInterface $ output )
147
136
{
148
137
$ codeceptionCommand = realpath (PROJECT_ROOT . '/vendor/bin/codecept ' ) . ' run functional --verbose --steps ' ;
149
138
//for tests in suites, run them as a group to run before and after block
150
139
foreach (array_keys ($ suitesConfig ) as $ suite ) {
151
140
$ fullCommand = $ codeceptionCommand . " -g {$ suite }" ;
152
- $ process = new Process ($ fullCommand );
153
- $ process ->setWorkingDirectory (TESTS_BP );
154
- $ process ->setIdleTimeout (600 );
155
- $ process ->setTimeout (0 );
156
- $ subReturnCode = $ process ->run (function ($ type , $ buffer ) use ($ output ) {
157
- $ output ->write ($ buffer );
158
- });
159
- $ this ->returnCode = max ($ this ->returnCode , $ subReturnCode );
141
+ $ this ->returnCode = max ($ this ->returnCode , $ this ->executeTestCommand ($ fullCommand , $ output ));
160
142
}
161
143
}
144
+
145
+ /**
146
+ * Runs the codeception test command and returns exit code
147
+ *
148
+ * @param String $command
149
+ * @param OutputInterface $output
150
+ * @return int
151
+ *
152
+ * @SuppressWarnings(PHPMD.UnusedLocalVariable)
153
+ */
154
+ private function executeTestCommand (String $ command , OutputInterface $ output )
155
+ {
156
+ $ process = new Process ($ command );
157
+ $ process ->setWorkingDirectory (TESTS_BP );
158
+ $ process ->setIdleTimeout (600 );
159
+ $ process ->setTimeout (0 );
160
+ return $ process ->run (function ($ type , $ buffer ) use ($ output ) {
161
+ $ output ->write ($ buffer );
162
+ });
163
+ }
162
164
}
0 commit comments