@@ -51,8 +51,6 @@ protected function configure()
51
51
* @param OutputInterface $output
52
52
* @return integer
53
53
* @throws \Exception
54
- *
55
- * @SuppressWarnings(PHPMD.UnusedLocalVariable)
56
54
*/
57
55
protected function execute (InputInterface $ input , OutputInterface $ output ): int
58
56
{
@@ -86,26 +84,29 @@ protected function execute(InputInterface $input, OutputInterface $output): int
86
84
87
85
$ testConfigArray = json_decode ($ testConfiguration , true );
88
86
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
+ }
91
90
92
- // run tests in suites
93
- $ this ->runTestsInSuite ($ testConfigArray ['suites ' ], $ output );
91
+ if (isset ($ testConfigArray ['suites ' ])) {
92
+ $ this ->runTestsInSuite ($ testConfigArray ['suites ' ], $ output );
93
+ }
94
94
95
95
return $ this ->returnCode ;
96
-
97
96
}
98
97
99
98
/**
100
99
* Run tests not referenced in suites
101
- * @param array $testsConfig
100
+ *
101
+ * @param array $tests
102
102
* @param OutputInterface $output
103
+ * @return void
103
104
* @throws TestFrameworkException
105
+ *
106
+ * @SuppressWarnings(PHPMD.UnusedLocalVariable)
104
107
*/
105
- private function runTests ($ testsConfig , OutputInterface $ output ) {
106
-
107
-
108
- $ tests = $ testsConfig ?? [];
108
+ private function runTests (array $ tests , OutputInterface $ output )
109
+ {
109
110
$ codeceptionCommand = realpath (PROJECT_ROOT . '/vendor/bin/codecept ' ) . ' run functional ' ;
110
111
$ testsDirectory = TESTS_MODULE_PATH .
111
112
DIRECTORY_SEPARATOR .
@@ -135,17 +136,19 @@ private function runTests($testsConfig, OutputInterface $output) {
135
136
136
137
/**
137
138
* Run tests referenced in suites within suites' context.
139
+ *
138
140
* @param array $suitesConfig
139
141
* @param OutputInterface $output
142
+ * @return void
143
+ *
144
+ * @SuppressWarnings(PHPMD.UnusedLocalVariable)
140
145
*/
141
- private function runTestsInSuite ($ suitesConfig , OutputInterface $ output ) {
142
-
143
- $ suites = $ suitesConfig ?? [];
146
+ private function runTestsInSuite (array $ suitesConfig , OutputInterface $ output )
147
+ {
144
148
$ codeceptionCommand = realpath (PROJECT_ROOT . '/vendor/bin/codecept ' ) . ' run functional --verbose --steps ' ;
145
- $ testGroups = array_keys ($ suites );
146
149
//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 }" ;
149
152
$ process = new Process ($ fullCommand );
150
153
$ process ->setWorkingDirectory (TESTS_BP );
151
154
$ process ->setIdleTimeout (600 );
0 commit comments