diff --git a/Tests/Console/ApplicationTest.php b/Tests/Console/ApplicationTest.php index d075ad75f..83c8553b2 100644 --- a/Tests/Console/ApplicationTest.php +++ b/Tests/Console/ApplicationTest.php @@ -258,14 +258,31 @@ private function getKernel(array $bundles, $useDispatcher = false) $container ->expects($this->exactly(2)) ->method('hasParameter') - ->withConsecutive(['console.command.ids'], ['console.lazy_command.ids']) - ->willReturnOnConsecutiveCalls(true, true) + ->willReturnCallback(function (...$args) { + static $series = [ + ['console.command.ids'], + ['console.lazy_command.ids'], + ]; + + $this->assertSame(array_shift($series), $args); + + return true; + }) ; + $container ->expects($this->exactly(2)) ->method('getParameter') - ->withConsecutive(['console.lazy_command.ids'], ['console.command.ids']) - ->willReturnOnConsecutiveCalls([], []) + ->willReturnCallback(function (...$args) { + static $series = [ + ['console.lazy_command.ids'], + ['console.command.ids'], + ]; + + $this->assertSame(array_shift($series), $args); + + return []; + }) ; $kernel = $this->createMock(KernelInterface::class); diff --git a/Tests/Translation/TranslatorTest.php b/Tests/Translation/TranslatorTest.php index 583ebbb77..dc00ef99e 100644 --- a/Tests/Translation/TranslatorTest.php +++ b/Tests/Translation/TranslatorTest.php @@ -148,18 +148,21 @@ public function testResourceFilesOptionLoadsBeforeOtherAddedResources($debug, $e $loader = $this->createMock(LoaderInterface::class); + $series = [ + /* The "messages.some_locale.loader" is passed via the resource_file option and shall be loaded first */ + [['messages.some_locale.loader', 'some_locale', 'messages'], $someCatalogue], + /* This resource is added by an addResource() call and shall be loaded after the resource_files */ + [['second_resource.some_locale.loader', 'some_locale', 'messages'], $someCatalogue], + ]; + $loader->expects($this->exactly(2)) ->method('load') - ->withConsecutive( - /* The "messages.some_locale.loader" is passed via the resource_file option and shall be loaded first */ - ['messages.some_locale.loader', 'some_locale', 'messages'], - /* This resource is added by an addResource() call and shall be loaded after the resource_files */ - ['second_resource.some_locale.loader', 'some_locale', 'messages'] - ) - ->willReturnOnConsecutiveCalls( - $someCatalogue, - $someCatalogue - ); + ->willReturnCallback(function (...$args) use (&$series) { + [$expectedArgs, $return] = array_shift($series); + $this->assertSame($expectedArgs, $args); + + return $return; + }); $options = [ 'resource_files' => ['some_locale' => ['messages.some_locale.loader']],