Revert "Issue #3306554 by andypost, mondrake: InvocationMocker::withConsecutive() is deprecated in PHPUnit 9.6 and removed from PHPUnit 10 - easy replacements"

This reverts commit 240099013d.
merge-requests/3748/head
Dave Long 2023-03-29 10:41:52 +01:00
parent bb8f1aadaf
commit b91861bf59
No known key found for this signature in database
GPG Key ID: ED52AE211E142771
13 changed files with 24 additions and 24 deletions

View File

@ -120,7 +120,7 @@ class FormErrorHandlerTest extends UnitTestCase {
public function testErrorMessagesInline() { public function testErrorMessagesInline() {
$this->messenger->expects($this->exactly(4)) $this->messenger->expects($this->exactly(4))
->method('addError') ->method('addError')
->willReturnOnConsecutiveCalls( ->withConsecutive(
['no title given', FALSE], ['no title given', FALSE],
['element is invisible', FALSE], ['element is invisible', FALSE],
['this missing element is invalid', FALSE], ['this missing element is invalid', FALSE],
@ -164,7 +164,7 @@ class FormErrorHandlerTest extends UnitTestCase {
// Asserts all messages are summarized. // Asserts all messages are summarized.
$this->messenger->expects($this->exactly(7)) $this->messenger->expects($this->exactly(7))
->method('addMessage') ->method('addMessage')
->willReturnOnConsecutiveCalls( ->withConsecutive(
['invalid', 'error', FALSE], ['invalid', 'error', FALSE],
['invalid', 'error', FALSE], ['invalid', 'error', FALSE],
['invalid', 'error', FALSE], ['invalid', 'error', FALSE],

View File

@ -126,7 +126,7 @@ class MigrateSqlIdMapEnsureTablesTest extends MigrateTestCase {
]); ]);
$schema->expects($this->exactly(2)) $schema->expects($this->exactly(2))
->method('createTable') ->method('createTable')
->willReturnOnConsecutiveCalls( ->withConsecutive(
['migrate_map_sql_idmap_test', $map_table_schema], ['migrate_map_sql_idmap_test', $map_table_schema],
['migrate_message_sql_idmap_test', $table_schema], ['migrate_message_sql_idmap_test', $table_schema],
); );
@ -154,7 +154,7 @@ class MigrateSqlIdMapEnsureTablesTest extends MigrateTestCase {
]); ]);
$schema->expects($this->exactly(3)) $schema->expects($this->exactly(3))
->method('addField') ->method('addField')
->willReturnOnConsecutiveCalls( ->withConsecutive(
[ [
'migrate_map_sql_idmap_test', 'rollback_action', [ 'migrate_map_sql_idmap_test', 'rollback_action', [
'type' => 'int', 'type' => 'int',

View File

@ -55,7 +55,7 @@ class SchemaTest extends UnitTestCase {
$this->connection->expects($this->exactly(2)) $this->connection->expects($this->exactly(2))
->method('query') ->method('query')
->willReturnOnConsecutiveCalls( ->withConsecutive(
[$this->anything()], [$this->anything()],
["SELECT 1 FROM pg_constraint WHERE conname = '$expected'"], ["SELECT 1 FROM pg_constraint WHERE conname = '$expected'"],
) )

View File

@ -96,7 +96,7 @@ class EntityNormalizerTest extends UnitTestCase {
->getMock(); ->getMock();
$serializer->expects($this->exactly(2)) $serializer->expects($this->exactly(2))
->method('normalize') ->method('normalize')
->willReturnOnConsecutiveCalls( ->withConsecutive(
[$list_item_1, 'test_format'], [$list_item_1, 'test_format'],
[$list_item_2, 'test_format'], [$list_item_2, 'test_format'],
); );
@ -222,7 +222,7 @@ class EntityNormalizerTest extends UnitTestCase {
->getMock(); ->getMock();
$serializer->expects($this->exactly(2)) $serializer->expects($this->exactly(2))
->method('denormalize') ->method('denormalize')
->willReturnOnConsecutiveCalls( ->withConsecutive(
['value_1', get_class($key_1), NULL, ['target_instance' => $key_1, 'entity_type' => 'test']], ['value_1', get_class($key_1), NULL, ['target_instance' => $key_1, 'entity_type' => 'test']],
['value_2', get_class($key_2), NULL, ['target_instance' => $key_2, 'entity_type' => 'test']], ['value_2', get_class($key_2), NULL, ['target_instance' => $key_2, 'entity_type' => 'test']],
); );
@ -371,7 +371,7 @@ class EntityNormalizerTest extends UnitTestCase {
->getMock(); ->getMock();
$serializer->expects($this->exactly(2)) $serializer->expects($this->exactly(2))
->method('denormalize') ->method('denormalize')
->willReturnOnConsecutiveCalls( ->withConsecutive(
['value_1', get_class($key_1), NULL, ['target_instance' => $key_1, 'entity_type' => 'test']], ['value_1', get_class($key_1), NULL, ['target_instance' => $key_1, 'entity_type' => 'test']],
['value_2', get_class($key_2), NULL, ['target_instance' => $key_2, 'entity_type' => 'test']], ['value_2', get_class($key_2), NULL, ['target_instance' => $key_2, 'entity_type' => 'test']],
); );

View File

@ -369,7 +369,7 @@ class ViewsDataTest extends UnitTestCase {
); );
$this->cacheBackend->expects($this->exactly(2)) $this->cacheBackend->expects($this->exactly(2))
->method('set') ->method('set')
->willReturnOnConsecutiveCalls( ->withConsecutive(
['views_data:en', $expected_views_data], ['views_data:en', $expected_views_data],
['views_data:views_test_data:en', $expected_views_data['views_test_data']], ['views_data:views_test_data:en', $expected_views_data['views_test_data']],
); );
@ -600,7 +600,7 @@ class ViewsDataTest extends UnitTestCase {
); );
$this->cacheBackend->expects($this->exactly(2)) $this->cacheBackend->expects($this->exactly(2))
->method('set') ->method('set')
->willReturnOnConsecutiveCalls( ->withConsecutive(
["views_data:$table_name:en", $expected_views_data[$table_name]], ["views_data:$table_name:en", $expected_views_data[$table_name]],
["views_data:$table_name_2:en", $expected_views_data[$table_name_2]], ["views_data:$table_name_2:en", $expected_views_data[$table_name_2]],
); );

View File

@ -399,7 +399,7 @@ class EntityUnitTest extends UnitTestCase {
public function testPostSave() { public function testPostSave() {
$this->cacheTagsInvalidator->expects($this->exactly(2)) $this->cacheTagsInvalidator->expects($this->exactly(2))
->method('invalidateTags') ->method('invalidateTags')
->willReturnOnConsecutiveCalls([ ->withConsecutive([
[ [
// List cache tag. // List cache tag.
$this->entityTypeId . '_list', $this->entityTypeId . '_list',
@ -430,7 +430,7 @@ class EntityUnitTest extends UnitTestCase {
public function testPostSaveBundle() { public function testPostSaveBundle() {
$this->cacheTagsInvalidator->expects($this->exactly(2)) $this->cacheTagsInvalidator->expects($this->exactly(2))
->method('invalidateTags') ->method('invalidateTags')
->willReturnOnConsecutiveCalls([ ->withConsecutive([
[ [
// List cache tag. // List cache tag.
$this->entityTypeId . '_list', $this->entityTypeId . '_list',

View File

@ -158,7 +158,7 @@ class KeyValueEntityStorageTest extends UnitTestCase {
$this->moduleHandler->expects($this->exactly(2)) $this->moduleHandler->expects($this->exactly(2))
->method('invokeAll') ->method('invokeAll')
->willReturnOnConsecutiveCalls(['test_entity_type_create'], ['entity_create']); ->withConsecutive(['test_entity_type_create'], ['entity_create']);
$this->uuidService->expects($this->never()) $this->uuidService->expects($this->never())
->method('generate'); ->method('generate');
@ -181,7 +181,7 @@ class KeyValueEntityStorageTest extends UnitTestCase {
$this->moduleHandler->expects($this->exactly(2)) $this->moduleHandler->expects($this->exactly(2))
->method('invokeAll') ->method('invokeAll')
->willReturnOnConsecutiveCalls(['test_entity_type_create'], ['entity_create']); ->withConsecutive(['test_entity_type_create'], ['entity_create']);
$this->uuidService->expects($this->never()) $this->uuidService->expects($this->never())
->method('generate'); ->method('generate');
@ -206,7 +206,7 @@ class KeyValueEntityStorageTest extends UnitTestCase {
$this->moduleHandler->expects($this->exactly(2)) $this->moduleHandler->expects($this->exactly(2))
->method('invokeAll') ->method('invokeAll')
->willReturnOnConsecutiveCalls(['test_entity_type_create'], ['entity_create']); ->withConsecutive(['test_entity_type_create'], ['entity_create']);
$this->uuidService->expects($this->once()) $this->uuidService->expects($this->once())
->method('generate') ->method('generate')
->willReturn('bar'); ->willReturn('bar');
@ -248,7 +248,7 @@ class KeyValueEntityStorageTest extends UnitTestCase {
$this->moduleHandler->expects($this->exactly(4)) $this->moduleHandler->expects($this->exactly(4))
->method('invokeAll') ->method('invokeAll')
->willReturnOnConsecutiveCalls( ->withConsecutive(
['test_entity_type_presave'], ['test_entity_type_presave'],
['entity_presave'], ['entity_presave'],
['test_entity_type_insert'], ['test_entity_type_insert'],
@ -292,7 +292,7 @@ class KeyValueEntityStorageTest extends UnitTestCase {
->method('delete'); ->method('delete');
$this->moduleHandler->expects($this->exactly(4)) $this->moduleHandler->expects($this->exactly(4))
->method('invokeAll') ->method('invokeAll')
->willReturnOnConsecutiveCalls( ->withConsecutive(
['test_entity_type_presave'], ['test_entity_type_presave'],
['entity_presave'], ['entity_presave'],
['test_entity_type_update'], ['test_entity_type_update'],
@ -574,7 +574,7 @@ class KeyValueEntityStorageTest extends UnitTestCase {
$this->moduleHandler->expects($this->exactly(8)) $this->moduleHandler->expects($this->exactly(8))
->method('invokeAll') ->method('invokeAll')
->willReturnOnConsecutiveCalls( ->withConsecutive(
['test_entity_type_predelete'], ['test_entity_type_predelete'],
['entity_predelete'], ['entity_predelete'],
); );

View File

@ -1538,7 +1538,7 @@ class SqlContentEntityStorageSchemaTest extends UnitTestCase {
// The original indexes should be dropped before the new one is added. // The original indexes should be dropped before the new one is added.
$this->dbSchemaHandler->expects($this->exactly(3)) $this->dbSchemaHandler->expects($this->exactly(3))
->method('dropIndex') ->method('dropIndex')
->willReturnOnConsecutiveCalls( ->withConsecutive(
['entity_test', 'entity_test__b588603cb9'], ['entity_test', 'entity_test__b588603cb9'],
['entity_test', 'entity_test__removed_field'], ['entity_test', 'entity_test__removed_field'],
); );

View File

@ -115,7 +115,7 @@ class ModuleHandlerTest extends UnitTestCase {
->getMock(); ->getMock();
$module_handler->expects($this->exactly(3)) $module_handler->expects($this->exactly(3))
->method('load') ->method('load')
->willReturnOnConsecutiveCalls( ->withConsecutive(
// First reload. // First reload.
['module_handler_test'], ['module_handler_test'],
// Second reload. // Second reload.

View File

@ -313,7 +313,7 @@ class FormCacheTest extends UnitTestCase {
]; ];
$this->moduleHandler->expects($this->exactly(2)) $this->moduleHandler->expects($this->exactly(2))
->method('loadInclude') ->method('loadInclude')
->willReturnOnConsecutiveCalls( ->withConsecutive(
['a_module', 'the_type', 'some_name'], ['a_module', 'the_type', 'some_name'],
['another_module', 'inc', 'another_module'], ['another_module', 'inc', 'another_module'],
); );

View File

@ -50,7 +50,7 @@ class FormErrorHandlerTest extends UnitTestCase {
public function testDisplayErrorMessages() { public function testDisplayErrorMessages() {
$this->messenger->expects($this->exactly(6)) $this->messenger->expects($this->exactly(6))
->method('addMessage') ->method('addMessage')
->willReturnOnConsecutiveCalls( ->withConsecutive(
['invalid', 'error'], ['invalid', 'error'],
['invalid', 'error'], ['invalid', 'error'],
['invalid', 'error'], ['invalid', 'error'],

View File

@ -246,7 +246,7 @@ class ContextualLinkManagerTest extends UnitTestCase {
$this->moduleHandler->expects($this->exactly(2)) $this->moduleHandler->expects($this->exactly(2))
->method('alter') ->method('alter')
->willReturnOnConsecutiveCalls( ->withConsecutive(
['contextual_links_plugins'], ['contextual_links_plugins'],
['contextual_links', new Count(2), 'group1', ['key' => 'value']], ['contextual_links', new Count(2), 'group1', ['key' => 'value']],
); );

View File

@ -186,7 +186,7 @@ class LocalTaskManagerTest extends UnitTestCase {
); );
$this->cacheBackend->expects($this->exactly(2)) $this->cacheBackend->expects($this->exactly(2))
->method('set') ->method('set')
->willReturnOnConsecutiveCalls( ->withConsecutive(
['local_task_plugins:en', $definitions, Cache::PERMANENT], ['local_task_plugins:en', $definitions, Cache::PERMANENT],
['local_task_plugins:en:menu_local_task_test_tasks_view', $this->getLocalTasksCache(), Cache::PERMANENT, ['local_task']], ['local_task_plugins:en:menu_local_task_test_tasks_view', $this->getLocalTasksCache(), Cache::PERMANENT, ['local_task']],
); );