@@ -51,8 +51,6 @@ protected function configure()
5151 * @param OutputInterface $output
5252 * @return integer
5353 * @throws \Exception
54- *
55- * @SuppressWarnings(PHPMD.UnusedLocalVariable)
5654 */
5755 protected function execute (InputInterface $ input , OutputInterface $ output ): int
5856 {
@@ -86,26 +84,29 @@ protected function execute(InputInterface $input, OutputInterface $output): int
8684
8785 $ testConfigArray = json_decode ($ testConfiguration , true );
8886
89- // run tests not referenced in suites
90- $ this ->runTests ($ testConfigArray ['tests ' ], $ output );
87+ if (isset ($ testConfigArray ['tests ' ])) {
88+ $ this ->runTests ($ testConfigArray ['tests ' ], $ output );
89+ }
9190
92- // run tests in suites
93- $ this ->runTestsInSuite ($ testConfigArray ['suites ' ], $ output );
91+ if (isset ($ testConfigArray ['suites ' ])) {
92+ $ this ->runTestsInSuite ($ testConfigArray ['suites ' ], $ output );
93+ }
9494
9595 return $ this ->returnCode ;
96-
9796 }
9897
9998 /**
10099 * Run tests not referenced in suites
101- * @param array $testsConfig
100+ *
101+ * @param array $tests
102102 * @param OutputInterface $output
103+ * @return void
103104 * @throws TestFrameworkException
105+ *
106+ * @SuppressWarnings(PHPMD.UnusedLocalVariable)
104107 */
105- private function runTests ($ testsConfig , OutputInterface $ output ) {
106-
107-
108- $ tests = $ testsConfig ?? [];
108+ private function runTests (array $ tests , OutputInterface $ output )
109+ {
109110 $ codeceptionCommand = realpath (PROJECT_ROOT . '/vendor/bin/codecept ' ) . ' run functional ' ;
110111 $ testsDirectory = TESTS_MODULE_PATH .
111112 DIRECTORY_SEPARATOR .
@@ -135,17 +136,19 @@ private function runTests($testsConfig, OutputInterface $output) {
135136
136137 /**
137138 * Run tests referenced in suites within suites' context.
139+ *
138140 * @param array $suitesConfig
139141 * @param OutputInterface $output
142+ * @return void
143+ *
144+ * @SuppressWarnings(PHPMD.UnusedLocalVariable)
140145 */
141- private function runTestsInSuite ($ suitesConfig , OutputInterface $ output ) {
142-
143- $ suites = $ suitesConfig ?? [];
146+ private function runTestsInSuite (array $ suitesConfig , OutputInterface $ output )
147+ {
144148 $ codeceptionCommand = realpath (PROJECT_ROOT . '/vendor/bin/codecept ' ) . ' run functional --verbose --steps ' ;
145- $ testGroups = array_keys ($ suites );
146149 //for tests in suites, run them as a group to run before and after block
147- foreach ($ testGroups as $ testGroup ) {
148- $ fullCommand = $ codeceptionCommand . " -g {$ testGroup }" ;
150+ foreach (array_keys ( $ suitesConfig ) as $ suite ) {
151+ $ fullCommand = $ codeceptionCommand . " -g {$ suite }" ;
149152 $ process = new Process ($ fullCommand );
150153 $ process ->setWorkingDirectory (TESTS_BP );
151154 $ process ->setIdleTimeout (600 );
0 commit comments