@@ -63,11 +63,12 @@ protected function execute(InputInterface $input, OutputInterface $output): int
63
63
);
64
64
}
65
65
66
+ $ testConfiguration = $ this ->getTestAndSuiteConfiguration ($ tests );
67
+
66
68
if (!$ skipGeneration ) {
67
- $ testConfiguration = $ this ->getTestAndSuiteConfiguration ($ tests );
68
69
$ command = $ this ->getApplication ()->find ('generate:tests ' );
69
70
$ args = [
70
- '--tests ' => json_encode ( $ testConfiguration) ,
71
+ '--tests ' => $ testConfiguration ,
71
72
'--force ' => $ force ,
72
73
'--remove ' => $ remove ,
73
74
'--debug ' => $ debug ,
@@ -76,20 +77,21 @@ protected function execute(InputInterface $input, OutputInterface $output): int
76
77
$ command ->run (new ArrayInput ($ args ), $ output );
77
78
}
78
79
// tests with resolved suite references
79
- $ resolvedTests = $ this ->getResolvedTests ($ testConfiguration );
80
- $ returnCode = 0 ;
80
+ $ resolvedTests = $ this ->resolveSuiteReferences ($ testConfiguration );
81
+
81
82
$ codeceptionCommand = realpath (PROJECT_ROOT . '/vendor/bin/codecept ' ) . ' run functional ' ;
82
83
$ testsDirectory = TESTS_MODULE_PATH . DIRECTORY_SEPARATOR . TestGenerator::GENERATED_DIR . DIRECTORY_SEPARATOR ;
84
+ $ returnCode = 0 ;
83
85
//execute only tests specified as arguments in run command
84
86
foreach ($ resolvedTests as $ test ) {
85
87
//set directory as suite name for tests in suite, if not set to "default"
86
88
if (strpos ($ test , ': ' )) {
87
- list ($ suite , $ testName ) = explode (": " , $ test );
89
+ list ($ testGroup , $ testName ) = explode (": " , $ test );
88
90
} else {
89
- list ($ suite , $ testName ) = [TestGenerator::DEFAULT_DIR , $ test ];
91
+ list ($ testGroup , $ testName ) = [TestGenerator::DEFAULT_DIR , $ test ];
90
92
}
91
- $ testGroup = $ suite . DIRECTORY_SEPARATOR ;
92
- $ testName .= 'Cest.php ' ;
93
+ $ testGroup = $ testGroup . DIRECTORY_SEPARATOR ;
94
+ $ testName = $ testName . 'Cest.php ' ;
93
95
if (!realpath ($ testsDirectory . $ testGroup . $ testName )) {
94
96
throw new TestFrameworkException (
95
97
$ testName . " is not available under " . $ testsDirectory . $ testGroup
@@ -111,12 +113,13 @@ function ($type, $buffer) use ($output) {
111
113
}
112
114
113
115
/** 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
116
118
* @return array
117
119
*/
118
- private function getResolvedTests ( array $ testConfiguration )
120
+ private function resolveSuiteReferences ( $ testConfigurationJson )
119
121
{
122
+ $ testConfiguration = json_decode ($ testConfigurationJson , true );
120
123
$ testsArray = $ testConfiguration ['tests ' ] ?? [];
121
124
$ suitesArray = $ testConfiguration ['suites ' ] ?? [];
122
125
$ testArrayBuilder = [];
0 commit comments