@@ -149,38 +149,40 @@ public function generateSuite($suiteName)
149149 */
150150 public function generateTestgroupmembership ($ testManifest )
151151 {
152- $ memberShipFilePath = FilePathFormatter::format (TESTS_MODULE_PATH ).'_generated/testgroupmembership.txt ' ;
153-
154-
155- $ testManifestArray = (array ) $ testManifest ;
156- $ prefix = chr (0 ).'* ' .chr (0 );
157- $ defaultSuiteTests = $ testManifestArray [$ prefix .'testNameToSize ' ];
158-
159- $ suiteCount = 0 ;
160- $ testCount = 0 ;
161- foreach ($ defaultSuiteTests as $ defaultSuiteTestName => $ defaultTestValue ) {
162- $ defaultSuiteTest = sprintf ('%s:%s:%s ' , $ suiteCount , $ testCount , $ defaultSuiteTestName );
163- file_put_contents ($ memberShipFilePath , $ defaultSuiteTest .PHP_EOL , FILE_APPEND );
164- $ testCount ++;
165- }
166-
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 ' , $ suiteCount , $ testKey , $ key , $ testName );
174- file_put_contents ($ memberShipFilePath , $ suiteTest .PHP_EOL , FILE_APPEND );
175- $ suiteCount ++;
176- }
177- } else {
178- $ suiteTest = sprintf ('%s:%s:%s:%s ' , $ suiteCount , $ key , $ suite , $ test );
179- file_put_contents ($ memberShipFilePath , $ suiteTest .PHP_EOL , FILE_APPEND );
180- }
152+ // Get suits and subsuites data array
153+ $ suites = $ testManifest ->getSuiteConfig ();
154+
155+ // Add subsuites array[2nd dimension] to main array[1st dimension] to access it directly later
156+ if (!empty ($ suites )) {
157+ foreach ($ suites as $ subSuites ) {
158+ if (!empty ($ subSuites )) {
159+ foreach ($ subSuites as $ subSuiteName => $ suiteTestNames ) {
160+ if (!is_numeric ($ subSuiteName )) {
161+ $ suites [$ subSuiteName ] = $ suiteTestNames ;
162+ } else {
163+ continue ;
164+ }
181165 }
182- $ suiteCount ++;
166+ }
183167 }
168+ }
169+
170+ // Path to groups folder
171+ $ baseDir = FilePathFormatter::format (TESTS_MODULE_PATH );
172+
173+ // Read each file in the reverse order and form an array with groupId as key
174+ $ groupNumber = 0 ;
175+ while (!empty ($ groupFiles )){
176+ $ group = array_pop ($ groupFiles );
177+ $ allGroupsContent [$ groupNumber ] = file ($ group );
178+ $ groupNumber ++;
179+ }
180+
181+ // Output file path
182+ $ memberShipFilePath = $ baseDir .'_generated/testgroupmembership.txt ' ;
183+
184+ file_put_contents ($ memberShipFilePath , "testing " . PHP_EOL , FILE_APPEND );
185+
184186 }
185187
186188 /**
0 commit comments