From 76a1fb8ece86bbc2153cafc054884f415e28c9ae Mon Sep 17 00:00:00 2001 From: catch Date: Mon, 21 Jun 2021 11:27:34 +0100 Subject: [PATCH] Issue #2879159 by Spokje, LoMo, ravi.shankar, quietone, mondrake: Some calls to assertEquals have expected/actual parameters reversed (cherry picked from commit e48dcff470803ab5c139120c4a8f7e83ca2b04e2) --- .../src/Unit/CommentStatisticsUnitTest.php | 2 +- .../dblog/tests/src/Functional/DbLogTest.php | 6 +- .../Kernel/Migrate/d7/MigrateFieldTest.php | 8 +- .../ManageDisplayTest.php | 4 +- .../tests/src/Kernel/FilterKernelTest.php | 86 +++++++++---------- .../Migrate/d6/FilterFormatPermissionTest.php | 2 +- .../hal/tests/src/Kernel/DenormalizeTest.php | 2 +- .../tests/src/Unit/HelpTopicTwigTest.php | 6 +- .../image/tests/src/Kernel/ImageItemTest.php | 2 +- .../image/tests/src/Unit/ImageStyleTest.php | 2 +- .../JsonApiDocumentTopLevelNormalizerTest.php | 6 +- .../tests/src/Kernel/Query/FilterTest.php | 16 ++-- .../src/Unit/ConfigurableLanguageUnitTest.php | 4 +- .../FunctionalJavascript/InlineBlockTest.php | 2 +- .../LayoutBuilderEntityViewDisplayTest.php | 4 +- .../Functional/LocaleImportFunctionalTest.php | 2 +- .../Kernel/Migrate/d7/MigrateMenuLinkTest.php | 2 +- .../process/DownloadFunctionalTest.php | 2 +- .../tests/src/Kernel/MigrateBundleTest.php | 10 +-- .../tests/src/Kernel/MigrateSkipRowTest.php | 2 +- .../tests/src/Unit/MigrateSqlIdMapTest.php | 4 +- .../tests/src/Unit/destination/ConfigTest.php | 4 +- .../src/Kernel/NodeFieldOverridesTest.php | 2 +- .../path_alias/tests/src/Kernel/AliasTest.php | 4 +- .../rest/tests/src/Unit/CollectRoutesTest.php | 2 +- .../src/Kernel/EntitySerializationTest.php | 4 +- .../SettingsTrayBlockFormTest.php | 4 +- .../SettingsTrayTestBase.php | 4 +- .../Render/HtmlResponseAttachmentsTest.php | 7 +- .../Kernel/Extension/ModuleHandlerTest.php | 2 +- .../src/Functional/UpdateContribTest.php | 4 +- .../src/Functional/RestRegisterUserTest.php | 2 +- .../tests/src/Kernel/UserRoleEntityTest.php | 6 +- .../tests/src/Unit/PermissionHandlerTest.php | 28 +++--- .../tests/src/Unit/ViewExecutableTest.php | 4 +- .../src/Functional/FilterNumericWebTest.php | 2 +- ...erInputMappingOnFieldDeltaElementsTest.php | 4 +- .../Update/UpdatePathTestBaseTest.php | 2 +- .../Core/Action/EmailActionTest.php | 4 +- .../Core/Entity/EntityDuplicateTest.php | 2 +- .../EntityHasFieldConstraintValidatorTest.php | 2 +- .../Entity/EntityRevisionTranslationTest.php | 4 +- .../Annotation/Doctrine/DocParserTest.php | 20 ++--- .../DependencyInjection/ContainerTest.php | 10 +-- .../Component/Discovery/YamlDiscoveryTest.php | 2 +- .../Tests/Component/Utility/XssTest.php | 2 +- .../Tests/Core/Access/AccessManagerTest.php | 6 +- .../Tests/Core/Ajax/AjaxResponseTest.php | 2 +- .../Core/Database/EmptyStatementTest.php | 2 +- .../Tests/Core/Database/OrderByTest.php | 2 +- .../Enhancer/EntityRouteEnhancerTest.php | 10 +-- .../Core/Extension/InfoParserUnitTest.php | 8 +- .../Core/Extension/ModuleHandlerTest.php | 2 +- .../Tests/Core/Logger/LoggerChannelTest.php | 2 +- .../Plugin/Discovery/HookDiscoveryTest.php | 24 +++--- .../Drupal/Tests/Core/Render/RendererTest.php | 2 +- .../Routing/ContentTypeHeaderMatcherTest.php | 2 +- .../Tests/Core/Routing/RouteCompilerTest.php | 8 +- .../Tests/Core/Routing/UrlGeneratorTest.php | 2 +- .../Tests/Core/Template/TwigSandboxTest.php | 12 +-- .../Tests/Core/Test/JUnitConverterTest.php | 8 +- 61 files changed, 198 insertions(+), 199 deletions(-) diff --git a/core/modules/comment/tests/src/Unit/CommentStatisticsUnitTest.php b/core/modules/comment/tests/src/Unit/CommentStatisticsUnitTest.php index 068d77bb415..f24f456ced1 100644 --- a/core/modules/comment/tests/src/Unit/CommentStatisticsUnitTest.php +++ b/core/modules/comment/tests/src/Unit/CommentStatisticsUnitTest.php @@ -97,7 +97,7 @@ class CommentStatisticsUnitTest extends UnitTestCase { public function testRead() { $this->calls_to_fetch = 0; $results = $this->commentStatistics->read(['1' => 'boo', '2' => 'foo'], 'snafus'); - $this->assertEquals($results, ['something', 'something-else']); + $this->assertEquals(['something', 'something-else'], $results); } /** diff --git a/core/modules/dblog/tests/src/Functional/DbLogTest.php b/core/modules/dblog/tests/src/Functional/DbLogTest.php index 33550b37f8d..9853314eeb7 100644 --- a/core/modules/dblog/tests/src/Functional/DbLogTest.php +++ b/core/modules/dblog/tests/src/Functional/DbLogTest.php @@ -876,9 +876,9 @@ class DbLogTest extends BrowserTestBase { $this->drupalGet('admin/reports/dblog'); $entries = $this->getLogEntries(); - $this->assertEquals($entries[0]['message'], 'Third Entry #0'); - $this->assertEquals($entries[1]['message'], 'Second Entry #0'); - $this->assertEquals($entries[2]['message'], 'First Entry #0'); + $this->assertEquals('Third Entry #0', $entries[0]['message']); + $this->assertEquals('Second Entry #0', $entries[1]['message']); + $this->assertEquals('First Entry #0', $entries[2]['message']); } /** diff --git a/core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldTest.php b/core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldTest.php index 0ab9010c76a..1ad4c722cff 100644 --- a/core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldTest.php +++ b/core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldTest.php @@ -182,10 +182,10 @@ class MigrateFieldTest extends MigrateDrupal7TestBase { }, iterator_to_array($migration->getIdMap()->getMessages())); sort($errors); $this->assertCount(4, $errors); - $this->assertEquals($errors[0], 'Can\'t migrate source field field_text_long_plain_filtered configured with both plain text and filtered text processing. See https://www.drupal.org/docs/8/upgrade/known-issues-when-upgrading-from-drupal-6-or-7-to-drupal-8#plain-text'); - $this->assertEquals($errors[1], 'Can\'t migrate source field field_text_plain_filtered configured with both plain text and filtered text processing. See https://www.drupal.org/docs/8/upgrade/known-issues-when-upgrading-from-drupal-6-or-7-to-drupal-8#plain-text'); - $this->assertEquals($errors[2], 'Can\'t migrate source field field_text_sum_plain of type text_with_summary configured with plain text processing. See https://www.drupal.org/docs/8/upgrade/known-issues-when-upgrading-from-drupal-6-or-7-to-drupal-8#plain-text'); - $this->assertEquals($errors[3], 'Can\'t migrate source field field_text_sum_plain_filtered of type text_with_summary configured with plain text processing. See https://www.drupal.org/docs/8/upgrade/known-issues-when-upgrading-from-drupal-6-or-7-to-drupal-8#plain-text'); + $this->assertEquals('Can\'t migrate source field field_text_long_plain_filtered configured with both plain text and filtered text processing. See https://www.drupal.org/docs/8/upgrade/known-issues-when-upgrading-from-drupal-6-or-7-to-drupal-8#plain-text', $errors[0]); + $this->assertEquals('Can\'t migrate source field field_text_plain_filtered configured with both plain text and filtered text processing. See https://www.drupal.org/docs/8/upgrade/known-issues-when-upgrading-from-drupal-6-or-7-to-drupal-8#plain-text', $errors[1]); + $this->assertEquals('Can\'t migrate source field field_text_sum_plain of type text_with_summary configured with plain text processing. See https://www.drupal.org/docs/8/upgrade/known-issues-when-upgrading-from-drupal-6-or-7-to-drupal-8#plain-text', $errors[2]); + $this->assertEquals('Can\'t migrate source field field_text_sum_plain_filtered of type text_with_summary configured with plain text processing. See https://www.drupal.org/docs/8/upgrade/known-issues-when-upgrading-from-drupal-6-or-7-to-drupal-8#plain-text', $errors[3]); } } diff --git a/core/modules/field_ui/tests/src/FunctionalJavascript/ManageDisplayTest.php b/core/modules/field_ui/tests/src/FunctionalJavascript/ManageDisplayTest.php index 17cc3e45072..4c84a7a12a6 100644 --- a/core/modules/field_ui/tests/src/FunctionalJavascript/ManageDisplayTest.php +++ b/core/modules/field_ui/tests/src/FunctionalJavascript/ManageDisplayTest.php @@ -182,7 +182,7 @@ class ManageDisplayTest extends WebDriverTestBase { $id = 'node.' . $this->type . '.default'; /** @var \Drupal\Core\Entity\Display\EntityViewDisplayInterface $display */ $display = $display_storage->loadUnchanged($id); - $this->assertEquals($display->getRenderer('field_test')->getThirdPartySetting('field_third_party_test', 'field_test_field_formatter_third_party_settings_form'), 'foo'); + $this->assertEquals('foo', $display->getRenderer('field_test')->getThirdPartySetting('field_third_party_test', 'field_test_field_formatter_third_party_settings_form')); $this->assertContains('field_third_party_test', $display->calculateDependencies()->getDependencies()['module'], 'The display has a dependency on field_third_party_test module.'); // Change the formatter to an empty setting and validate it's initialized @@ -329,7 +329,7 @@ class ManageDisplayTest extends WebDriverTestBase { /** @var \Drupal\Core\Entity\Display\EntityFormDisplayInterface $display */ $display = $form_storage->loadUnchanged('node.' . $this->type . '.default'); - $this->assertEquals($display->getRenderer('field_test')->getThirdPartySetting('field_third_party_test', 'field_test_widget_third_party_settings_form'), 'foo'); + $this->assertEquals('foo', $display->getRenderer('field_test')->getThirdPartySetting('field_third_party_test', 'field_test_widget_third_party_settings_form')); $this->assertContains('field_third_party_test', $display->calculateDependencies()->getDependencies()['module'], 'Form display does not have a dependency on field_third_party_test module.'); // Creates a new field that can not be used with the multiple formatter. diff --git a/core/modules/filter/tests/src/Kernel/FilterKernelTest.php b/core/modules/filter/tests/src/Kernel/FilterKernelTest.php index d471600a777..f26a1b4286f 100644 --- a/core/modules/filter/tests/src/Kernel/FilterKernelTest.php +++ b/core/modules/filter/tests/src/Kernel/FilterKernelTest.php @@ -937,116 +937,116 @@ www.example.com with a newline in comments --> public function testHtmlCorrectorFilter() { // Tag closing. $f = Html::normalize('

text'); - $this->assertEquals($f, '

text

', 'HTML corrector -- tag closing at the end of input.'); + $this->assertEquals('

text

', $f, 'HTML corrector -- tag closing at the end of input.'); $f = Html::normalize('

text

text'); - $this->assertEquals($f, '

text

text

', 'HTML corrector -- tag closing.'); + $this->assertEquals('

text

text

', $f, 'HTML corrector -- tag closing.'); $f = Html::normalize("