@@ -95,6 +95,7 @@ public static function getInstance(): SuiteGenerator
95
95
*/
96
96
public function generateAllSuites ($ testManifest )
97
97
{
98
+ $ this ->generateTestgroupmembership ($ testManifest );
98
99
$ suites = $ testManifest ->getSuiteConfig ();
99
100
100
101
foreach ($ suites as $ suiteName => $ suiteContent ) {
@@ -142,24 +143,44 @@ public function generateSuite($suiteName)
142
143
/**
143
144
* Function which generate Testgroupmembership file.
144
145
*
145
- * @param string $suiteName
146
- * @param array $tests
146
+ * @param $testManifest
147
147
* @return void
148
148
* @throws \Exception
149
149
*/
150
- public function generateTestgroupmembership ($ suiteName , $ tests )
150
+ public function generateTestgroupmembership ($ testManifest )
151
151
{
152
152
$ memberShipFilePath = FilePathFormatter::format (TESTS_MODULE_PATH ).'_generated/testgroupmembership.txt ' ;
153
- static $ suiteCount = 0 ;
154
- foreach ($ tests as $ key => $ testName ) {
155
- try {
156
- $ suiteTests = $ suiteCount .": " .$ key .": " .$ suiteName .': ' .$ testName ."\n" ;
157
- file_put_contents ($ memberShipFilePath , $ suiteTests , FILE_APPEND );
158
- } catch (FastFailException $ e ) {
159
- throw $ e ;
160
- }
153
+
154
+ $ testManifestArray = (array ) $ testManifest ;
155
+ $ prefix = chr (0 ).'* ' .chr (0 );
156
+ $ defaultSuiteTests = $ testManifestArray [$ prefix .'testNameToSize ' ];
157
+
158
+ $ suiteCount = 0 ;
159
+ $ testCount = 0 ;
160
+ foreach ($ defaultSuiteTests as $ defaultSuiteTestName => $ defaultTestValue ) {
161
+ $ defaultSuiteTestName = rtrim ($ defaultSuiteTestName , 'Cest ' );
162
+ $ defaultSuiteTest = sprintf ('%s:%s:%s\n ' , $ suiteCount , 0 , $ defaultSuiteTestName );
163
+ file_put_contents ($ memberShipFilePath , $ defaultSuiteTest , FILE_APPEND );
164
+ $ testCount ++;
161
165
}
166
+
162
167
$ suiteCount ++;
168
+ $ suites = $ testManifest ->getSuiteConfig ();
169
+ foreach ($ suites as $ suite => $ tests ) {
170
+ foreach ($ tests as $ key => $ test ) {
171
+ if (!is_numeric ($ key )) {
172
+ foreach ($ test as $ testKey => $ testName ) {
173
+ $ suiteTest = sprintf ('%s:%s:%s:%s\n ' , $ suiteCount , $ testKey , $ key , $ testName );
174
+ file_put_contents ($ memberShipFilePath , $ suiteTest , FILE_APPEND );
175
+ $ suiteCount ++;
176
+ }
177
+ } else {
178
+ $ suiteTest = sprintf ('%s:%s:%s:%s\n ' , $ suiteCount , $ key , $ suite , $ test );
179
+ file_put_contents ($ memberShipFilePath , $ suiteTest , FILE_APPEND );
180
+ }
181
+ }
182
+ $ suiteCount ++;
183
+ }
163
184
}
164
185
165
186
/**
@@ -186,7 +207,6 @@ private function generateSuiteFromTest($suiteName, $tests = [], $originalSuiteNa
186
207
$ relevantTests = [];
187
208
if (!empty ($ tests )) {
188
209
$ this ->validateTestsReferencedInSuite ($ suiteName , $ tests , $ originalSuiteName );
189
- $ this ->generateTestgroupmembership ($ suiteName , $ tests );
190
210
foreach ($ tests as $ testName ) {
191
211
try {
192
212
$ relevantTests [$ testName ] = TestObjectHandler::getInstance ()->getObject ($ testName );
0 commit comments