@@ -118,7 +118,6 @@ public function testAggregateTestModulePathsDevTests(): void
118118 $ moduleResolverService = $ this ->createPartialMock (ModuleResolverService::class, ['globRelevantPaths ' ]);
119119 $ moduleResolverService
120120 ->method ('globRelevantPaths ' )
121- ->withConsecutive ()
122121 ->will (
123122 $ this ->returnCallback (
124123 function ($ codePath , $ pattern ) use ($ modulePath ) {
@@ -157,32 +156,42 @@ public function testGetModulePathsLocations(): void
157156 $ this ->mockForceGenerate (false );
158157 // Define the Module paths from default TESTS_MODULE_PATH
159158 $ 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+ ];
163173
164174 $ moduleResolverService = $ this ->createPartialMock (ModuleResolverService::class, ['globRelevantPaths ' ]);
165175 $ moduleResolverService
166176 ->method ('globRelevantPaths ' )
167- ->withConsecutive ()
168177 ->will (
169178 $ 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 ;
174182
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+ }
178187
179- if ( $ codePath === $ magentoBaseCodePath . " /app/code " && $ pattern === ' Test/Mftf ' ) {
180- return [];
188+ return [];
189+ }
181190 }
182191
183192 $ 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
186195 ));
187196 }
188197 )
@@ -192,6 +201,16 @@ function ($codePath, $pattern) use ($modulePath, $magentoBaseCodePath) {
192201 $ resolver = ModuleResolver::getInstance ();
193202 $ this ->setMockResolverProperties ($ resolver , null , []);
194203 $ 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+ }
195214 }
196215
197216 /**
0 commit comments