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

View File

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

View File

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

View File

@ -96,7 +96,7 @@ class EntityNormalizerTest extends UnitTestCase {
->getMock();
$serializer->expects($this->exactly(2))
->method('normalize')
->willReturnOnConsecutiveCalls(
->withConsecutive(
[$list_item_1, 'test_format'],
[$list_item_2, 'test_format'],
);
@ -222,7 +222,7 @@ class EntityNormalizerTest extends UnitTestCase {
->getMock();
$serializer->expects($this->exactly(2))
->method('denormalize')
->willReturnOnConsecutiveCalls(
->withConsecutive(
['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']],
);
@ -371,7 +371,7 @@ class EntityNormalizerTest extends UnitTestCase {
->getMock();
$serializer->expects($this->exactly(2))
->method('denormalize')
->willReturnOnConsecutiveCalls(
->withConsecutive(
['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']],
);

View File

@ -369,7 +369,7 @@ class ViewsDataTest extends UnitTestCase {
);
$this->cacheBackend->expects($this->exactly(2))
->method('set')
->willReturnOnConsecutiveCalls(
->withConsecutive(
['views_data:en', $expected_views_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))
->method('set')
->willReturnOnConsecutiveCalls(
->withConsecutive(
["views_data:$table_name:en", $expected_views_data[$table_name]],
["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() {
$this->cacheTagsInvalidator->expects($this->exactly(2))
->method('invalidateTags')
->willReturnOnConsecutiveCalls([
->withConsecutive([
[
// List cache tag.
$this->entityTypeId . '_list',
@ -430,7 +430,7 @@ class EntityUnitTest extends UnitTestCase {
public function testPostSaveBundle() {
$this->cacheTagsInvalidator->expects($this->exactly(2))
->method('invalidateTags')
->willReturnOnConsecutiveCalls([
->withConsecutive([
[
// List cache tag.
$this->entityTypeId . '_list',

View File

@ -158,7 +158,7 @@ class KeyValueEntityStorageTest extends UnitTestCase {
$this->moduleHandler->expects($this->exactly(2))
->method('invokeAll')
->willReturnOnConsecutiveCalls(['test_entity_type_create'], ['entity_create']);
->withConsecutive(['test_entity_type_create'], ['entity_create']);
$this->uuidService->expects($this->never())
->method('generate');
@ -181,7 +181,7 @@ class KeyValueEntityStorageTest extends UnitTestCase {
$this->moduleHandler->expects($this->exactly(2))
->method('invokeAll')
->willReturnOnConsecutiveCalls(['test_entity_type_create'], ['entity_create']);
->withConsecutive(['test_entity_type_create'], ['entity_create']);
$this->uuidService->expects($this->never())
->method('generate');
@ -206,7 +206,7 @@ class KeyValueEntityStorageTest extends UnitTestCase {
$this->moduleHandler->expects($this->exactly(2))
->method('invokeAll')
->willReturnOnConsecutiveCalls(['test_entity_type_create'], ['entity_create']);
->withConsecutive(['test_entity_type_create'], ['entity_create']);
$this->uuidService->expects($this->once())
->method('generate')
->willReturn('bar');
@ -248,7 +248,7 @@ class KeyValueEntityStorageTest extends UnitTestCase {
$this->moduleHandler->expects($this->exactly(4))
->method('invokeAll')
->willReturnOnConsecutiveCalls(
->withConsecutive(
['test_entity_type_presave'],
['entity_presave'],
['test_entity_type_insert'],
@ -292,7 +292,7 @@ class KeyValueEntityStorageTest extends UnitTestCase {
->method('delete');
$this->moduleHandler->expects($this->exactly(4))
->method('invokeAll')
->willReturnOnConsecutiveCalls(
->withConsecutive(
['test_entity_type_presave'],
['entity_presave'],
['test_entity_type_update'],
@ -574,7 +574,7 @@ class KeyValueEntityStorageTest extends UnitTestCase {
$this->moduleHandler->expects($this->exactly(8))
->method('invokeAll')
->willReturnOnConsecutiveCalls(
->withConsecutive(
['test_entity_type_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.
$this->dbSchemaHandler->expects($this->exactly(3))
->method('dropIndex')
->willReturnOnConsecutiveCalls(
->withConsecutive(
['entity_test', 'entity_test__b588603cb9'],
['entity_test', 'entity_test__removed_field'],
);

View File

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

View File

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

View File

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

View File

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

View File

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