diff --git a/core/phpstan-baseline.neon b/core/phpstan-baseline.neon index aa7ade41ee6..54219d5f9bc 100644 --- a/core/phpstan-baseline.neon +++ b/core/phpstan-baseline.neon @@ -3353,11 +3353,6 @@ parameters: count: 1 path: tests/Drupal/Tests/Core/EventSubscriber/SpecialAttributesRouteSubscriberTest.php - - - message: "#^Call to deprecated method withConsecutive\\(\\) of class PHPUnit\\\\Framework\\\\MockObject\\\\Builder\\\\InvocationMocker\\.$#" - count: 1 - path: tests/Drupal/Tests/Core/Extension/ModuleHandlerTest.php - - message: "#^Call to deprecated method withConsecutive\\(\\) of class PHPUnit\\\\Framework\\\\MockObject\\\\Builder\\\\InvocationMocker\\.$#" count: 1 diff --git a/core/tests/Drupal/Tests/Core/Extension/ModuleHandlerTest.php b/core/tests/Drupal/Tests/Core/Extension/ModuleHandlerTest.php index 4f093a736c3..0fcad71f635 100644 --- a/core/tests/Drupal/Tests/Core/Extension/ModuleHandlerTest.php +++ b/core/tests/Drupal/Tests/Core/Extension/ModuleHandlerTest.php @@ -115,15 +115,18 @@ class ModuleHandlerTest extends UnitTestCase { ]) ->onlyMethods(['load']) ->getMock(); - $module_handler->expects($this->exactly(3)) + $calls = [ + // First reload. + 'module_handler_test', + // Second reload. + 'module_handler_test', + 'module_handler_test_added', + ]; + $module_handler->expects($this->exactly(count($calls))) ->method('load') - ->withConsecutive( - // First reload. - ['module_handler_test'], - // Second reload. - ['module_handler_test'], - ['module_handler_test_added'], - ); + ->with($this->callback(function (string $module) use (&$calls): bool { + return $module === array_shift($calls); + })); $module_handler->reload(); $module_handler->addModule('module_handler_test_added', 'core/tests/Drupal/Tests/Core/Extension/modules/module_handler_test_added'); $module_handler->reload();