@@ -114,29 +114,43 @@ function buildProject()
114
114
* @return void
115
115
*/
116
116
117
- function generateTests (array $ tests , $ opts = ['config ' => null , 'force ' => false , 'nodes ' => null , 'lines ' => null ])
117
+ function generateTests (array $ tests , $ opts = [
118
+ 'config ' => null ,
119
+ 'force ' => false ,
120
+ 'nodes ' => null ,
121
+ 'lines ' => null ,
122
+ 'tests ' => null
123
+ ])
118
124
{
119
125
$ GLOBALS ['GENERATE_TESTS ' ] = true ;
120
126
require 'tests ' . DIRECTORY_SEPARATOR . 'functional ' . DIRECTORY_SEPARATOR . '_bootstrap.php ' ;
121
- $ testsObjects = [];
127
+ $ testObjects = [];
128
+ $ suitesReferences = [];
129
+
130
+ if ($ opts ['force ' ])
131
+ {
132
+ $ GLOBALS ['FORCE_PHP_GENERATE ' ] = true ;
133
+ }
134
+
135
+ if ($ opts ['tests ' ]) {
136
+ $ testConfigArray = json_decode ($ opts ['tests ' ],true );
137
+ $ tests = $ testConfigArray ['tests ' ] ?? [];
138
+ $ suitesReferences = $ testConfigArray ['suites ' ] ?? [];
139
+ }
140
+
122
141
if (!empty ($ tests ))
123
142
{
124
143
foreach ($ tests as $ test )
125
144
{
126
- $ testsObjects [] = Magento \FunctionalTestingFramework \Test \Handlers \TestObjectHandler::getInstance ()->getObject ($ test );
145
+ $ testObjects [] = Magento \FunctionalTestingFramework \Test \Handlers \TestObjectHandler::getInstance ()->getObject ($ test );
127
146
}
128
147
}
129
148
130
- if ($ opts ['force ' ])
131
- {
132
- $ GLOBALS ['FORCE_PHP_GENERATE ' ] = true ;
133
- }
134
-
135
149
// maintain backwards compatability for devops
136
150
$ lines = $ opts ['lines ' ] ?? $ opts ['nodes ' ];
137
151
138
- $ testsReferencedInSuites = \Magento \FunctionalTestingFramework \Suite \SuiteGenerator::getInstance ()->getTestsReferencedInSuites ();
139
- $ testManifest = \Magento \FunctionalTestingFramework \Util \TestGenerator::getInstance (null , $ testsObjects )->createAllTestFiles ($ opts ['config ' ], $ lines , $ testsReferencedInSuites );
152
+ $ testsReferencedInSuites = \Magento \FunctionalTestingFramework \Suite \SuiteGenerator::getInstance ($ suitesReferences )->getTestsReferencedInSuites ();
153
+ $ testManifest = \Magento \FunctionalTestingFramework \Util \TestGenerator::getInstance (null , $ testObjects )->createAllTestFiles ($ opts ['config ' ], $ lines , $ testsReferencedInSuites );
140
154
\Magento \FunctionalTestingFramework \Suite \SuiteGenerator::getInstance ()->generateAllSuites ($ testManifest );
141
155
142
156
$ this ->say ("Generate Tests Command Run " );
@@ -281,6 +295,4 @@ function preInstall()
281
295
{
282
296
$ this ->_exec ('php pre-install.php ' );
283
297
}
284
-
285
-
286
298
}
0 commit comments