@@ -139,6 +139,28 @@ public function generateSuite($suiteName)
139
139
$ this ->generateSuiteFromTest ($ suiteName , []);
140
140
}
141
141
142
+ /**
143
+ * Function which generate Testgroupmembership file.
144
+ *
145
+ * @param array $tests
146
+ * @return void
147
+ * @throws \Exception
148
+ */
149
+ public function generateTestgroupmembership ($ tests )
150
+ {
151
+ $ memberShipFilePath = FilePathFormatter::format (TESTS_MODULE_PATH ).'_generated/testgroupmembership.txt ' ;
152
+ static $ suiteCount = 0 ;
153
+ foreach ($ tests as $ key => $ testName ) {
154
+ try {
155
+ $ suiteTests = $ suiteCount .": " .$ key .": " .$ suiteName .': ' .$ testName ."\n" ;
156
+ file_put_contents ($ memberShipFilePath , $ suiteTests , FILE_APPEND );
157
+ } catch (FastFailException $ e ) {
158
+ throw $ e ;
159
+ }
160
+ }
161
+ $ suiteCount ++;
162
+ }
163
+
142
164
/**
143
165
* Function which takes a suite name and a set of test names. The function then generates all relevant supporting
144
166
* files and classes for the suite. The function takes an optional argument for suites which are split by a parallel
@@ -157,17 +179,14 @@ private function generateSuiteFromTest($suiteName, $tests = [], $originalSuiteNa
157
179
$ relativePath = TestGenerator::GENERATED_DIR . DIRECTORY_SEPARATOR . $ suiteName ;
158
180
$ fullPath = FilePathFormatter::format (TESTS_MODULE_PATH ) . $ relativePath . DIRECTORY_SEPARATOR ;
159
181
DirSetupUtil::createGroupDir ($ fullPath );
160
- $ memberShipFilePath = FilePathFormatter::format (TESTS_MODULE_PATH ).'_generated/testgroupmembership.txt ' ;
161
- static $ suiteCount = 0 ;
162
182
$ exceptionCollector = new ExceptionCollector ();
163
183
try {
164
184
$ relevantTests = [];
165
185
if (!empty ($ tests )) {
166
186
$ this ->validateTestsReferencedInSuite ($ suiteName , $ tests , $ originalSuiteName );
167
- foreach ($ tests as $ key => $ testName ) {
187
+ $ this ->generateTestgroupmembership ($ tests );
188
+ foreach ($ tests as $ testName ) {
168
189
try {
169
- $ suiteTests = $ suiteCount .": " .$ key .": " .$ suiteName .': ' .$ testName ."\n" ;
170
- file_put_contents ($ memberShipFilePath , $ suiteTests , FILE_APPEND );
171
190
$ relevantTests [$ testName ] = TestObjectHandler::getInstance ()->getObject ($ testName );
172
191
} catch (FastFailException $ e ) {
173
192
throw $ e ;
@@ -181,7 +200,6 @@ private function generateSuiteFromTest($suiteName, $tests = [], $originalSuiteNa
181
200
} else {
182
201
$ relevantTests = SuiteObjectHandler::getInstance ()->getObject ($ suiteName )->getTests ();
183
202
}
184
- $ suiteCount ++;
185
203
if (empty ($ relevantTests )) {
186
204
$ exceptionCollector ->reset ();
187
205
// There are suites that include no test on purpose for certain Magento edition.
0 commit comments