Issue #3418451 by longwave: Remove withConsecutive() in ModuleHandlerTest

merge-requests/6342/merge
catch 2024-01-31 23:42:36 +00:00
parent 501e1ed2fb
commit 267f1252bf
2 changed files with 11 additions and 13 deletions

View File

@ -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

View File

@ -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();