@@ -118,7 +118,6 @@ public function testAggregateTestModulePathsDevTests(): void
118
118
$ moduleResolverService = $ this ->createPartialMock (ModuleResolverService::class, ['globRelevantPaths ' ]);
119
119
$ moduleResolverService
120
120
->method ('globRelevantPaths ' )
121
- ->withConsecutive ()
122
121
->will (
123
122
$ this ->returnCallback (
124
123
function ($ codePath , $ pattern ) use ($ modulePath ) {
@@ -157,32 +156,42 @@ public function testGetModulePathsLocations(): void
157
156
$ this ->mockForceGenerate (false );
158
157
// Define the Module paths from default TESTS_MODULE_PATH
159
158
$ modulePath = defined ('TESTS_MODULE_PATH ' ) ? TESTS_MODULE_PATH : TESTS_BP ;
160
-
161
- // Define the Module paths from app/code
162
- $ magentoBaseCodePath = MAGENTO_BP ;
159
+ $ invokedWithParams = $ expectedParams = [
160
+ [
161
+ $ modulePath ,
162
+ ''
163
+ ],
164
+ [
165
+ MAGENTO_BP . '/vendor ' ,
166
+ 'Test/Mftf '
167
+ ],
168
+ [
169
+ MAGENTO_BP . '/app/code ' ,
170
+ 'Test/Mftf '
171
+ ]
172
+ ];
163
173
164
174
$ moduleResolverService = $ this ->createPartialMock (ModuleResolverService::class, ['globRelevantPaths ' ]);
165
175
$ moduleResolverService
166
176
->method ('globRelevantPaths ' )
167
- ->withConsecutive ()
168
177
->will (
169
178
$ this ->returnCallback (
170
- function ($ codePath , $ pattern ) use ($ modulePath , $ magentoBaseCodePath ) {
171
- if ($ codePath === $ modulePath && $ pattern === '' ) {
172
- return [];
173
- }
179
+ function ($ codePath , $ pattern ) use (&$ invokedWithParams , $ expectedParams ) {
180
+ foreach ($ expectedParams as $ key => $ parameter ) {
181
+ list ($ expectedCodePath , $ expectedPattern ) = $ parameter ;
174
182
175
- if ($ codePath === $ magentoBaseCodePath . '/vendor ' && $ pattern === 'Test/Mftf ' ) {
176
- return [];
177
- }
183
+ if ($ codePath === $ expectedCodePath && $ pattern === $ expectedPattern ) {
184
+ if (isset ($ invokedWithParams [$ key ])) {
185
+ unset($ invokedWithParams [$ key ]);
186
+ }
178
187
179
- if ( $ codePath === $ magentoBaseCodePath . " /app/code " && $ pattern === ' Test/Mftf ' ) {
180
- return [];
188
+ return [];
189
+ }
181
190
}
182
191
183
192
$ this ->fail (sprintf (
184
- 'Not expected parameter: \' %s \' when invoked method globRelevantPaths(). ' ,
185
- $ modulePath
193
+ 'Not expected parameter: [%s] when invoked method globRelevantPaths(). ' ,
194
+ $ codePath . ' ; ' . $ pattern
186
195
));
187
196
}
188
197
)
@@ -192,6 +201,16 @@ function ($codePath, $pattern) use ($modulePath, $magentoBaseCodePath) {
192
201
$ resolver = ModuleResolver::getInstance ();
193
202
$ this ->setMockResolverProperties ($ resolver , null , []);
194
203
$ this ->assertEquals ([], $ resolver ->getModulesPath ());
204
+
205
+ if ($ invokedWithParams ) {
206
+ $ parameters = '' ;
207
+
208
+ foreach ($ invokedWithParams as $ parameter ) {
209
+ $ parameters .= sprintf ('[%s] ' , implode ('; ' , $ parameter ));
210
+ }
211
+
212
+ $ this ->fail ('The method globRelevantPaths() was not called with expected parameters: ' . $ parameters );
213
+ }
195
214
}
196
215
197
216
/**
0 commit comments