@@ -118,7 +118,6 @@ public function generateAllSuites($testManifest)
118
118
// if our first element is an array we know that we have split the suites
119
119
if (is_array ($ firstElement )) {
120
120
$ this ->generateSplitSuiteFromTest ($ suiteName , $ suiteContent );
121
-
122
121
}
123
122
} catch (FastFailException $ e ) {
124
123
throw $ e ;
@@ -150,76 +149,75 @@ public function generateSuite($suiteName)
150
149
*/
151
150
public function generateTestgroupmembership ($ testManifest )
152
151
{
153
- // Get suits and subsuites data array
154
- $ suites = $ testManifest ->getSuiteConfig ();
155
-
156
- // Add subsuites array[2nd dimension] to main array[1st dimension] to access it directly later
157
- if (!empty ($ suites )) {
158
- foreach ($ suites as $ subSuites ) {
159
- if (!empty ($ subSuites )) {
160
- foreach ($ subSuites as $ subSuiteName => $ suiteTestNames ) {
161
- if (!is_numeric ($ subSuiteName )) {
162
- $ suites [$ subSuiteName ] = $ suiteTestNames ;
163
- } else {
164
- continue ;
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
165
}
166
166
}
167
167
}
168
168
}
169
- }
170
169
171
- // Path to groups folder
172
- $ baseDir = FilePathFormatter::format (TESTS_MODULE_PATH );
173
- $ path = $ baseDir .'_generated/groups ' ;
170
+ // Path to groups folder
171
+ $ baseDir = FilePathFormatter::format (TESTS_MODULE_PATH );
172
+ $ path = $ baseDir .'_generated/groups ' ;
174
173
175
- // Read all group files
176
- if (is_dir ($ path )) {
177
- $ groupFiles = glob ("$ path/group*.txt " );
178
- if ($ groupFiles === false ) {
179
- throw new RuntimeException ("glob(): error with ' $ path' " );
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 );
180
181
}
181
- sort ($ groupFiles , SORT_NATURAL );
182
- }
183
182
184
- // Read each file in the reverse order and form an array with groupId as key
185
- $ groupNumber = 0 ;
186
- $ allGroupsContent = array () ;
187
- while (!empty ($ groupFiles )){
188
- $ group = array_pop ($ groupFiles );
189
- $ allGroupsContent [$ groupNumber ] = file ($ group );
190
- $ groupNumber ++;
191
- }
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
+ }
192
191
193
- // Output file path
194
- $ memberShipFilePath = $ baseDir .'_generated/testgroupmembership.txt ' ;
195
- $ testCaseNumber = 0 ;
196
-
197
- if (!empty ($ allGroupsContent )) {
198
- foreach ($ allGroupsContent as $ groupId => $ groupInfo ) {
199
- foreach ($ groupInfo as $ testName ) {
200
- // If file has -g then it is test suite
201
- if (str_contains ($ testName , '-g ' )) {
202
- $ suitename = explode (" " , $ testName );
203
- $ suitename [1 ] = trim ($ suitename [1 ]);
204
-
205
- if (!empty ($ suites [$ suitename [1 ]])) {
206
- foreach ($ suites [$ suitename [1 ]] as $ key => $ test ) {
207
- $ suiteTest = sprintf ('%s:%s:%s:%s ' , $ groupId , $ key , $ suitename [1 ], $ test );
208
- file_put_contents ($ memberShipFilePath , $ suiteTest . PHP_EOL , FILE_APPEND );
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
209
}
210
210
}
211
+ else {
212
+ $ defaultSuiteTest = sprintf ('%s:%s:%s ' , $ groupId , $ testCaseNumber , $ testName );
213
+ file_put_contents ($ memberShipFilePath , $ defaultSuiteTest , FILE_APPEND );
214
+ }
215
+ $ testCaseNumber ++;
211
216
}
212
- // It is default test group
213
- else {
214
- $ defaultSuiteTest = sprintf ('%s:%s:%s ' , $ groupId , $ testCaseNumber , $ testName );
215
- file_put_contents ($ memberShipFilePath , $ defaultSuiteTest , FILE_APPEND );
216
- }
217
- $ testCaseNumber ++;
217
+ $ testCaseNumber = 0 ;
218
218
}
219
- $ testCaseNumber = 0 ;
220
219
}
221
220
}
222
- }
223
221
224
222
/**
225
223
* Function which takes a suite name and a set of test names. The function then generates all relevant supporting
0 commit comments