@@ -149,74 +149,74 @@ public function generateSuite($suiteName)
149149 */
150150 public function generateTestgroupmembership ($ testManifest )
151151 {
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- }
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+ }
165+ }
166+ }
165167 }
166- }
167168 }
168- }
169169
170- // Path to groups folder
171- $ baseDir = FilePathFormatter::format (TESTS_MODULE_PATH );
172- $ path = $ baseDir .'_generated/groups ' ;
170+ // Path to groups folder
171+ $ baseDir = FilePathFormatter::format (TESTS_MODULE_PATH );
172+ $ path = $ baseDir .'_generated/groups ' ;
173+
174+ // Read all group files
175+ if (is_dir ($ path )) {
176+ $ groupFiles = glob ("$ path/group*.txt " );
177+ if ($ groupFiles === false ) {
178+ throw new RuntimeException ("glob(): error with ' $ path' " );
179+ }
180+ sort ($ groupFiles , SORT_NATURAL );
181+ }
173182
174- // Read all group files
175- if (is_dir ($ path )) {
176- $ groupFiles = glob ("$ path/group*.txt " );
177- if ($ groupFiles === false ) {
178- throw new RuntimeException ("glob(): error with ' $ path' " );
183+ // Read each file in the reverse order and form an array with groupId as key
184+ $ groupNumber = 0 ;
185+ $ allGroupsContent = [];
186+ while (!empty ($ groupFiles )) {
187+ $ group = array_pop ($ groupFiles );
188+ $ allGroupsContent [$ groupNumber ] = file ($ group );
189+ $ groupNumber ++;
179190 }
180- sort ($ groupFiles , SORT_NATURAL );
181- }
182-
183- // Read each file in the reverse order and form an array with groupId as key
184- $ groupNumber = 0 ;
185- $ allGroupsContent = [];
186- while (!empty ($ groupFiles )) {
187- $ group = array_pop ($ groupFiles );
188- $ allGroupsContent [$ groupNumber ] = file ($ group );
189- $ groupNumber ++;
190- }
191-
192- // Output file path
193- $ memberShipFilePath = $ baseDir .'_generated/testgroupmembership.txt ' ;
194- $ testCaseNumber = 0 ;
195-
196- if (!empty ($ allGroupsContent )) {
197- foreach ($ allGroupsContent as $ groupId => $ groupInfo ) {
198- foreach ($ groupInfo as $ testName ) {
199- // If file has -g then it is test suite
200- if (str_contains ($ testName , '-g ' )) {
201- $ suitename = explode (" " , $ testName );
202- $ suitename [1 ] = trim ($ suitename [1 ]);
203-
204- if (!empty ($ suites [$ suitename [1 ]])) {
205- foreach ($ suites [$ suitename [1 ]] as $ key => $ test ) {
206- $ suiteTest = sprintf ('%s:%s:%s:%s ' , $ groupId , $ key , $ suitename [1 ], $ test );
207- file_put_contents ($ memberShipFilePath , $ suiteTest . PHP_EOL , FILE_APPEND );
191+
192+ // Output file path
193+ $ memberShipFilePath = $ baseDir .'_generated/testgroupmembership.txt ' ;
194+ $ testCaseNumber = 0 ;
195+
196+ if (!empty ($ allGroupsContent )) {
197+ foreach ($ allGroupsContent as $ groupId => $ groupInfo ) {
198+ foreach ($ groupInfo as $ testName ) {
199+ // If file has -g then it is test suite
200+ if (str_contains ($ testName , '-g ' )) {
201+ $ suitename = explode (" " , $ testName );
202+ $ suitename [1 ] = trim ($ suitename [1 ]);
203+
204+ if (!empty ($ suites [$ suitename [1 ]])) {
205+ foreach ($ suites [$ suitename [1 ]] as $ key => $ test ) {
206+ $ suiteTest = sprintf ('%s:%s:%s:%s ' , $ groupId , $ key , $ suitename [1 ], $ test );
207+ file_put_contents ($ memberShipFilePath , $ suiteTest . PHP_EOL , FILE_APPEND );
208+ }
209+ }
208210 }
209- }
210- }
211- else {
212- $ defaultSuiteTest = sprintf ('%s:%s:%s ' , $ groupId , $ testCaseNumber , $ testName );
213- file_put_contents ($ memberShipFilePath , $ defaultSuiteTest , FILE_APPEND );
211+ else {
212+ $ defaultSuiteTest = sprintf ('%s:%s:%s ' , $ groupId , $ testCaseNumber , $ testName );
213+ file_put_contents ($ memberShipFilePath , $ defaultSuiteTest , FILE_APPEND );
214+ }
215+ $ testCaseNumber ++;
216+ }
217+ $ testCaseNumber = 0 ;
214218 }
215- $ testCaseNumber ++;
216- }
217- $ testCaseNumber = 0 ;
218219 }
219- }
220220 }
221221
222222 /**
0 commit comments