@@ -63,11 +63,12 @@ protected function execute(InputInterface $input, OutputInterface $output): int
6363 );
6464 }
6565
66+ $ testConfiguration = $ this ->getTestAndSuiteConfiguration ($ tests );
67+
6668 if (!$ skipGeneration ) {
67- $ testConfiguration = $ this ->getTestAndSuiteConfiguration ($ tests );
6869 $ command = $ this ->getApplication ()->find ('generate:tests ' );
6970 $ args = [
70- '--tests ' => json_encode ( $ testConfiguration) ,
71+ '--tests ' => $ testConfiguration ,
7172 '--force ' => $ force ,
7273 '--remove ' => $ remove ,
7374 '--debug ' => $ debug ,
@@ -76,20 +77,21 @@ protected function execute(InputInterface $input, OutputInterface $output): int
7677 $ command ->run (new ArrayInput ($ args ), $ output );
7778 }
7879 // tests with resolved suite references
79- $ resolvedTests = $ this ->getResolvedTests ($ testConfiguration );
80- $ returnCode = 0 ;
80+ $ resolvedTests = $ this ->resolveSuiteReferences ($ testConfiguration );
81+
8182 $ codeceptionCommand = realpath (PROJECT_ROOT . '/vendor/bin/codecept ' ) . ' run functional ' ;
8283 $ testsDirectory = TESTS_MODULE_PATH . DIRECTORY_SEPARATOR . TestGenerator::GENERATED_DIR . DIRECTORY_SEPARATOR ;
84+ $ returnCode = 0 ;
8385 //execute only tests specified as arguments in run command
8486 foreach ($ resolvedTests as $ test ) {
8587 //set directory as suite name for tests in suite, if not set to "default"
8688 if (strpos ($ test , ': ' )) {
87- list ($ suite , $ testName ) = explode (": " , $ test );
89+ list ($ testGroup , $ testName ) = explode (": " , $ test );
8890 } else {
89- list ($ suite , $ testName ) = [TestGenerator::DEFAULT_DIR , $ test ];
91+ list ($ testGroup , $ testName ) = [TestGenerator::DEFAULT_DIR , $ test ];
9092 }
91- $ testGroup = $ suite . DIRECTORY_SEPARATOR ;
92- $ testName .= 'Cest.php ' ;
93+ $ testGroup = $ testGroup . DIRECTORY_SEPARATOR ;
94+ $ testName = $ testName . 'Cest.php ' ;
9395 if (!realpath ($ testsDirectory . $ testGroup . $ testName )) {
9496 throw new TestFrameworkException (
9597 $ testName . " is not available under " . $ testsDirectory . $ testGroup
@@ -111,12 +113,13 @@ function ($type, $buffer) use ($output) {
111113 }
112114
113115 /** Get an array of tests with resolved suite references from $testConfiguration
114- * eg: if test is referenced in a suite, it'll be stored in format "SuiteName:Testname";
115- * @param array $testConfiguration
116+ * eg: if test is referenced in a suite, it'll be stored in format suite:test
117+ * @param $testConfigurationJson
116118 * @return array
117119 */
118- private function getResolvedTests ( array $ testConfiguration )
120+ private function resolveSuiteReferences ( $ testConfigurationJson )
119121 {
122+ $ testConfiguration = json_decode ($ testConfigurationJson , true );
120123 $ testsArray = $ testConfiguration ['tests ' ] ?? [];
121124 $ suitesArray = $ testConfiguration ['suites ' ] ?? [];
122125 $ testArrayBuilder = [];
0 commit comments