From d722e9d760ecd6eb81d668f5ecbb44a1cdf7e1f2 Mon Sep 17 00:00:00 2001 From: catch <catch@35733.no-reply.drupal.org> Date: Mon, 18 Jan 2021 17:35:30 +0000 Subject: [PATCH] Issue #3192221 by mondrake, daffie, longwave: Swap assertIdentical arguments in preparation to replace with assertSame --- .../block/tests/src/Functional/BlockTest.php | 8 +-- .../src/Functional/Views/DisplayBlockTest.php | 4 +- .../tests/src/Kernel/BlockInterfaceTest.php | 8 +-- .../tests/src/Kernel/BlockStorageUnitTest.php | 2 +- .../tests/src/Kernel/BlockViewBuilderTest.php | 6 +- .../src/Functional/BlockContentListTest.php | 2 +- .../Functional/BlockContentListViewsTest.php | 6 +- .../src/Functional/BlockContentSaveTest.php | 2 +- .../src/Functional/CommentFieldsTest.php | 4 +- .../tests/src/Functional/CommentLinksTest.php | 2 +- .../ConfigEntityFormOverrideTest.php | 4 +- .../src/Functional/ConfigEntityListTest.php | 8 +-- .../tests/src/Functional/ConfigEntityTest.php | 54 +++++++------- .../src/Functional/ConfigExportUITest.php | 4 +- .../src/Functional/ConfigFormOverrideTest.php | 4 +- .../src/Functional/ConfigImportAllTest.php | 4 +- .../src/Functional/ConfigImportUITest.php | 4 +- .../ConfigInstallProfileOverrideTest.php | 4 +- .../src/Functional/ConfigInstallWebTest.php | 10 +-- .../ConfigSingleImportExportTest.php | 12 ++-- .../ContentTranslationConfigImportTest.php | 2 +- .../ContextualDynamicContextTest.php | 16 ++--- .../tests/src/Kernel/ContextualUnitTest.php | 4 +- .../tests/src/Functional/EditorAdminTest.php | 4 +- .../src/Functional/EditorSecurityTest.php | 2 +- .../src/Kernel/QuickEditIntegrationTest.php | 2 +- .../EntityReferenceAdminTest.php | 4 +- .../field/tests/src/Functional/FormTest.php | 2 +- .../EntityReferenceAdminTest.php | 2 +- .../tests/src/Kernel/FieldAttachOtherTest.php | 6 +- .../field/tests/src/Kernel/FieldCrudTest.php | 2 +- .../tests/src/Kernel/FieldDataCountTest.php | 8 +-- .../src/Kernel/FieldImportDeleteTest.php | 10 +-- .../Kernel/FieldImportDeleteUninstallTest.php | 4 +- .../tests/src/Kernel/FieldStorageCrudTest.php | 4 +- .../src/Kernel/String/UuidFormatterTest.php | 8 +-- .../src/Functional/ManageDisplayTest.php | 2 +- .../tests/src/Kernel/EntityDisplayTest.php | 2 +- .../src/Functional/FileFieldWidgetTest.php | 2 +- .../FileFieldWidgetTest.php | 2 +- .../tests/src/Kernel/FilterCrudTest.php | 2 +- .../tests/src/Kernel/FilterKernelTest.php | 26 +++---- .../src/Functional/ImageStyleDeleteTest.php | 2 +- .../src/Functional/LanguageSwitchingTest.php | 24 +++---- .../LanguageDependencyInjectionTest.php | 4 +- .../src/Kernel/Views/FilterLanguageTest.php | 2 +- .../link/tests/src/Kernel/LinkItemTest.php | 4 +- .../Functional/LocaleImportFunctionalTest.php | 6 +- .../src/Functional/LocalePluralFormatTest.php | 6 +- .../src/Kernel/LocaleConfigSubscriberTest.php | 2 +- .../src/Kernel/MigrateEmbeddedDataTest.php | 6 +- .../tests/src/Kernel/MigrateEventsTest.php | 36 +++++----- .../tests/src/Kernel/MigrateMessageTest.php | 2 +- .../tests/src/Kernel/MigrateStatusTest.php | 4 +- .../Functional/NodeAccessBaseTableTest.php | 8 +-- .../tests/src/Functional/NodeEditFormTest.php | 4 +- .../Kernel/Migrate/d6/MigrateNodeTypeTest.php | 4 +- .../OptionsFloatFieldImportTest.php | 8 +-- .../tests/src/Functional/PageCacheTest.php | 4 +- .../src/Functional/UrlAlterFunctionalTest.php | 4 +- .../QuickEditCustomPipelineTest.php | 2 +- .../Views/ExcludedFieldTokenTest.php | 2 +- .../src/Functional/Views/FieldCounterTest.php | 2 +- .../Functional/Views/StyleSerializerTest.php | 18 ++--- .../SearchConfigSettingsFormTest.php | 16 ++--- .../Migrate/d6/MigrateSearchPageTest.php | 4 +- .../tests/src/Kernel/SearchSimplifyTest.php | 2 +- .../src/Kernel/EntitySerializationTest.php | 20 +++--- .../tests/src/Kernel/SerializationTest.php | 2 +- .../tests/src/Functional/ShortcutSetsTest.php | 2 +- .../src/Functional/StatisticsLoggingTest.php | 4 +- .../AssertPageCacheContextsAndTagsTrait.php | 4 +- .../src/Functional/Form/CheckboxTest.php | 8 +-- .../tests/src/Functional/Form/ElementTest.php | 4 +- .../tests/src/Functional/Form/EmailTest.php | 2 +- .../tests/src/Functional/Form/FormTest.php | 6 +- .../tests/src/Functional/Form/UrlTest.php | 2 +- .../src/Functional/Module/DependencyTest.php | 2 +- .../src/Functional/Module/InstallTest.php | 4 +- .../Functional/Theme/TwigExtensionTest.php | 8 +-- .../FunctionalJavascript/FrameworkTest.php | 2 +- .../Kernel/Extension/ModuleHandlerTest.php | 2 +- .../tests/src/Kernel/Theme/ThemeTest.php | 12 ++-- .../tests/src/Functional/TermTest.php | 8 +-- .../src/Kernel/TermEntityReferenceTest.php | 2 +- .../text/tests/src/Kernel/TextSummaryTest.php | 5 +- .../tests/src/Functional/UserLoginTest.php | 4 +- .../src/Functional/UserRoleAdminTest.php | 2 +- .../Migrate/MigrateUserAdminPassTest.php | 10 +-- .../src/Kernel/UserAccountFormFieldsTest.php | 2 +- .../tests/src/Traits/UserCreationTrait.php | 5 +- .../src/Functional/Plugin/DisplayTest.php | 2 +- .../src/Functional/Plugin/FilterTest.php | 14 ++-- .../src/Functional/Plugin/MiniPagerTest.php | 2 +- .../src/Kernel/Handler/FieldKernelTest.php | 70 +++++++++---------- .../src/Kernel/Handler/HandlerAliasTest.php | 16 ++--- .../views/tests/src/Kernel/ModuleTest.php | 6 +- .../tests/src/Kernel/Plugin/CacheTest.php | 2 +- .../src/Kernel/Plugin/PluginBaseTest.php | 8 +-- .../tests/src/Kernel/Plugin/SqlQueryTest.php | 4 +- .../src/Kernel/Plugin/StyleTableUnitTest.php | 14 ++-- .../tests/src/Kernel/TokenReplaceTest.php | 6 +- .../tests/src/Kernel/ViewExecutableTest.php | 10 +-- .../tests/src/Functional/DisplayTest.php | 2 +- .../tests/src/Functional/HandlerTest.php | 2 +- .../tests/src/Functional/ViewEditTest.php | 2 +- .../Drupal/KernelTests/AssertContentTrait.php | 2 +- .../Core/Asset/AttachedAssetsTest.php | 14 ++-- .../Core/Bootstrap/GetFilenameTest.php | 8 +-- .../Cache/GenericCacheBackendUnitTestBase.php | 14 ++-- .../KernelTests/Core/Command/DbDumpTest.php | 2 +- .../KernelTests/Core/Common/XssUnitTest.php | 4 +- .../Core/Config/ConfigCRUDTest.php | 40 +++++------ .../Core/Config/ConfigDiffTest.php | 4 +- .../Config/ConfigEntityStaticCacheTest.php | 8 +-- .../Core/Config/ConfigEntityStorageTest.php | 2 +- .../Core/Config/ConfigEntityUnitTest.php | 4 +- .../Core/Config/ConfigEventsTest.php | 38 +++++----- .../Core/Config/ConfigImporterTest.php | 18 ++--- .../Config/ConfigLanguageOverrideTest.php | 12 ++-- .../Core/Config/ConfigModuleOverridesTest.php | 2 +- .../Core/Config/ConfigOverrideTest.php | 44 ++++++------ .../Core/Config/ConfigSchemaTest.php | 15 ++-- .../Core/Config/ConfigSnapshotTest.php | 2 +- .../Config/Storage/ConfigStorageTestBase.php | 14 ++-- .../Core/Config/Storage/FileStorageTest.php | 2 +- .../Core/Database/BasicSyntaxTest.php | 16 ++--- .../Core/Database/CaseSensitivityTest.php | 2 +- .../Core/Database/ConnectionTest.php | 2 +- .../Core/Database/DeleteTruncateTest.php | 2 +- .../KernelTests/Core/Database/FetchTest.php | 2 +- .../KernelTests/Core/Database/InsertTest.php | 38 +++++----- .../KernelTests/Core/Database/SchemaTest.php | 2 +- .../Core/Database/TransactionTest.php | 4 +- .../Core/Database/UpdateComplexTest.php | 26 +++---- .../KernelTests/Core/Database/UpdateTest.php | 30 ++++---- .../DrupalKernel/DrupalKernelSiteTest.php | 4 +- .../Core/Entity/ConfigEntityQueryTest.php | 36 +++++----- .../Entity/EntityAccessControlHandlerTest.php | 5 +- .../Core/Entity/EntityAutocompleteTest.php | 10 +-- .../Entity/EntityDefinitionUpdateTest.php | 12 ++-- .../Core/Entity/EntityFieldTest.php | 6 +- .../Core/Entity/EntityQueryTest.php | 12 ++-- .../EntityReferenceSelectionSortTest.php | 4 +- .../Core/Entity/EntityUUIDTest.php | 8 +-- .../Core/Form/FormDefaultHandlersTest.php | 8 +-- .../DatabaseStorageExpirableTest.php | 2 +- .../KeyValueContentEntityStorageTest.php | 40 +++++------ .../Core/KeyValueStore/StorageTestBase.php | 12 ++-- .../Plugin/Discovery/DiscoveryTestBase.php | 4 +- .../KernelTests/Core/Plugin/FactoryTest.php | 10 +-- .../Core/Plugin/InspectionTest.php | 12 ++-- .../Render/Element/RenderElementTypesTest.php | 2 +- .../Core/Theme/ThemeInstallerTest.php | 2 +- .../Core/Theme/ThemeSettingsTest.php | 2 +- .../Core/TypedData/TypedDataTest.php | 22 +++--- 156 files changed, 645 insertions(+), 667 deletions(-) diff --git a/core/modules/block/tests/src/Functional/BlockTest.php b/core/modules/block/tests/src/Functional/BlockTest.php index c1b66a843e3a..6a6feb98932b 100644 --- a/core/modules/block/tests/src/Functional/BlockTest.php +++ b/core/modules/block/tests/src/Functional/BlockTest.php @@ -403,7 +403,7 @@ public function testBlockCacheTags() { ]; sort($expected_cache_tags); $keys = \Drupal::service('cache_contexts_manager')->convertTokensToKeys(['languages:language_interface', 'theme', 'user.permissions'])->getKeys(); - $this->assertIdentical($cache_entry->tags, $expected_cache_tags); + $this->assertIdentical($expected_cache_tags, $cache_entry->tags); $cache_entry = \Drupal::cache('render')->get('entity_view:block:powered:' . implode(':', $keys)); $expected_cache_tags = [ 'block_view', @@ -411,7 +411,7 @@ public function testBlockCacheTags() { 'rendered', ]; sort($expected_cache_tags); - $this->assertIdentical($cache_entry->tags, $expected_cache_tags); + $this->assertIdentical($expected_cache_tags, $cache_entry->tags); // The "Powered by Drupal" block is modified; verify a cache miss. $block->setRegion('content'); @@ -453,7 +453,7 @@ public function testBlockCacheTags() { sort($expected_cache_tags); $keys = \Drupal::service('cache_contexts_manager')->convertTokensToKeys(['languages:language_interface', 'theme', 'user.permissions'])->getKeys(); $cache_entry = \Drupal::cache('render')->get('entity_view:block:powered:' . implode(':', $keys)); - $this->assertIdentical($cache_entry->tags, $expected_cache_tags); + $this->assertIdentical($expected_cache_tags, $cache_entry->tags); $expected_cache_tags = [ 'block_view', 'config:block.block.powered-2', @@ -462,7 +462,7 @@ public function testBlockCacheTags() { sort($expected_cache_tags); $keys = \Drupal::service('cache_contexts_manager')->convertTokensToKeys(['languages:language_interface', 'theme', 'user.permissions'])->getKeys(); $cache_entry = \Drupal::cache('render')->get('entity_view:block:powered-2:' . implode(':', $keys)); - $this->assertIdentical($cache_entry->tags, $expected_cache_tags); + $this->assertIdentical($expected_cache_tags, $cache_entry->tags); // Now we should have a cache hit again. $this->drupalGet('<front>'); diff --git a/core/modules/block/tests/src/Functional/Views/DisplayBlockTest.php b/core/modules/block/tests/src/Functional/Views/DisplayBlockTest.php index 7096584e85e4..8d86dbfad4e6 100644 --- a/core/modules/block/tests/src/Functional/Views/DisplayBlockTest.php +++ b/core/modules/block/tests/src/Functional/Views/DisplayBlockTest.php @@ -395,8 +395,8 @@ public function testBlockContextualLinks() { $this->getSession()->getDriver()->getClient()->request('POST', $url, $post); $this->assertSession()->statusCodeEquals(200); $json = Json::decode($this->getSession()->getPage()->getContent()); - $this->assertIdentical($json[$id], '<ul class="contextual-links"><li class="block-configure"><a href="' . base_path() . 'admin/structure/block/manage/' . $block->id() . '">Configure block</a></li><li class="entityviewedit-form"><a href="' . base_path() . 'admin/structure/views/view/test_view_block/edit/block_1">Edit view</a></li></ul>'); - $this->assertIdentical($json[$cached_id], '<ul class="contextual-links"><li class="block-configure"><a href="' . base_path() . 'admin/structure/block/manage/' . $cached_block->id() . '">Configure block</a></li><li class="entityviewedit-form"><a href="' . base_path() . 'admin/structure/views/view/test_view_block/edit/block_1">Edit view</a></li></ul>'); + $this->assertIdentical('<ul class="contextual-links"><li class="block-configure"><a href="' . base_path() . 'admin/structure/block/manage/' . $block->id() . '">Configure block</a></li><li class="entityviewedit-form"><a href="' . base_path() . 'admin/structure/views/view/test_view_block/edit/block_1">Edit view</a></li></ul>', $json[$id]); + $this->assertIdentical('<ul class="contextual-links"><li class="block-configure"><a href="' . base_path() . 'admin/structure/block/manage/' . $cached_block->id() . '">Configure block</a></li><li class="entityviewedit-form"><a href="' . base_path() . 'admin/structure/views/view/test_view_block/edit/block_1">Edit view</a></li></ul>', $json[$cached_id]); } } diff --git a/core/modules/block/tests/src/Kernel/BlockInterfaceTest.php b/core/modules/block/tests/src/Kernel/BlockInterfaceTest.php index b917d7184234..f58d3b4cf3de 100644 --- a/core/modules/block/tests/src/Kernel/BlockInterfaceTest.php +++ b/core/modules/block/tests/src/Kernel/BlockInterfaceTest.php @@ -44,12 +44,12 @@ public function testBlockInterface() { // Initial configuration of the block at construction time. /** @var $display_block \Drupal\Core\Block\BlockPluginInterface */ $display_block = $manager->createInstance('test_block_instantiation', $configuration); - $this->assertIdentical($display_block->getConfiguration(), $expected_configuration, 'The block was configured correctly.'); + $this->assertIdentical($expected_configuration, $display_block->getConfiguration(), 'The block was configured correctly.'); // Updating an element of the configuration. $display_block->setConfigurationValue('display_message', 'My custom display message.'); $expected_configuration['display_message'] = 'My custom display message.'; - $this->assertIdentical($display_block->getConfiguration(), $expected_configuration, 'The block configuration was updated correctly.'); + $this->assertIdentical($expected_configuration, $display_block->getConfiguration(), 'The block configuration was updated correctly.'); $definition = $display_block->getPluginDefinition(); $expected_form = [ @@ -93,11 +93,11 @@ public function testBlockInterface() { '#children' => 'My custom display message.', ]; // Ensure the build array is proper. - $this->assertIdentical($display_block->build(), $expected_build, 'The plugin returned the appropriate build array.'); + $this->assertIdentical($expected_build, $display_block->build(), 'The plugin returned the appropriate build array.'); // Ensure the machine name suggestion is correct. In truth, this is actually // testing BlockBase's implementation, not the interface itself. - $this->assertIdentical($display_block->getMachineNameSuggestion(), 'displaymessage', 'The plugin returned the expected machine name suggestion.'); + $this->assertIdentical('displaymessage', $display_block->getMachineNameSuggestion(), 'The plugin returned the expected machine name suggestion.'); } } diff --git a/core/modules/block/tests/src/Kernel/BlockStorageUnitTest.php b/core/modules/block/tests/src/Kernel/BlockStorageUnitTest.php index 0ca367fd1c66..aa0353700bd0 100644 --- a/core/modules/block/tests/src/Kernel/BlockStorageUnitTest.php +++ b/core/modules/block/tests/src/Kernel/BlockStorageUnitTest.php @@ -100,7 +100,7 @@ protected function createTests() { 'visibility' => [], ]; - $this->assertIdentical($actual_properties, $expected_properties); + $this->assertIdentical($expected_properties, $actual_properties); $this->assertInstanceOf(TestHtmlBlock::class, $entity->getPlugin()); } diff --git a/core/modules/block/tests/src/Kernel/BlockViewBuilderTest.php b/core/modules/block/tests/src/Kernel/BlockViewBuilderTest.php index 07a1b18cd045..24f2f208a1d4 100644 --- a/core/modules/block/tests/src/Kernel/BlockViewBuilderTest.php +++ b/core/modules/block/tests/src/Kernel/BlockViewBuilderTest.php @@ -188,14 +188,14 @@ public function testBlockViewBuilderViewAlter() { // Establish baseline. $build = $this->getBlockRenderArray(); $this->setRawContent((string) $this->renderer->renderRoot($build)); - $this->assertIdentical(trim((string) $this->cssSelect('div')[0]), 'Llamas > unicorns!'); + $this->assertIdentical('Llamas > unicorns!', trim((string) $this->cssSelect('div')[0])); // Enable the block view alter hook that adds a foo=bar attribute. \Drupal::state()->set('block_test_view_alter_suffix', TRUE); Cache::invalidateTags($this->block->getCacheTagsToInvalidate()); $build = $this->getBlockRenderArray(); $this->setRawContent((string) $this->renderer->renderRoot($build)); - $this->assertIdentical(trim((string) $this->cssSelect('[foo=bar]')[0]), 'Llamas > unicorns!'); + $this->assertIdentical('Llamas > unicorns!', trim((string) $this->cssSelect('[foo=bar]')[0])); \Drupal::state()->set('block_test_view_alter_suffix', FALSE); \Drupal::state()->set('block_test.content', NULL); @@ -206,7 +206,7 @@ public function testBlockViewBuilderViewAlter() { \Drupal::state()->set('block_test_view_alter_append_pre_render_prefix', TRUE); $build = $this->getBlockRenderArray(); $this->assertFalse(isset($build['#prefix']), 'The appended #pre_render callback has not yet run before rendering.'); - $this->assertIdentical((string) $this->renderer->renderRoot($build), 'Hiya!<br>'); + $this->assertIdentical('Hiya!<br>', (string) $this->renderer->renderRoot($build)); // Check that a cached block without content is altered. $this->assertArrayHasKey('#prefix', $build); $this->assertSame('Hiya!<br>', $build['#prefix']); diff --git a/core/modules/block_content/tests/src/Functional/BlockContentListTest.php b/core/modules/block_content/tests/src/Functional/BlockContentListTest.php index f1675e4fe89d..f8b71a888df1 100644 --- a/core/modules/block_content/tests/src/Functional/BlockContentListTest.php +++ b/core/modules/block_content/tests/src/Functional/BlockContentListTest.php @@ -76,7 +76,7 @@ public function testListing() { // Check the contents of each row cell. The first cell contains the label, // the second contains the machine name, and the third contains the // operations list. - $this->assertIdentical($elements[0]->getText(), $label); + $this->assertIdentical($label, $elements[0]->getText()); // Edit the entity using the operations link. $blocks = $this->container diff --git a/core/modules/block_content/tests/src/Functional/BlockContentListViewsTest.php b/core/modules/block_content/tests/src/Functional/BlockContentListViewsTest.php index f1bda0c77b00..fc709f5fd7a7 100644 --- a/core/modules/block_content/tests/src/Functional/BlockContentListViewsTest.php +++ b/core/modules/block_content/tests/src/Functional/BlockContentListViewsTest.php @@ -59,10 +59,10 @@ public function testListing() { $expected_items = ['Block description', 'Block type', 'Updated Sort ascending', 'Operations']; foreach ($elements as $key => $element) { if ($element->find('xpath', 'a')) { - $this->assertIdentical(trim($element->find('xpath', 'a')->getText()), $expected_items[$key]); + $this->assertIdentical($expected_items[$key], trim($element->find('xpath', 'a')->getText())); } else { - $this->assertIdentical(trim($element->getText()), $expected_items[$key]); + $this->assertIdentical($expected_items[$key], trim($element->getText())); } } @@ -88,7 +88,7 @@ public function testListing() { // Check the contents of each row cell. The first cell contains the label, // the second contains the machine name, and the third contains the // operations list. - $this->assertIdentical($elements[0]->find('xpath', 'a')->getText(), $label); + $this->assertIdentical($label, $elements[0]->find('xpath', 'a')->getText()); // Edit the entity using the operations link. $blocks = $this->container diff --git a/core/modules/block_content/tests/src/Functional/BlockContentSaveTest.php b/core/modules/block_content/tests/src/Functional/BlockContentSaveTest.php index 8381318c1949..6cefbf5a1dd2 100644 --- a/core/modules/block_content/tests/src/Functional/BlockContentSaveTest.php +++ b/core/modules/block_content/tests/src/Functional/BlockContentSaveTest.php @@ -56,7 +56,7 @@ public function testImport() { // Test the import saved. $block_by_id = BlockContent::load($test_id); $this->assertNotEmpty($block_by_id, 'Custom block load by block ID.'); - $this->assertIdentical($block_by_id->body->value, $block_array['body']['value']); + $this->assertIdentical($block_array['body']['value'], $block_by_id->body->value); } /** diff --git a/core/modules/comment/tests/src/Functional/CommentFieldsTest.php b/core/modules/comment/tests/src/Functional/CommentFieldsTest.php index 6d466e559f7e..e5b052f7d422 100644 --- a/core/modules/comment/tests/src/Functional/CommentFieldsTest.php +++ b/core/modules/comment/tests/src/Functional/CommentFieldsTest.php @@ -137,8 +137,8 @@ public function testCommentFieldLinksNonDefaultName() { $this->drupalGet('node'); $link_info = $this->getDrupalSettings()['comment']['newCommentsLinks']['node']['comment2']['2']; - $this->assertIdentical($link_info['new_comment_count'], 1); - $this->assertIdentical($link_info['first_new_comment_link'], $node->toUrl('canonical', ['fragment' => 'new'])->toString()); + $this->assertIdentical(1, $link_info['new_comment_count']); + $this->assertIdentical($node->toUrl('canonical', ['fragment' => 'new'])->toString(), $link_info['first_new_comment_link']); } /** diff --git a/core/modules/comment/tests/src/Functional/CommentLinksTest.php b/core/modules/comment/tests/src/Functional/CommentLinksTest.php index 8f55c7259c59..bd6e634a6231 100644 --- a/core/modules/comment/tests/src/Functional/CommentLinksTest.php +++ b/core/modules/comment/tests/src/Functional/CommentLinksTest.php @@ -116,7 +116,7 @@ public function testCommentLinks() { $element = $this->cssSelect('article.js-comment > div'); // Get last child element. $element = end($element); - $this->assertIdentical($element->getTagName(), 'div', 'Last element is comment body.'); + $this->assertIdentical('div', $element->getTagName(), 'Last element is comment body.'); // Change weight to make links go after comment body. $display_repository->getViewDisplay('comment', 'comment') diff --git a/core/modules/config/tests/src/Functional/ConfigEntityFormOverrideTest.php b/core/modules/config/tests/src/Functional/ConfigEntityFormOverrideTest.php index aba7e1a6b65c..7668a8d5fe21 100644 --- a/core/modules/config/tests/src/Functional/ConfigEntityFormOverrideTest.php +++ b/core/modules/config/tests/src/Functional/ConfigEntityFormOverrideTest.php @@ -53,7 +53,7 @@ public function testFormsWithOverrides() { // Test that the original label on the editing page is intact. $this->drupalGet('admin/structure/config_test/manage/dotted.default'); $elements = $this->xpath('//input[@name="label"]'); - $this->assertIdentical($elements[0]->getValue(), $original_label); + $this->assertIdentical($original_label, $elements[0]->getValue()); $this->assertNoText($overridden_label); // Change to a new label and test that the listing now has the edited label. @@ -68,7 +68,7 @@ public function testFormsWithOverrides() { // Test that the editing page now has the edited label. $this->drupalGet('admin/structure/config_test/manage/dotted.default'); $elements = $this->xpath('//input[@name="label"]'); - $this->assertIdentical($elements[0]->getValue(), $edited_label); + $this->assertIdentical($edited_label, $elements[0]->getValue()); // Test that the overridden label is still loaded with the entity. $this->assertEquals($overridden_label, $config_test_storage->load('dotted.default')->label()); diff --git a/core/modules/config/tests/src/Functional/ConfigEntityListTest.php b/core/modules/config/tests/src/Functional/ConfigEntityListTest.php index 8ea1d42d8366..ff5b56a4a2d1 100644 --- a/core/modules/config/tests/src/Functional/ConfigEntityListTest.php +++ b/core/modules/config/tests/src/Functional/ConfigEntityListTest.php @@ -121,7 +121,7 @@ public function testList() { ]); $entity->save(); $list = $controller->load(); - $this->assertIdentical(array_keys($list), ['beta', 'dotted.default', 'alpha', 'omega']); + $this->assertIdentical(['beta', 'dotted.default', 'alpha', 'omega'], array_keys($list)); // Test that config entities that do not support status, do not have // enable/disable operations. @@ -178,7 +178,7 @@ public function testListUI() { // Test the contents of each th cell. $expected_items = ['Label', 'Machine name', 'Operations']; foreach ($elements as $key => $element) { - $this->assertIdentical($element->getText(), $expected_items[$key]); + $this->assertIdentical($expected_items[$key], $element->getText()); } // Check the number of table row cells. @@ -188,8 +188,8 @@ public function testListUI() { // Check the contents of each row cell. The first cell contains the label, // the second contains the machine name, and the third contains the // operations list. - $this->assertIdentical($elements[0]->getText(), 'Default'); - $this->assertIdentical($elements[1]->getText(), 'dotted.default'); + $this->assertIdentical('Default', $elements[0]->getText()); + $this->assertIdentical('dotted.default', $elements[1]->getText()); $this->assertNotEmpty($elements[2]->find('xpath', '//ul'), 'Operations list found.'); // Add a new entity using the operations link. diff --git a/core/modules/config/tests/src/Functional/ConfigEntityTest.php b/core/modules/config/tests/src/Functional/ConfigEntityTest.php index 0335fbbe81a7..085df9e00ecb 100644 --- a/core/modules/config/tests/src/Functional/ConfigEntityTest.php +++ b/core/modules/config/tests/src/Functional/ConfigEntityTest.php @@ -45,12 +45,12 @@ public function testCRUD() { $empty = $storage->create(); $this->assertNull($empty->label); $this->assertNull($empty->style); - $this->assertIdentical($empty->language()->getId(), $default_langcode); + $this->assertIdentical($default_langcode, $empty->language()->getId()); // Verify ConfigEntity properties/methods on the newly created empty entity. $this->assertTrue($empty->isNew()); $this->assertNull($empty->getOriginalId()); - $this->assertIdentical($empty->bundle(), 'config_test'); + $this->assertIdentical('config_test', $empty->bundle()); $this->assertNull($empty->id()); $this->assertTrue(Uuid::isValid($empty->uuid())); $this->assertNull($empty->label()); @@ -59,10 +59,10 @@ public function testCRUD() { $this->assertTrue(Uuid::isValid($empty->get('uuid'))); $this->assertNull($empty->get('label')); $this->assertNull($empty->get('style')); - $this->assertIdentical($empty->language()->getId(), $default_langcode); + $this->assertIdentical($default_langcode, $empty->language()->getId()); // Verify Entity properties/methods on the newly created empty entity. - $this->assertIdentical($empty->getEntityTypeId(), 'config_test'); + $this->assertIdentical('config_test', $empty->getEntityTypeId()); // The URI can only be checked after saving. try { $empty->toUrl(); @@ -101,17 +101,17 @@ public function testCRUD() { 'style' => $this->randomMachineName(), ]); $this->assertNotEquals($empty->uuid(), $config_test->uuid()); - $this->assertIdentical($config_test->label, $expected['label']); - $this->assertIdentical($config_test->style, $expected['style']); - $this->assertIdentical($config_test->language()->getId(), $default_langcode); + $this->assertIdentical($expected['label'], $config_test->label); + $this->assertIdentical($expected['style'], $config_test->style); + $this->assertIdentical($default_langcode, $config_test->language()->getId()); // Verify methods on the newly created entity. $this->assertTrue($config_test->isNew()); - $this->assertIdentical($config_test->getOriginalId(), $expected['id']); - $this->assertIdentical($config_test->id(), $expected['id']); + $this->assertIdentical($expected['id'], $config_test->getOriginalId()); + $this->assertIdentical($expected['id'], $config_test->id()); $this->assertTrue(Uuid::isValid($config_test->uuid())); $expected['uuid'] = $config_test->uuid(); - $this->assertIdentical($config_test->label(), $expected['label']); + $this->assertIdentical($expected['label'], $config_test->label()); // Verify that the entity can be saved. try { @@ -122,24 +122,24 @@ public function testCRUD() { } // The entity path can only be checked after saving. - $this->assertIdentical($config_test->toUrl()->toString(), Url::fromRoute('entity.config_test.edit_form', ['config_test' => $expected['id']])->toString()); + $this->assertIdentical(Url::fromRoute('entity.config_test.edit_form', ['config_test' => $expected['id']])->toString(), $config_test->toUrl()->toString()); // Verify that the correct status is returned and properties did not change. - $this->assertIdentical($status, SAVED_NEW); - $this->assertIdentical($config_test->id(), $expected['id']); - $this->assertIdentical($config_test->uuid(), $expected['uuid']); - $this->assertIdentical($config_test->label(), $expected['label']); + $this->assertIdentical(SAVED_NEW, $status); + $this->assertIdentical($expected['id'], $config_test->id()); + $this->assertIdentical($expected['uuid'], $config_test->uuid()); + $this->assertIdentical($expected['label'], $config_test->label()); $this->assertFalse($config_test->isNew()); - $this->assertIdentical($config_test->getOriginalId(), $expected['id']); + $this->assertIdentical($expected['id'], $config_test->getOriginalId()); // Save again, and verify correct status and properties again. $status = $config_test->save(); - $this->assertIdentical($status, SAVED_UPDATED); - $this->assertIdentical($config_test->id(), $expected['id']); - $this->assertIdentical($config_test->uuid(), $expected['uuid']); - $this->assertIdentical($config_test->label(), $expected['label']); + $this->assertIdentical(SAVED_UPDATED, $status); + $this->assertIdentical($expected['id'], $config_test->id()); + $this->assertIdentical($expected['uuid'], $config_test->uuid()); + $this->assertIdentical($expected['label'], $config_test->label()); $this->assertFalse($config_test->isNew()); - $this->assertIdentical($config_test->getOriginalId(), $expected['id']); + $this->assertIdentical($expected['id'], $config_test->getOriginalId()); // Verify that a configuration entity can be saved with an ID of the // maximum allowed length, but not longer. @@ -201,19 +201,19 @@ public function testCRUD() { $old_id = $ids[$i - 1]; $new_id = $ids[$i]; // Before renaming, everything should point to the current ID. - $this->assertIdentical($config_test->id(), $old_id); - $this->assertIdentical($config_test->getOriginalId(), $old_id); + $this->assertIdentical($old_id, $config_test->id()); + $this->assertIdentical($old_id, $config_test->getOriginalId()); // Rename. $config_test->set('id', $new_id); - $this->assertIdentical($config_test->id(), $new_id); + $this->assertIdentical($new_id, $config_test->id()); $status = $config_test->save(); - $this->assertIdentical($status, SAVED_UPDATED); + $this->assertIdentical(SAVED_UPDATED, $status); $this->assertFalse($config_test->isNew()); // Verify that originalID points to new ID directly after renaming. - $this->assertIdentical($config_test->id(), $new_id); - $this->assertIdentical($config_test->getOriginalId(), $new_id); + $this->assertIdentical($new_id, $config_test->id()); + $this->assertIdentical($new_id, $config_test->getOriginalId()); } // Test config entity prepopulation. diff --git a/core/modules/config/tests/src/Functional/ConfigExportUITest.php b/core/modules/config/tests/src/Functional/ConfigExportUITest.php index d4c5db0f49d7..cf91f5ec38b1 100644 --- a/core/modules/config/tests/src/Functional/ConfigExportUITest.php +++ b/core/modules/config/tests/src/Functional/ConfigExportUITest.php @@ -78,10 +78,10 @@ public function testExport() { } // Assert that the downloaded archive file contents are the same as the test // site active store. - $this->assertIdentical($archive_contents, $config_files); + $this->assertIdentical($config_files, $archive_contents); // Ensure the test configuration override is in effect but was not exported. - $this->assertIdentical(\Drupal::config('system.maintenance')->get('message'), 'Foo'); + $this->assertIdentical('Foo', \Drupal::config('system.maintenance')->get('message')); $archiver->extract($temp_directory, ['system.maintenance.yml']); $file_contents = file_get_contents($temp_directory . '/' . 'system.maintenance.yml'); $exported = Yaml::decode($file_contents); diff --git a/core/modules/config/tests/src/Functional/ConfigFormOverrideTest.php b/core/modules/config/tests/src/Functional/ConfigFormOverrideTest.php index fbd399a40dfc..0264171be88a 100644 --- a/core/modules/config/tests/src/Functional/ConfigFormOverrideTest.php +++ b/core/modules/config/tests/src/Functional/ConfigFormOverrideTest.php @@ -40,7 +40,7 @@ public function testFormsWithOverrides() { $this->drupalGet('admin/config/system/site-information'); $this->assertSession()->titleEquals('Basic site settings | ' . $overridden_name); $elements = $this->xpath('//input[@name="site_name"]'); - $this->assertIdentical($elements[0]->getValue(), 'Drupal'); + $this->assertIdentical('Drupal', $elements[0]->getValue()); // Submit the form and ensure the site name is not changed. $edit = [ @@ -49,7 +49,7 @@ public function testFormsWithOverrides() { $this->drupalPostForm('admin/config/system/site-information', $edit, 'Save configuration'); $this->assertSession()->titleEquals('Basic site settings | ' . $overridden_name); $elements = $this->xpath('//input[@name="site_name"]'); - $this->assertIdentical($elements[0]->getValue(), $edit['site_name']); + $this->assertIdentical($edit['site_name'], $elements[0]->getValue()); } } diff --git a/core/modules/config/tests/src/Functional/ConfigImportAllTest.php b/core/modules/config/tests/src/Functional/ConfigImportAllTest.php index ac5d94d41b08..0521732b287c 100644 --- a/core/modules/config/tests/src/Functional/ConfigImportAllTest.php +++ b/core/modules/config/tests/src/Functional/ConfigImportAllTest.php @@ -122,7 +122,7 @@ public function testInstallUninstall() { $this->rebuildContainer(); // Check that there are no errors. - $this->assertIdentical($this->configImporter()->getErrors(), []); + $this->assertIdentical([], $this->configImporter()->getErrors()); // Check that all modules that were uninstalled are now reinstalled. $this->assertModules(array_keys($modules_to_uninstall), TRUE); @@ -136,7 +136,7 @@ public function testInstallUninstall() { $this->container->get('config.storage.sync'), $this->container->get('config.storage') ); - $this->assertIdentical($storage_comparer->createChangelist()->getChangelist(), $storage_comparer->getEmptyChangelist()); + $this->assertIdentical($storage_comparer->getEmptyChangelist(), $storage_comparer->createChangelist()->getChangelist()); // Now we have all configuration imported, test all of them for schema // conformance. Ensures all imported default configuration is valid when diff --git a/core/modules/config/tests/src/Functional/ConfigImportUITest.php b/core/modules/config/tests/src/Functional/ConfigImportUITest.php index 78a96163b173..ff98778bb4ec 100644 --- a/core/modules/config/tests/src/Functional/ConfigImportUITest.php +++ b/core/modules/config/tests/src/Functional/ConfigImportUITest.php @@ -171,7 +171,7 @@ public function testImport() { // used during configuration import and, additionally, that after installing // a module, that configuration is not synced twice. $interval_values = \Drupal::state()->get('ConfigImportUITest.automated_cron.settings.interval', []); - $this->assertIdentical($interval_values, [10000]); + $this->assertIdentical([10000], $interval_values); $core_extension = $this->config('core.extension')->get(); unset($core_extension['module']['automated_cron']); @@ -224,7 +224,7 @@ public function testImport() { // Verify that the automated_cron.settings configuration object was only // deleted once during the import process. $delete_called = \Drupal::state()->get('ConfigImportUITest.automated_cron.settings.delete', 0); - $this->assertIdentical($delete_called, 1, "The automated_cron.settings configuration was deleted once during configuration import."); + $this->assertIdentical(1, $delete_called, "The automated_cron.settings configuration was deleted once during configuration import."); } /** diff --git a/core/modules/config/tests/src/Functional/ConfigInstallProfileOverrideTest.php b/core/modules/config/tests/src/Functional/ConfigInstallProfileOverrideTest.php index ccad0f0775e1..025f5bcf6aa9 100644 --- a/core/modules/config/tests/src/Functional/ConfigInstallProfileOverrideTest.php +++ b/core/modules/config/tests/src/Functional/ConfigInstallProfileOverrideTest.php @@ -61,12 +61,12 @@ public function testInstallProfileConfigOverwrite() { $this->assertDirectoryExists($config_dir); $source_storage = new FileStorage($config_dir); $data = $source_storage->read($config_name); - $this->assertIdentical($data, $expected_original_data); + $this->assertIdentical($expected_original_data, $data); // Verify that active configuration matches the expected data, which was // created from the testing install profile's system.cron.yml file. $config = $this->config($config_name); - $this->assertIdentical($config->get(), $expected_profile_data); + $this->assertIdentical($expected_profile_data, $config->get()); $config = $this->config('system.site'); // Verify the system.site config has a valid UUID. diff --git a/core/modules/config/tests/src/Functional/ConfigInstallWebTest.php b/core/modules/config/tests/src/Functional/ConfigInstallWebTest.php index 97c49e74f44d..7a0f20ba93ee 100644 --- a/core/modules/config/tests/src/Functional/ConfigInstallWebTest.php +++ b/core/modules/config/tests/src/Functional/ConfigInstallWebTest.php @@ -70,10 +70,10 @@ public function testIntegrationModuleReinstallation() { \Drupal::configFactory()->reset($default_configuration_entity); $config_static = $this->config($default_config); $this->assertFalse($config_static->isNew()); - $this->assertIdentical($config_static->get('foo'), 'default setting'); + $this->assertIdentical('default setting', $config_static->get('foo')); $config_entity = $this->config($default_configuration_entity); $this->assertFalse($config_entity->isNew()); - $this->assertIdentical($config_entity->get('label'), 'Default integration config label'); + $this->assertIdentical('Default integration config label', $config_entity->get('label')); // Customize both configuration objects. $config_static->set('foo', 'customized setting')->save(); @@ -95,7 +95,7 @@ public function testIntegrationModuleReinstallation() { // Verify the integration config still exists. $config_entity = $this->config($default_configuration_entity); $this->assertFalse($config_entity->isNew()); - $this->assertIdentical($config_entity->get('label'), 'Customized integration config label'); + $this->assertIdentical('Customized integration config label', $config_entity->get('label')); // Reinstall the integration module. try { @@ -117,12 +117,12 @@ public function testIntegrationModuleReinstallation() { \Drupal::configFactory()->reset($default_configuration_entity); $config_static = $this->config($default_config); $this->assertFalse($config_static->isNew()); - $this->assertIdentical($config_static->get('foo'), 'default setting'); + $this->assertIdentical('default setting', $config_static->get('foo')); // Verify the integration config is using the default. $config_entity = \Drupal::config($default_configuration_entity); $this->assertFalse($config_entity->isNew()); - $this->assertIdentical($config_entity->get('label'), 'Default integration config label'); + $this->assertIdentical('Default integration config label', $config_entity->get('label')); } /** diff --git a/core/modules/config/tests/src/Functional/ConfigSingleImportExportTest.php b/core/modules/config/tests/src/Functional/ConfigSingleImportExportTest.php index cca77241ca2f..736a9926366b 100644 --- a/core/modules/config/tests/src/Functional/ConfigSingleImportExportTest.php +++ b/core/modules/config/tests/src/Functional/ConfigSingleImportExportTest.php @@ -77,8 +77,8 @@ public function testImport() { $this->assertRaw(t('Are you sure you want to create a new %name @type?', ['%name' => 'first', '@type' => 'test configuration'])); $this->submitForm([], 'Confirm'); $entity = $storage->load('first'); - $this->assertIdentical($entity->label(), 'First'); - $this->assertIdentical($entity->id(), 'first'); + $this->assertIdentical('First', $entity->label()); + $this->assertIdentical('first', $entity->id()); $this->assertTrue($entity->status()); $this->assertRaw(t('The configuration was imported successfully.')); @@ -117,10 +117,10 @@ public function testImport() { $this->submitForm([], 'Confirm'); $entity = $storage->load('second'); $this->assertRaw(t('The configuration was imported successfully.')); - $this->assertIdentical($entity->label(), 'Second'); - $this->assertIdentical($entity->id(), 'second'); + $this->assertIdentical('Second', $entity->label()); + $this->assertIdentical('second', $entity->id()); $this->assertFalse($entity->status()); - $this->assertIdentical($entity->uuid(), $second_uuid); + $this->assertIdentical($second_uuid, $entity->uuid()); // Perform an update. $import = <<<EOD @@ -140,7 +140,7 @@ public function testImport() { $this->submitForm([], 'Confirm'); $entity = $storage->load('second'); $this->assertRaw(t('The configuration was imported successfully.')); - $this->assertIdentical($entity->label(), 'Second updated'); + $this->assertIdentical('Second updated', $entity->label()); // Try to perform an update which adds missing dependencies. $import = <<<EOD diff --git a/core/modules/content_translation/tests/src/Kernel/ContentTranslationConfigImportTest.php b/core/modules/content_translation/tests/src/Kernel/ContentTranslationConfigImportTest.php index 18e0e83a771e..7482ab3dc52c 100644 --- a/core/modules/content_translation/tests/src/Kernel/ContentTranslationConfigImportTest.php +++ b/core/modules/content_translation/tests/src/Kernel/ContentTranslationConfigImportTest.php @@ -100,7 +100,7 @@ public function testConfigImportUpdates() { // Verify the values appeared. $config = $this->config($config_name); - $this->assertIdentical($config->get('id'), $config_id); + $this->assertIdentical($config_id, $config->get('id')); // Verify that updates were performed. $entity_type = $this->container->get('entity_type.manager')->getDefinition($entity_type_id); diff --git a/core/modules/contextual/tests/src/Functional/ContextualDynamicContextTest.php b/core/modules/contextual/tests/src/Functional/ContextualDynamicContextTest.php index b76098e1dc33..9cc9ddfd677a 100644 --- a/core/modules/contextual/tests/src/Functional/ContextualDynamicContextTest.php +++ b/core/modules/contextual/tests/src/Functional/ContextualDynamicContextTest.php @@ -115,10 +115,10 @@ public function testDifferentPermissions() { $response = $this->renderContextualLinks($ids, 'node'); $this->assertSame(200, $response->getStatusCode()); $json = Json::decode((string) $response->getBody()); - $this->assertIdentical($json[$ids[0]], '<ul class="contextual-links"><li class="entitynodeedit-form"><a href="' . base_path() . 'node/1/edit">Edit</a></li></ul>'); - $this->assertIdentical($json[$ids[1]], ''); - $this->assertIdentical($json[$ids[2]], '<ul class="contextual-links"><li class="entitynodeedit-form"><a href="' . base_path() . 'node/3/edit">Edit</a></li></ul>'); - $this->assertIdentical($json[$ids[3]], ''); + $this->assertIdentical('<ul class="contextual-links"><li class="entitynodeedit-form"><a href="' . base_path() . 'node/1/edit">Edit</a></li></ul>', $json[$ids[0]]); + $this->assertIdentical('', $json[$ids[1]]); + $this->assertIdentical('<ul class="contextual-links"><li class="entitynodeedit-form"><a href="' . base_path() . 'node/3/edit">Edit</a></li></ul>', $json[$ids[2]]); + $this->assertIdentical('', $json[$ids[3]]); // Verify that link language is properly handled. $node3->addTranslation('it')->set('title', $this->randomString())->save(); @@ -138,10 +138,10 @@ public function testDifferentPermissions() { $response = $this->renderContextualLinks($ids, 'node'); $this->assertSame(200, $response->getStatusCode()); $json = Json::decode((string) $response->getBody()); - $this->assertIdentical($json[$ids[0]], ''); - $this->assertIdentical($json[$ids[1]], ''); - $this->assertIdentical($json[$ids[2]], ''); - $this->assertIdentical($json[$ids[3]], ''); + $this->assertIdentical('', $json[$ids[0]]); + $this->assertIdentical('', $json[$ids[1]]); + $this->assertIdentical('', $json[$ids[2]]); + $this->assertIdentical('', $json[$ids[3]]); // Anonymous user: cannot access contextual links. $this->drupalLogin($this->anonymousUser); diff --git a/core/modules/contextual/tests/src/Kernel/ContextualUnitTest.php b/core/modules/contextual/tests/src/Kernel/ContextualUnitTest.php index 6a9a6da5b520..bdaa5c3147af 100644 --- a/core/modules/contextual/tests/src/Kernel/ContextualUnitTest.php +++ b/core/modules/contextual/tests/src/Kernel/ContextualUnitTest.php @@ -115,7 +115,7 @@ public function _contextual_links_id_testcases() { public function testContextualLinksToId() { $tests = $this->_contextual_links_id_testcases(); foreach ($tests as $test) { - $this->assertIdentical(_contextual_links_to_id($test['links']), $test['id']); + $this->assertIdentical($test['id'], _contextual_links_to_id($test['links'])); } } @@ -125,7 +125,7 @@ public function testContextualLinksToId() { public function testContextualIdToLinks() { $tests = $this->_contextual_links_id_testcases(); foreach ($tests as $test) { - $this->assertIdentical(_contextual_id_to_links($test['id']), $test['links']); + $this->assertIdentical($test['links'], _contextual_id_to_links($test['id'])); } } diff --git a/core/modules/editor/tests/src/Functional/EditorAdminTest.php b/core/modules/editor/tests/src/Functional/EditorAdminTest.php index 4611154e4d64..86f18ca7a734 100644 --- a/core/modules/editor/tests/src/Functional/EditorAdminTest.php +++ b/core/modules/editor/tests/src/Functional/EditorAdminTest.php @@ -245,8 +245,8 @@ protected function selectUnicornEditor() { protected function verifyUnicornEditorConfiguration($format_id, $ponies_too = TRUE) { $editor = editor_load($format_id); $settings = $editor->getSettings(); - $this->assertIdentical($editor->getEditor(), 'unicorn', 'The text editor is configured correctly.'); - $this->assertIdentical($settings['ponies_too'], $ponies_too, 'The text editor settings are stored correctly.'); + $this->assertIdentical('unicorn', $editor->getEditor(), 'The text editor is configured correctly.'); + $this->assertIdentical($ponies_too, $settings['ponies_too'], 'The text editor settings are stored correctly.'); $this->drupalGet('admin/config/content/formats/manage/' . $format_id); $select = $this->xpath('//select[@name="editor[editor]"]'); $select_is_disabled = $this->xpath('//select[@name="editor[editor]" and @disabled="disabled"]'); diff --git a/core/modules/editor/tests/src/Functional/EditorSecurityTest.php b/core/modules/editor/tests/src/Functional/EditorSecurityTest.php index 95b1ffc84f7f..2fda6d8d7842 100644 --- a/core/modules/editor/tests/src/Functional/EditorSecurityTest.php +++ b/core/modules/editor/tests/src/Functional/EditorSecurityTest.php @@ -420,7 +420,7 @@ public function testSwitchingSecurity() { $this->assertEquals(200, $response->getStatusCode()); $json = Json::decode($response->getBody()); - $this->assertIdentical($json, $expected_filtered_value, 'The value was correctly filtered for XSS attack vectors.'); + $this->assertIdentical($expected_filtered_value, $json, 'The value was correctly filtered for XSS attack vectors.'); } } } diff --git a/core/modules/editor/tests/src/Kernel/QuickEditIntegrationTest.php b/core/modules/editor/tests/src/Kernel/QuickEditIntegrationTest.php index 537604bdbb42..93adb421cbbf 100644 --- a/core/modules/editor/tests/src/Kernel/QuickEditIntegrationTest.php +++ b/core/modules/editor/tests/src/Kernel/QuickEditIntegrationTest.php @@ -201,7 +201,7 @@ public function testAttachments() { $editors = ['editor']; $attachments = $this->editorSelector->getEditorAttachments($editors); - $this->assertIdentical($attachments, ['library' => ['editor/quickedit.inPlaceEditor.formattedText']], "Expected attachments for Editor module's in-place editor found."); + $this->assertIdentical(['library' => ['editor/quickedit.inPlaceEditor.formattedText']], $attachments, "Expected attachments for Editor module's in-place editor found."); } /** diff --git a/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceAdminTest.php b/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceAdminTest.php index baa566ba3fe4..3432313856ca 100644 --- a/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceAdminTest.php +++ b/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceAdminTest.php @@ -341,7 +341,7 @@ public function testMultipleTargetBundles() { $vocabularies[0]->delete(); $field_config = FieldConfig::load($field_id); $this->assertTrue($field_config->getSetting('handler_settings')['auto_create']); - $this->assertIdentical($field_config->getSetting('handler_settings')['auto_create_bundle'], $vocabularies[1]->id()); + $this->assertIdentical($vocabularies[1]->id(), $field_config->getSetting('handler_settings')['auto_create_bundle']); // Delete the bundle set for entity auto-creation. Auto-created settings // should be reset (no auto-creation). @@ -400,7 +400,7 @@ protected function assertFieldSelectOptions($name, array $expected_options) { }); sort($options); sort($expected_options); - $this->assertIdentical($options, $expected_options); + $this->assertIdentical($expected_options, $options); } else { $this->fail('Unable to find field ' . $name); diff --git a/core/modules/field/tests/src/Functional/FormTest.php b/core/modules/field/tests/src/Functional/FormTest.php index 9f320e25274f..a0574e8783d6 100644 --- a/core/modules/field/tests/src/Functional/FormTest.php +++ b/core/modules/field/tests/src/Functional/FormTest.php @@ -331,7 +331,7 @@ public function testFieldFormUnlimited() { $entity = EntityTest::load($id); ksort($field_values); $field_values = array_values($field_values); - $this->assertIdentical($entity->{$field_name}->getValue(), $field_values, 'Field values were saved in the correct order'); + $this->assertIdentical($field_values, $entity->{$field_name}->getValue(), 'Field values were saved in the correct order'); // Display edit form: check that the expected number of widgets is // displayed, with correct values change values, reorder, leave an empty diff --git a/core/modules/field/tests/src/FunctionalJavascript/EntityReference/EntityReferenceAdminTest.php b/core/modules/field/tests/src/FunctionalJavascript/EntityReference/EntityReferenceAdminTest.php index 0d0a2680dbda..0715f1e3e311 100644 --- a/core/modules/field/tests/src/FunctionalJavascript/EntityReference/EntityReferenceAdminTest.php +++ b/core/modules/field/tests/src/FunctionalJavascript/EntityReference/EntityReferenceAdminTest.php @@ -366,7 +366,7 @@ protected function assertFieldSelectOptions($name, array $expected_options) { sort($options); sort($expected_options); - $this->assertIdentical($options, $expected_options); + $this->assertIdentical($expected_options, $options); } else { $this->fail('Unable to find field ' . $name); diff --git a/core/modules/field/tests/src/Kernel/FieldAttachOtherTest.php b/core/modules/field/tests/src/Kernel/FieldAttachOtherTest.php index 8d3284db24b6..d18c6f504b90 100644 --- a/core/modules/field/tests/src/Kernel/FieldAttachOtherTest.php +++ b/core/modules/field/tests/src/Kernel/FieldAttachOtherTest.php @@ -361,13 +361,13 @@ public function testEntityFormDisplayExtractFormValues() { $expected_values[] = ['value' => $values[$key]['value']]; } } - $this->assertIdentical($entity->{$this->fieldTestData->field_name}->getValue(), $expected_values, 'Submit filters empty values'); + $this->assertIdentical($expected_values, $entity->{$this->fieldTestData->field_name}->getValue(), 'Submit filters empty values'); foreach ($weights_2 as $key => $value) { if ($key != 1) { $expected_values_2[] = ['value' => $values_2[$key]['value']]; } } - $this->assertIdentical($entity->{$this->fieldTestData->field_name_2}->getValue(), $expected_values_2, 'Submit filters empty values'); + $this->assertIdentical($expected_values_2, $entity->{$this->fieldTestData->field_name_2}->getValue(), 'Submit filters empty values'); // Call EntityFormDisplayInterface::extractFormValues() for a single field (the second field). foreach ($display->getComponents() as $name => $options) { @@ -384,7 +384,7 @@ public function testEntityFormDisplayExtractFormValues() { } } $this->assertTrue($entity->{$this->fieldTestData->field_name}->isEmpty(), 'The first field is empty in the entity object'); - $this->assertIdentical($entity->{$this->fieldTestData->field_name_2}->getValue(), $expected_values_2, 'Submit filters empty values'); + $this->assertIdentical($expected_values_2, $entity->{$this->fieldTestData->field_name_2}->getValue(), 'Submit filters empty values'); } } diff --git a/core/modules/field/tests/src/Kernel/FieldCrudTest.php b/core/modules/field/tests/src/Kernel/FieldCrudTest.php index 0899ad773a92..2323088df424 100644 --- a/core/modules/field/tests/src/Kernel/FieldCrudTest.php +++ b/core/modules/field/tests/src/Kernel/FieldCrudTest.php @@ -89,7 +89,7 @@ public function testCreateField() { // Check that default values are set. $this->assertEqual($config['required'], FALSE, 'Required defaults to false.'); $this->assertIdentical($config['label'], $this->fieldDefinition['field_name'], 'Label defaults to field name.'); - $this->assertIdentical($config['description'], '', 'Description defaults to empty string.'); + $this->assertIdentical('', $config['description'], 'Description defaults to empty string.'); // Check that default settings are set. $this->assertEqual($config['settings'], $field_type_manager->getDefaultFieldSettings($this->fieldStorageDefinition['type']), 'Default field settings have been written.'); diff --git a/core/modules/field/tests/src/Kernel/FieldDataCountTest.php b/core/modules/field/tests/src/Kernel/FieldDataCountTest.php index b871eca2e02e..ab79d5b35629 100644 --- a/core/modules/field/tests/src/Kernel/FieldDataCountTest.php +++ b/core/modules/field/tests/src/Kernel/FieldDataCountTest.php @@ -65,7 +65,7 @@ public function testEntityCountAndHasData() { ])->save(); $this->assertFalse($field_storage->hasdata(), 'There are no entities with field data.'); - $this->assertIdentical($this->storage->countFieldData($field_storage), 0, 'There are 0 entities with field data.'); + $this->assertIdentical(0, $this->storage->countFieldData($field_storage), 'There are 0 entities with field data.'); // Create 1 entity without the field. $entity = EntityTest::create(); @@ -73,7 +73,7 @@ public function testEntityCountAndHasData() { $entity->save(); $this->assertFalse($field_storage->hasdata(), 'There are no entities with field data.'); - $this->assertIdentical($this->storage->countFieldData($field_storage), 0, 'There are 0 entities with field data.'); + $this->assertIdentical(0, $this->storage->countFieldData($field_storage), 'There are 0 entities with field data.'); // Create 12 entities to ensure that the purging works as expected. for ($i = 0; $i < 12; $i++) { @@ -118,7 +118,7 @@ public function testEntityCountAndHasData() { $cardinality = $this->fieldTestData->field_storage_2->getCardinality(); $this->assertFalse($this->fieldTestData->field_storage_2->hasData(), 'There are no entities with field data.'); - $this->assertIdentical($this->storageRev->countFieldData($this->fieldTestData->field_storage_2), 0, 'There are 0 entities with field data.'); + $this->assertIdentical(0, $this->storageRev->countFieldData($this->fieldTestData->field_storage_2), 'There are 0 entities with field data.'); // Create 1 entity with the field. $entity = clone($entity_init); @@ -129,7 +129,7 @@ public function testEntityCountAndHasData() { $first_revision = $entity->getRevisionId(); $this->assertTrue($this->fieldTestData->field_storage_2->hasData(), 'There are entities with field data.'); - $this->assertIdentical($this->storageRev->countFieldData($this->fieldTestData->field_storage_2), 1, 'There is 1 entity with field data.'); + $this->assertIdentical(1, $this->storageRev->countFieldData($this->fieldTestData->field_storage_2), 'There is 1 entity with field data.'); $entity->{$this->fieldTestData->field_name_2} = []; $entity->setNewRevision(); diff --git a/core/modules/field/tests/src/Kernel/FieldImportDeleteTest.php b/core/modules/field/tests/src/Kernel/FieldImportDeleteTest.php index 528292313114..eb1ff0665310 100644 --- a/core/modules/field/tests/src/Kernel/FieldImportDeleteTest.php +++ b/core/modules/field/tests/src/Kernel/FieldImportDeleteTest.php @@ -100,11 +100,11 @@ public function testImportDelete() { // Check that all config files are gone. $active = $this->container->get('config.storage'); - $this->assertIdentical($active->listAll($field_storage_config_name), []); - $this->assertIdentical($active->listAll($field_storage_config_name_2), []); - $this->assertIdentical($active->listAll($field_config_name), []); - $this->assertIdentical($active->listAll($field_config_name_2a), []); - $this->assertIdentical($active->listAll($field_config_name_2b), []); + $this->assertIdentical([], $active->listAll($field_storage_config_name)); + $this->assertIdentical([], $active->listAll($field_storage_config_name_2)); + $this->assertIdentical([], $active->listAll($field_config_name)); + $this->assertIdentical([], $active->listAll($field_config_name_2a)); + $this->assertIdentical([], $active->listAll($field_config_name_2b)); // Check that only the first storage definition is preserved in state. $deleted_storages = \Drupal::state()->get('field.storage.deleted', []); diff --git a/core/modules/field/tests/src/Kernel/FieldImportDeleteUninstallTest.php b/core/modules/field/tests/src/Kernel/FieldImportDeleteUninstallTest.php index 095a2cdcd533..7de6c85f5271 100644 --- a/core/modules/field/tests/src/Kernel/FieldImportDeleteUninstallTest.php +++ b/core/modules/field/tests/src/Kernel/FieldImportDeleteUninstallTest.php @@ -93,7 +93,7 @@ public function testImportDeleteUninstall() { $sync->delete('field.field.entity_test.entity_test.field_test'); $steps = $this->configImporter()->initialize(); - $this->assertIdentical($steps[0], ['\Drupal\field\ConfigImporterFieldPurger', 'process'], 'The additional process configuration synchronization step has been added.'); + $this->assertIdentical(['\\Drupal\\field\\ConfigImporterFieldPurger', 'process'], $steps[0], 'The additional process configuration synchronization step has been added.'); // This will purge all the data, delete the field and uninstall the // Telephone module. @@ -154,7 +154,7 @@ public function testImportAlreadyDeletedUninstall() { $this->assertTrue(isset($deleted_storages[$field_storage_uuid]), 'Field has been deleted and needs purging before configuration synchronization.'); $steps = $this->configImporter()->initialize(); - $this->assertIdentical($steps[0], ['\Drupal\field\ConfigImporterFieldPurger', 'process'], 'The additional process configuration synchronization step has been added.'); + $this->assertIdentical(['\\Drupal\\field\\ConfigImporterFieldPurger', 'process'], $steps[0], 'The additional process configuration synchronization step has been added.'); // This will purge all the data, delete the field and uninstall the // Telephone module. diff --git a/core/modules/field/tests/src/Kernel/FieldStorageCrudTest.php b/core/modules/field/tests/src/Kernel/FieldStorageCrudTest.php index dd01b9ab86f1..75f560babfcc 100644 --- a/core/modules/field/tests/src/Kernel/FieldStorageCrudTest.php +++ b/core/modules/field/tests/src/Kernel/FieldStorageCrudTest.php @@ -46,8 +46,8 @@ public function testCreate() { $this->assertNull($field_storage->getSetting('config_data_from_storage_setting')); $mem = field_test_memorize(); - $this->assertIdentical($mem['field_test_field_storage_config_create'][0][0]->getName(), $field_storage_definition['field_name'], 'hook_entity_create() called with correct arguments.'); - $this->assertIdentical($mem['field_test_field_storage_config_create'][0][0]->getType(), $field_storage_definition['type'], 'hook_entity_create() called with correct arguments.'); + $this->assertIdentical($field_storage_definition['field_name'], $mem['field_test_field_storage_config_create'][0][0]->getName(), 'hook_entity_create() called with correct arguments.'); + $this->assertIdentical($field_storage_definition['type'], $mem['field_test_field_storage_config_create'][0][0]->getType(), 'hook_entity_create() called with correct arguments.'); // Read the configuration. Check against raw configuration data rather than // the loaded ConfigEntity, to be sure we check that the defaults are diff --git a/core/modules/field/tests/src/Kernel/String/UuidFormatterTest.php b/core/modules/field/tests/src/Kernel/String/UuidFormatterTest.php index bdc8c87cbe57..794e0fb35009 100644 --- a/core/modules/field/tests/src/Kernel/String/UuidFormatterTest.php +++ b/core/modules/field/tests/src/Kernel/String/UuidFormatterTest.php @@ -41,14 +41,14 @@ public function testUuidStringFormatter() { // Verify default render. $render_array = $uuid_field->view([]); - $this->assertIdentical($render_array[0]['#context']['value'], $entity->uuid(), 'The rendered UUID matches the entity UUID.'); + $this->assertIdentical($entity->uuid(), $render_array[0]['#context']['value'], 'The rendered UUID matches the entity UUID.'); $this->assertStringContainsString($entity->uuid(), $this->render($render_array), 'The rendered UUID found.'); // Verify customized render. $render_array = $uuid_field->view(['settings' => ['link_to_entity' => TRUE]]); - $this->assertIdentical($render_array[0]['#type'], 'link'); - $this->assertIdentical($render_array[0]['#title']['#context']['value'], $entity->uuid()); - $this->assertIdentical($render_array[0]['#url']->toString(), $entity->toUrl()->toString()); + $this->assertIdentical('link', $render_array[0]['#type']); + $this->assertIdentical($entity->uuid(), $render_array[0]['#title']['#context']['value']); + $this->assertIdentical($entity->toUrl()->toString(), $render_array[0]['#url']->toString()); $rendered = $this->render($render_array); $this->assertStringContainsString($entity->uuid(), $rendered, 'The rendered UUID found.'); $this->assertStringContainsString($entity->toUrl()->toString(), $rendered, 'The rendered entity URL found.'); diff --git a/core/modules/field_ui/tests/src/Functional/ManageDisplayTest.php b/core/modules/field_ui/tests/src/Functional/ManageDisplayTest.php index 120c3fc8fd4a..55f53694e67c 100644 --- a/core/modules/field_ui/tests/src/Functional/ManageDisplayTest.php +++ b/core/modules/field_ui/tests/src/Functional/ManageDisplayTest.php @@ -301,7 +301,7 @@ protected function assertFieldSelectOptions($name, array $expected_options) { sort($options); sort($expected_options); - $this->assertIdentical($options, $expected_options); + $this->assertIdentical($expected_options, $options); } else { $this->fail('Unable to find field ' . $name); diff --git a/core/modules/field_ui/tests/src/Kernel/EntityDisplayTest.php b/core/modules/field_ui/tests/src/Kernel/EntityDisplayTest.php index f83d0eef1f4b..eb8bbb2d033f 100644 --- a/core/modules/field_ui/tests/src/Kernel/EntityDisplayTest.php +++ b/core/modules/field_ui/tests/src/Kernel/EntityDisplayTest.php @@ -139,7 +139,7 @@ public function testEntityDisplayCRUDSort() { $components = array_keys($display->getComponents()); // The name field is not configurable so will be added automatically. $expected = [0 => 'component_1', 1 => 'component_2', 2 => 'component_3', 'name']; - $this->assertIdentical($components, $expected); + $this->assertIdentical($expected, $components); } /** diff --git a/core/modules/file/tests/src/Functional/FileFieldWidgetTest.php b/core/modules/file/tests/src/Functional/FileFieldWidgetTest.php index 81b4a260561a..714ee25de708 100644 --- a/core/modules/file/tests/src/Functional/FileFieldWidgetTest.php +++ b/core/modules/file/tests/src/Functional/FileFieldWidgetTest.php @@ -174,7 +174,7 @@ public function testMultiValuedWidget() { $check_field_name = $field_name; } - $this->assertIdentical($button->getAttribute('name'), $check_field_name . '_' . $key . '_remove_button'); + $this->assertIdentical($check_field_name . '_' . $key . '_remove_button', $button->getAttribute('name')); } // "Click" the remove button (emulating either a nojs or js submission). diff --git a/core/modules/file/tests/src/FunctionalJavascript/FileFieldWidgetTest.php b/core/modules/file/tests/src/FunctionalJavascript/FileFieldWidgetTest.php index 907f09521c57..ed0eba1522f8 100644 --- a/core/modules/file/tests/src/FunctionalJavascript/FileFieldWidgetTest.php +++ b/core/modules/file/tests/src/FunctionalJavascript/FileFieldWidgetTest.php @@ -108,7 +108,7 @@ public function testMultiValuedWidget() { $check_field_name = $field_name; } - $this->assertIdentical($button->getAttribute('name'), $check_field_name . '_' . $key . '_remove_button'); + $this->assertIdentical($check_field_name . '_' . $key . '_remove_button', $button->getAttribute('name')); } $button_name = $current_field_name . '_' . $delta . '_remove_button'; diff --git a/core/modules/filter/tests/src/Kernel/FilterCrudTest.php b/core/modules/filter/tests/src/Kernel/FilterCrudTest.php index 83509ee17620..3ed44b922132 100644 --- a/core/modules/filter/tests/src/Kernel/FilterCrudTest.php +++ b/core/modules/filter/tests/src/Kernel/FilterCrudTest.php @@ -82,7 +82,7 @@ public function testDisableFallbackFormat() { $this->fail($message); } catch (\LogicException $e) { - $this->assertIdentical($e->getMessage(), "The fallback text format 'plain_text' cannot be disabled.", $message); + $this->assertIdentical("The fallback text format 'plain_text' cannot be disabled.", $e->getMessage(), $message); } } diff --git a/core/modules/filter/tests/src/Kernel/FilterKernelTest.php b/core/modules/filter/tests/src/Kernel/FilterKernelTest.php index 8ab45cfada09..77c6c1c3f48d 100644 --- a/core/modules/filter/tests/src/Kernel/FilterKernelTest.php +++ b/core/modules/filter/tests/src/Kernel/FilterKernelTest.php @@ -423,38 +423,38 @@ public function testHtmlFilter() { // HTML filter is not able to secure some tags, these should never be // allowed. $f = (string) $filter->process('<script />', Language::LANGCODE_NOT_SPECIFIED); - $this->assertIdentical($f, '', 'HTML filter should remove script tags.'); + $this->assertIdentical('', $f, 'HTML filter should remove script tags.'); $f = (string) $filter->process('<iframe />', Language::LANGCODE_NOT_SPECIFIED); - $this->assertIdentical($f, '', 'HTML filter should remove iframe tags.'); + $this->assertIdentical('', $f, 'HTML filter should remove iframe tags.'); $f = (string) $filter->process('<object />', Language::LANGCODE_NOT_SPECIFIED); - $this->assertIdentical($f, '', 'HTML filter should remove object tags.'); + $this->assertIdentical('', $f, 'HTML filter should remove object tags.'); $f = (string) $filter->process('<style />', Language::LANGCODE_NOT_SPECIFIED); - $this->assertIdentical($f, '', 'HTML filter should remove style tags.'); + $this->assertIdentical('', $f, 'HTML filter should remove style tags.'); // Some tags make CSRF attacks easier, let the user take the risk herself. $f = (string) $filter->process('<img />', Language::LANGCODE_NOT_SPECIFIED); - $this->assertIdentical($f, '', 'HTML filter should remove img tags by default.'); + $this->assertIdentical('', $f, 'HTML filter should remove img tags by default.'); $f = (string) $filter->process('<input />', Language::LANGCODE_NOT_SPECIFIED); - $this->assertIdentical($f, '', 'HTML filter should remove input tags by default.'); + $this->assertIdentical('', $f, 'HTML filter should remove input tags by default.'); // Filtering content of some attributes is infeasible, these shouldn't be // allowed too. $f = (string) $filter->process('<p style="display: none;" />', Language::LANGCODE_NOT_SPECIFIED); $this->assertNoNormalized($f, 'style', 'HTML filter should remove style attributes.'); - $this->assertIdentical($f, '<p></p>'); + $this->assertIdentical('<p></p>', $f); $f = (string) $filter->process('<p onerror="alert(0);"></p>', Language::LANGCODE_NOT_SPECIFIED); $this->assertNoNormalized($f, 'onerror', 'HTML filter should remove on* attributes.'); - $this->assertIdentical($f, '<p></p>'); + $this->assertIdentical('<p></p>', $f); $f = (string) $filter->process('<code onerror> </code>', Language::LANGCODE_NOT_SPECIFIED); $this->assertNoNormalized($f, 'onerror', 'HTML filter should remove empty on* attributes.'); // Note - this string has a decoded character. - $this->assertIdentical($f, '<code> </code>'); + $this->assertIdentical('<code> </code>', $f); $f = (string) $filter->process('<br>', Language::LANGCODE_NOT_SPECIFIED); $this->assertNormalized($f, '<br />', 'HTML filter should allow line breaks.'); @@ -487,13 +487,13 @@ public function testHtmlFilter() { ], ]); $f = (string) $filter->process('<a kitten="cute" llama="awesome">link</a>', Language::LANGCODE_NOT_SPECIFIED); - $this->assertIdentical($f, '<a>link</a>', 'HTML filter removes allowed attributes that do not have an explicitly allowed value.'); + $this->assertIdentical('<a>link</a>', $f, 'HTML filter removes allowed attributes that do not have an explicitly allowed value.'); $f = (string) $filter->process('<a kitten="cute" llama="majestical">link</a>', Language::LANGCODE_NOT_SPECIFIED); - $this->assertIdentical($f, '<a llama="majestical">link</a>', 'HTML filter keeps explicitly allowed attributes with an attribute value that is also explicitly allowed.'); + $this->assertIdentical('<a llama="majestical">link</a>', $f, 'HTML filter keeps explicitly allowed attributes with an attribute value that is also explicitly allowed.'); $f = (string) $filter->process('<a kitten="cute" llama="awesome">link</a>', Language::LANGCODE_NOT_SPECIFIED); $this->assertNormalized($f, '<a>link</a>', 'HTML filter removes allowed attributes that have a not explicitly allowed value.'); $f = (string) $filter->process('<a href="/beautiful-animals" kitten="cute" llama="epic majestical">link</a>', Language::LANGCODE_NOT_SPECIFIED); - $this->assertIdentical($f, '<a href="/beautiful-animals" llama="epic majestical">link</a>', 'HTML filter keeps explicitly allowed attributes with an attribute value that is also explicitly allowed.'); + $this->assertIdentical('<a href="/beautiful-animals" llama="epic majestical">link</a>', $f, 'HTML filter keeps explicitly allowed attributes with an attribute value that is also explicitly allowed.'); } /** @@ -929,7 +929,7 @@ public function testUrlFilterContent() { $input = file_get_contents($path . '/filter.url-input.txt'); $expected = file_get_contents($path . '/filter.url-output.txt'); $result = _filter_url($input, $filter); - $this->assertIdentical($result, $expected, 'Complex HTML document was correctly processed.'); + $this->assertIdentical($expected, $result, 'Complex HTML document was correctly processed.'); } /** diff --git a/core/modules/image/tests/src/Functional/ImageStyleDeleteTest.php b/core/modules/image/tests/src/Functional/ImageStyleDeleteTest.php index 54250f3456fe..6a4e4ec8cd4d 100644 --- a/core/modules/image/tests/src/Functional/ImageStyleDeleteTest.php +++ b/core/modules/image/tests/src/Functional/ImageStyleDeleteTest.php @@ -71,7 +71,7 @@ public function testDelete() { // Checks that widget setting is preserved with the image preview disabled. $form_display = EntityFormDisplay::load('node.page.default'); $this->assertNotNull($widget = $form_display->getComponent('foo')); - $this->assertIdentical($widget['settings']['preview_image_style'], ''); + $this->assertIdentical('', $widget['settings']['preview_image_style']); $this->drupalGet('admin/config/media/image-styles/manage/wide/delete'); // Checks that the 'replacement' select element is displayed. diff --git a/core/modules/language/tests/src/Functional/LanguageSwitchingTest.php b/core/modules/language/tests/src/Functional/LanguageSwitchingTest.php index 10201a07d1ed..64218c455e32 100644 --- a/core/modules/language/tests/src/Functional/LanguageSwitchingTest.php +++ b/core/modules/language/tests/src/Functional/LanguageSwitchingTest.php @@ -112,17 +112,17 @@ protected function doTestLanguageBlockAuthenticated($block_label) { 0 => ['langcode_class' => 'en', 'data-drupal-link-system-path' => 'user/2'], 1 => ['langcode_class' => 'fr', 'data-drupal-link-system-path' => 'user/2'], ]; - $this->assertIdentical($list_items, $expected_list_items, 'The list items have the correct attributes that will allow the drupal.active-link library to mark them as active.'); + $this->assertIdentical($expected_list_items, $list_items, 'The list items have the correct attributes that will allow the drupal.active-link library to mark them as active.'); $expected_anchors = [ 0 => ['hreflang' => 'en', 'data-drupal-link-system-path' => 'user/2'], 1 => ['hreflang' => 'fr', 'data-drupal-link-system-path' => 'user/2'], ]; - $this->assertIdentical($anchors, $expected_anchors, 'The anchors have the correct attributes that will allow the drupal.active-link library to mark them as active.'); + $this->assertIdentical($expected_anchors, $anchors, 'The anchors have the correct attributes that will allow the drupal.active-link library to mark them as active.'); $settings = $this->getDrupalSettings(); - $this->assertIdentical($settings['path']['currentPath'], 'user/2', 'drupalSettings.path.currentPath is set correctly to allow drupal.active-link to mark the correct links as active.'); + $this->assertIdentical('user/2', $settings['path']['currentPath'], 'drupalSettings.path.currentPath is set correctly to allow drupal.active-link to mark the correct links as active.'); $this->assertFalse($settings['path']['isFront'], 'drupalSettings.path.isFront is set correctly to allow drupal.active-link to mark the correct links as active.'); - $this->assertIdentical($settings['path']['currentLanguage'], 'en', 'drupalSettings.path.currentLanguage is set correctly to allow drupal.active-link to mark the correct links as active.'); - $this->assertIdentical($labels, ['English', 'français'], 'The language links labels are in their own language on the language switcher block.'); + $this->assertIdentical('en', $settings['path']['currentLanguage'], 'drupalSettings.path.currentLanguage is set correctly to allow drupal.active-link to mark the correct links as active.'); + $this->assertIdentical(['English', 'français'], $labels, 'The language links labels are in their own language on the language switcher block.'); } /** @@ -172,9 +172,9 @@ protected function doTestLanguageBlockAnonymous($block_label) { } $labels[] = $link->getText(); } - $this->assertIdentical($links, ['active' => ['en'], 'inactive' => ['fr']], 'Only the current language list item is marked as active on the language switcher block.'); - $this->assertIdentical($anchors, ['active' => ['en'], 'inactive' => ['fr']], 'Only the current language anchor is marked as active on the language switcher block.'); - $this->assertIdentical($labels, ['English', 'français'], 'The language links labels are in their own language on the language switcher block.'); + $this->assertIdentical(['active' => ['en'], 'inactive' => ['fr']], $links, 'Only the current language list item is marked as active on the language switcher block.'); + $this->assertIdentical(['active' => ['en'], 'inactive' => ['fr']], $anchors, 'Only the current language anchor is marked as active on the language switcher block.'); + $this->assertIdentical(['English', 'français'], $labels, 'The language links labels are in their own language on the language switcher block.'); } /** @@ -330,9 +330,9 @@ protected function doTestLanguageLinkActiveClassAuthenticated() { // Verify that drupalSettings contains the correct values. $settings = $this->getDrupalSettings(); - $this->assertIdentical($settings['path']['currentPath'], $path, 'drupalSettings.path.currentPath is set correctly to allow drupal.active-link to mark the correct links as active.'); + $this->assertIdentical($path, $settings['path']['currentPath'], 'drupalSettings.path.currentPath is set correctly to allow drupal.active-link to mark the correct links as active.'); $this->assertFalse($settings['path']['isFront'], 'drupalSettings.path.isFront is set correctly to allow drupal.active-link to mark the correct links as active.'); - $this->assertIdentical($settings['path']['currentLanguage'], 'en', 'drupalSettings.path.currentLanguage is set correctly to allow drupal.active-link to mark the correct links as active.'); + $this->assertIdentical('en', $settings['path']['currentLanguage'], 'drupalSettings.path.currentLanguage is set correctly to allow drupal.active-link to mark the correct links as active.'); // Test links generated by the link generator on a French page. $current_language = 'French'; @@ -355,9 +355,9 @@ protected function doTestLanguageLinkActiveClassAuthenticated() { // Verify that drupalSettings contains the correct values. $settings = $this->getDrupalSettings(); - $this->assertIdentical($settings['path']['currentPath'], $path, 'drupalSettings.path.currentPath is set correctly to allow drupal.active-link to mark the correct links as active.'); + $this->assertIdentical($path, $settings['path']['currentPath'], 'drupalSettings.path.currentPath is set correctly to allow drupal.active-link to mark the correct links as active.'); $this->assertFalse($settings['path']['isFront'], 'drupalSettings.path.isFront is set correctly to allow drupal.active-link to mark the correct links as active.'); - $this->assertIdentical($settings['path']['currentLanguage'], 'fr', 'drupalSettings.path.currentLanguage is set correctly to allow drupal.active-link to mark the correct links as active.'); + $this->assertIdentical('fr', $settings['path']['currentLanguage'], 'drupalSettings.path.currentLanguage is set correctly to allow drupal.active-link to mark the correct links as active.'); } /** diff --git a/core/modules/language/tests/src/Kernel/LanguageDependencyInjectionTest.php b/core/modules/language/tests/src/Kernel/LanguageDependencyInjectionTest.php index 66604e8831ad..14b60f91e733 100644 --- a/core/modules/language/tests/src/Kernel/LanguageDependencyInjectionTest.php +++ b/core/modules/language/tests/src/Kernel/LanguageDependencyInjectionTest.php @@ -40,7 +40,7 @@ public function testDependencyInjectedNewDefaultLanguage() { // The language system creates a Language object which contains the // same properties as the new default language object. $result = \Drupal::languageManager()->getCurrentLanguage(); - $this->assertIdentical($result->getId(), 'fr'); + $this->assertIdentical('fr', $result->getId()); // Delete the language to check that we fallback to the default. try { @@ -56,7 +56,7 @@ public function testDependencyInjectedNewDefaultLanguage() { $fr->delete(); $result = \Drupal::languageManager()->getCurrentLanguage(); - $this->assertIdentical($result->getId(), $default_language->getId()); + $this->assertIdentical($default_language->getId(), $result->getId()); } } diff --git a/core/modules/language/tests/src/Kernel/Views/FilterLanguageTest.php b/core/modules/language/tests/src/Kernel/Views/FilterLanguageTest.php index 5ddcb846d8ba..0c1a5237a91a 100644 --- a/core/modules/language/tests/src/Kernel/Views/FilterLanguageTest.php +++ b/core/modules/language/tests/src/Kernel/Views/FilterLanguageTest.php @@ -49,7 +49,7 @@ public function testFilter() { 'und', 'zxx', ]; - $this->assertIdentical(array_keys($view->filter['langcode']->getValueOptions()), $expected); + $this->assertIdentical($expected, array_keys($view->filter['langcode']->getValueOptions())); $view->destroy(); } diff --git a/core/modules/link/tests/src/Kernel/LinkItemTest.php b/core/modules/link/tests/src/Kernel/LinkItemTest.php index 5ecbb761c839..c4ac5e39d158 100644 --- a/core/modules/link/tests/src/Kernel/LinkItemTest.php +++ b/core/modules/link/tests/src/Kernel/LinkItemTest.php @@ -136,7 +136,7 @@ public function testLinkItem() { $entity->field_test = ['uri' => 'internal:/node/add']; $this->assertEqual($entity->field_test->uri, 'internal:/node/add'); $this->assertNull($entity->field_test->title); - $this->assertIdentical($entity->field_test->options, []); + $this->assertIdentical([], $entity->field_test->options); // Check that if we set uri and options then the default values are properly // initialized. @@ -153,7 +153,7 @@ public function testLinkItem() { $entity->field_test = 'internal:/node/add'; $this->assertEqual($entity->field_test->uri, 'internal:/node/add'); $this->assertNull($entity->field_test->title); - $this->assertIdentical($entity->field_test->options, []); + $this->assertIdentical([], $entity->field_test->options); // Check that setting options to NULL does not trigger an error when // calling getUrl(); diff --git a/core/modules/locale/tests/src/Functional/LocaleImportFunctionalTest.php b/core/modules/locale/tests/src/Functional/LocaleImportFunctionalTest.php index b36a40d41400..58475b69f66b 100644 --- a/core/modules/locale/tests/src/Functional/LocaleImportFunctionalTest.php +++ b/core/modules/locale/tests/src/Functional/LocaleImportFunctionalTest.php @@ -259,8 +259,8 @@ public function testLanguageContext() { // We cast the return value of t() to string so as to retrieve the // translated value, rendered as a string. - $this->assertIdentical((string) t('May', [], ['langcode' => 'hr', 'context' => 'Long month name']), 'Svibanj', 'Long month name context is working.'); - $this->assertIdentical((string) t('May', [], ['langcode' => 'hr']), 'Svi.', 'Default context is working.'); + $this->assertIdentical('Svibanj', (string) t('May', [], ['langcode' => 'hr', 'context' => 'Long month name']), 'Long month name context is working.'); + $this->assertIdentical('Svi.', (string) t('May', [], ['langcode' => 'hr']), 'Default context is working.'); } /** @@ -275,7 +275,7 @@ public function testEmptyMsgstr() { ]); $this->assertRaw(t('One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.', ['%number' => 1, '%update' => 0, '%delete' => 0])); - $this->assertIdentical((string) t('Operations', [], ['langcode' => $langcode]), 'Műveletek', 'String imported and translated.'); + $this->assertIdentical('Műveletek', (string) t('Operations', [], ['langcode' => $langcode]), 'String imported and translated.'); // Try importing a .po file. $this->importPoFile($this->getPoFileWithEmptyMsgstr(), [ diff --git a/core/modules/locale/tests/src/Functional/LocalePluralFormatTest.php b/core/modules/locale/tests/src/Functional/LocalePluralFormatTest.php index 01fa80f8ab5b..a9621e5e77a9 100644 --- a/core/modules/locale/tests/src/Functional/LocalePluralFormatTest.php +++ b/core/modules/locale/tests/src/Functional/LocalePluralFormatTest.php @@ -139,12 +139,12 @@ public function testGetPluralFormat() { foreach ($plural_tests as $langcode => $tests) { foreach ($tests as $count => $expected_plural_index) { // Assert that the we get the right plural index. - $this->assertIdentical(locale_get_plural($count, $langcode), $expected_plural_index, 'Computed plural index for ' . $langcode . ' for count ' . $count . ' is ' . $expected_plural_index); + $this->assertIdentical($expected_plural_index, locale_get_plural($count, $langcode), 'Computed plural index for ' . $langcode . ' for count ' . $count . ' is ' . $expected_plural_index); // Assert that the we get the right translation for that. Change the // expected index as per the logic for translation lookups. $expected_plural_index = ($count == 1) ? 0 : $expected_plural_index; $expected_plural_string = str_replace('@count', $count, $plural_strings[$langcode][$expected_plural_index]); - $this->assertIdentical(\Drupal::translation()->formatPlural($count, '1 hour', '@count hours', [], ['langcode' => $langcode])->render(), $expected_plural_string, 'Plural translation of 1 hours / @count hours for count ' . $count . ' in ' . $langcode . ' is ' . $expected_plural_string); + $this->assertIdentical($expected_plural_string, \Drupal::translation()->formatPlural($count, '1 hour', '@count hours', [], ['langcode' => $langcode])->render(), 'Plural translation of 1 hours / @count hours for count ' . $count . ' in ' . $langcode . ' is ' . $expected_plural_string); // DO NOT use translation to pass translated strings into // PluralTranslatableMarkup::createFromTranslatedString() this way. It // is designed to be used with *already* translated text like settings @@ -152,7 +152,7 @@ public function testGetPluralFormat() { // the expected result data in that format. $translated_string = \Drupal::translation()->translate('1 hour' . PoItem::DELIMITER . '@count hours', [], ['langcode' => $langcode]); $plural = PluralTranslatableMarkup::createFromTranslatedString($count, $translated_string, [], ['langcode' => $langcode]); - $this->assertIdentical($plural->render(), $expected_plural_string); + $this->assertIdentical($expected_plural_string, $plural->render()); } } } diff --git a/core/modules/locale/tests/src/Kernel/LocaleConfigSubscriberTest.php b/core/modules/locale/tests/src/Kernel/LocaleConfigSubscriberTest.php index e5a33c9f2632..7d59dd28356d 100644 --- a/core/modules/locale/tests/src/Kernel/LocaleConfigSubscriberTest.php +++ b/core/modules/locale/tests/src/Kernel/LocaleConfigSubscriberTest.php @@ -428,7 +428,7 @@ protected function assertConfigOverride($config_name, $key, $value, $langcode) { protected function assertActiveConfig($config_name, $key, $value, $langcode) { $config = $this->configFactory->getEditable($config_name); $this->assertEqual($config->get('langcode'), $langcode); - $this->assertIdentical($config->get($key), $value); + $this->assertIdentical($value, $config->get($key)); } /** diff --git a/core/modules/migrate/tests/src/Kernel/MigrateEmbeddedDataTest.php b/core/modules/migrate/tests/src/Kernel/MigrateEmbeddedDataTest.php index c7aa13fc7304..f7e2fdd614d8 100644 --- a/core/modules/migrate/tests/src/Kernel/MigrateEmbeddedDataTest.php +++ b/core/modules/migrate/tests/src/Kernel/MigrateEmbeddedDataTest.php @@ -55,17 +55,17 @@ public function testEmbeddedData() { unset($data_row['ids']); $results[] = $data_row; } - $this->assertIdentical($results, $data_rows); + $this->assertIdentical($data_rows, $results); // Validate the public APIs. $this->assertSame(count($data_rows), $source->count()); - $this->assertIdentical($source->getIds(), $ids); + $this->assertIdentical($ids, $source->getIds()); $expected_fields = [ 'key' => 'key', 'field1' => 'field1', 'field2' => 'field2', ]; - $this->assertIdentical($source->fields(), $expected_fields); + $this->assertIdentical($expected_fields, $source->fields()); } } diff --git a/core/modules/migrate/tests/src/Kernel/MigrateEventsTest.php b/core/modules/migrate/tests/src/Kernel/MigrateEventsTest.php index 91cf1b623040..785991d8ce36 100644 --- a/core/modules/migrate/tests/src/Kernel/MigrateEventsTest.php +++ b/core/modules/migrate/tests/src/Kernel/MigrateEventsTest.php @@ -82,41 +82,41 @@ public function testMigrateEvents() { // Validate from the recorded state that the events were received. $event = $this->state->get('migrate_events_test.pre_import_event', []); - $this->assertIdentical($event['event_name'], MigrateEvents::PRE_IMPORT); - $this->assertIdentical($event['migration']->id(), $migration->id()); + $this->assertIdentical(MigrateEvents::PRE_IMPORT, $event['event_name']); + $this->assertIdentical($migration->id(), $event['migration']->id()); $event = $this->state->get('migrate_events_test.post_import_event', []); - $this->assertIdentical($event['event_name'], MigrateEvents::POST_IMPORT); - $this->assertIdentical($event['migration']->id(), $migration->id()); + $this->assertIdentical(MigrateEvents::POST_IMPORT, $event['event_name']); + $this->assertIdentical($migration->id(), $event['migration']->id()); $event = $this->state->get('migrate_events_test.map_save_event', []); - $this->assertIdentical($event['event_name'], MigrateEvents::MAP_SAVE); + $this->assertIdentical(MigrateEvents::MAP_SAVE, $event['event_name']); // Validating the last row processed. - $this->assertIdentical($event['fields']['sourceid1'], 'dummy value'); - $this->assertIdentical($event['fields']['destid1'], 'dummy value'); - $this->assertIdentical($event['fields']['source_row_status'], 0); + $this->assertIdentical('dummy value', $event['fields']['sourceid1']); + $this->assertIdentical('dummy value', $event['fields']['destid1']); + $this->assertIdentical(0, $event['fields']['source_row_status']); $event = $this->state->get('migrate_events_test.map_delete_event', []); - $this->assertIdentical($event, []); + $this->assertIdentical([], $event); $event = $this->state->get('migrate_events_test.pre_row_save_event', []); - $this->assertIdentical($event['event_name'], MigrateEvents::PRE_ROW_SAVE); - $this->assertIdentical($event['migration']->id(), $migration->id()); + $this->assertIdentical(MigrateEvents::PRE_ROW_SAVE, $event['event_name']); + $this->assertIdentical($migration->id(), $event['migration']->id()); // Validating the last row processed. - $this->assertIdentical($event['row']->getSourceProperty('data'), 'dummy value'); + $this->assertIdentical('dummy value', $event['row']->getSourceProperty('data')); $event = $this->state->get('migrate_events_test.post_row_save_event', []); - $this->assertIdentical($event['event_name'], MigrateEvents::POST_ROW_SAVE); - $this->assertIdentical($event['migration']->id(), $migration->id()); + $this->assertIdentical(MigrateEvents::POST_ROW_SAVE, $event['event_name']); + $this->assertIdentical($migration->id(), $event['migration']->id()); // Validating the last row processed. - $this->assertIdentical($event['row']->getSourceProperty('data'), 'dummy value'); - $this->assertIdentical($event['destination_id_values']['value'], 'dummy value'); + $this->assertIdentical('dummy value', $event['row']->getSourceProperty('data')); + $this->assertIdentical('dummy value', $event['destination_id_values']['value']); // Generate a map delete event. $migration->getIdMap()->delete(['data' => 'dummy value']); $event = $this->state->get('migrate_events_test.map_delete_event', []); - $this->assertIdentical($event['event_name'], MigrateEvents::MAP_DELETE); - $this->assertIdentical($event['source_id'], ['data' => 'dummy value']); + $this->assertIdentical(MigrateEvents::MAP_DELETE, $event['event_name']); + $this->assertIdentical(['data' => 'dummy value'], $event['source_id']); } /** diff --git a/core/modules/migrate/tests/src/Kernel/MigrateMessageTest.php b/core/modules/migrate/tests/src/Kernel/MigrateMessageTest.php index c4d39a3dad52..8aeed9eabd31 100644 --- a/core/modules/migrate/tests/src/Kernel/MigrateMessageTest.php +++ b/core/modules/migrate/tests/src/Kernel/MigrateMessageTest.php @@ -94,7 +94,7 @@ public function testMessagesTeed() { $executable = new MigrateExecutable($this->migration, $this); $executable->import(); $this->assertCount(1, $this->messages); - $this->assertIdentical(reset($this->messages), "source_message: 'a message' is not an array"); + $this->assertIdentical("source_message: 'a message' is not an array", reset($this->messages)); } /** diff --git a/core/modules/migrate/tests/src/Kernel/MigrateStatusTest.php b/core/modules/migrate/tests/src/Kernel/MigrateStatusTest.php index df9e770305b8..b8e2d8859079 100644 --- a/core/modules/migrate/tests/src/Kernel/MigrateStatusTest.php +++ b/core/modules/migrate/tests/src/Kernel/MigrateStatusTest.php @@ -30,7 +30,7 @@ public function testStatus() { // Default status is idle. $status = $migration->getStatus(); - $this->assertIdentical($status, MigrationInterface::STATUS_IDLE); + $this->assertIdentical(MigrationInterface::STATUS_IDLE, $status); // Test setting and retrieving all known status values. $status_list = [ @@ -42,7 +42,7 @@ public function testStatus() { ]; foreach ($status_list as $status) { $migration->setStatus($status); - $this->assertIdentical($migration->getStatus(), $status); + $this->assertIdentical($status, $migration->getStatus()); } } diff --git a/core/modules/node/tests/src/Functional/NodeAccessBaseTableTest.php b/core/modules/node/tests/src/Functional/NodeAccessBaseTableTest.php index 84086f4a6d4c..b0884d2a3651 100644 --- a/core/modules/node/tests/src/Functional/NodeAccessBaseTableTest.php +++ b/core/modules/node/tests/src/Functional/NodeAccessBaseTableTest.php @@ -230,13 +230,7 @@ protected function assertTaxonomyPage($is_admin) { if (!$is_admin && $tid_is_private) { $should_be_visible = $should_be_visible && $uid == $this->webUser->id(); } - $this->assertIdentical(isset($this->nidsVisible[$nid]), $should_be_visible, strtr('A %private node by user %uid is %visible for user %current_uid on the %tid_is_private page.', [ - '%private' => $is_private ? 'private' : 'public', - '%uid' => $uid, - '%visible' => isset($this->nidsVisible[$nid]) ? 'visible' : 'not visible', - '%current_uid' => $this->webUser->id(), - '%tid_is_private' => $tid_is_private ? 'private' : 'public', - ])); + $this->assertIdentical($should_be_visible, isset($this->nidsVisible[$nid]), strtr('A %private node by user %uid is %visible for user %current_uid on the %tid_is_private page.', ['%private' => $is_private ? 'private' : 'public', '%uid' => $uid, '%visible' => isset($this->nidsVisible[$nid]) ? 'visible' : 'not visible', '%current_uid' => $this->webUser->id(), '%tid_is_private' => $tid_is_private ? 'private' : 'public'])); } } } diff --git a/core/modules/node/tests/src/Functional/NodeEditFormTest.php b/core/modules/node/tests/src/Functional/NodeEditFormTest.php index b2a67a5fe954..3640632016e8 100644 --- a/core/modules/node/tests/src/Functional/NodeEditFormTest.php +++ b/core/modules/node/tests/src/Functional/NodeEditFormTest.php @@ -170,7 +170,7 @@ public function testNodeEditAuthoredBy() { // Check that the node was authored by the currently logged in user. $node = $this->drupalGetNodeByTitle($edit['title[0][value]']); - $this->assertIdentical($node->getOwnerId(), $this->adminUser->id(), 'Node authored by admin user.'); + $this->assertIdentical($this->adminUser->id(), $node->getOwnerId(), 'Node authored by admin user.'); $this->checkVariousAuthoredByValues($node, 'uid[0][target_id]'); @@ -291,7 +291,7 @@ protected function checkVariousAuthoredByValues(NodeInterface $node, $form_eleme $this->submitForm($edit, 'Save'); $this->nodeStorage->resetCache([$node->id()]); $node = $this->nodeStorage->load($node->id()); - $this->assertIdentical($node->getOwnerId(), $this->webUser->id(), 'Node authored by normal user.'); + $this->assertIdentical($this->webUser->id(), $node->getOwnerId(), 'Node authored by normal user.'); } } diff --git a/core/modules/node/tests/src/Kernel/Migrate/d6/MigrateNodeTypeTest.php b/core/modules/node/tests/src/Kernel/Migrate/d6/MigrateNodeTypeTest.php index bd41f9a1f0c9..3d4b5f209288 100644 --- a/core/modules/node/tests/src/Kernel/Migrate/d6/MigrateNodeTypeTest.php +++ b/core/modules/node/tests/src/Kernel/Migrate/d6/MigrateNodeTypeTest.php @@ -57,7 +57,7 @@ public function testNodeType() { $this->assertTrue($node_type_story->displaySubmitted()); $this->assertFalse($node_type_story->shouldCreateNewRevision()); $this->assertIdentical(DRUPAL_OPTIONAL, $node_type_story->getPreviewMode()); - $this->assertIdentical($id_map->lookupDestinationIds(['test_story']), [['test_story']]); + $this->assertIdentical([['test_story']], $id_map->lookupDestinationIds(['test_story'])); // Test we don't have a body field. $field = FieldConfig::loadByName('node', 'test_story', 'body'); @@ -76,7 +76,7 @@ public function testNodeType() { $this->assertTrue($node_type_event->displaySubmitted()); $this->assertTrue($node_type_event->shouldCreateNewRevision()); $this->assertIdentical(DRUPAL_OPTIONAL, $node_type_event->getPreviewMode()); - $this->assertIdentical($id_map->lookupDestinationIds(['test_event']), [['test_event']]); + $this->assertIdentical([['test_event']], $id_map->lookupDestinationIds(['test_event'])); // Test we have a body field. $field = FieldConfig::loadByName('node', 'test_event', 'body'); diff --git a/core/modules/options/tests/src/Functional/OptionsFloatFieldImportTest.php b/core/modules/options/tests/src/Functional/OptionsFloatFieldImportTest.php index f7f9bf9e8296..a79ca53faa3e 100644 --- a/core/modules/options/tests/src/Functional/OptionsFloatFieldImportTest.php +++ b/core/modules/options/tests/src/Functional/OptionsFloatFieldImportTest.php @@ -60,7 +60,7 @@ public function testImport() { // necessary configuration for this test is created by installing that // module. $field_storage = FieldStorageConfig::loadByName('node', $field_name); - $this->assertIdentical($field_storage->getSetting('allowed_values'), $array = ['0' => 'Zero', '0.5' => 'Point five']); + $this->assertIdentical($array = ['0' => 'Zero', '0.5' => 'Point five'], $field_storage->getSetting('allowed_values')); $admin_path = 'admin/structure/types/manage/' . $type . '/fields/node.' . $type . '.' . $field_name . '/storage'; @@ -71,14 +71,14 @@ public function testImport() { $edit = ['settings[allowed_values]' => "0|Zero\n1|One"]; $this->drupalPostForm($admin_path, $edit, 'Save field settings'); $field_storage = FieldStorageConfig::loadByName('node', $field_name); - $this->assertIdentical($field_storage->getSetting('allowed_values'), $array = ['0' => 'Zero', '1' => 'One']); + $this->assertIdentical($array = ['0' => 'Zero', '1' => 'One'], $field_storage->getSetting('allowed_values')); // Import configuration with dots in the allowed values key names. This // tests \Drupal\Core\Config\Entity\ConfigEntityStorage::importUpdate(). $this->drupalGet('admin/config/development/configuration'); $this->submitForm([], 'Import all'); $field_storage = FieldStorageConfig::loadByName('node', $field_name); - $this->assertIdentical($field_storage->getSetting('allowed_values'), $array = ['0' => 'Zero', '0.5' => 'Point five']); + $this->assertIdentical($array = ['0' => 'Zero', '0.5' => 'Point five'], $field_storage->getSetting('allowed_values')); // Delete field to test creation. This tests // \Drupal\Core\Config\Entity\ConfigEntityStorage::importCreate(). @@ -87,7 +87,7 @@ public function testImport() { $this->drupalGet('admin/config/development/configuration'); $this->submitForm([], 'Import all'); $field_storage = FieldStorageConfig::loadByName('node', $field_name); - $this->assertIdentical($field_storage->getSetting('allowed_values'), $array = ['0' => 'Zero', '0.5' => 'Point five']); + $this->assertIdentical($array = ['0' => 'Zero', '0.5' => 'Point five'], $field_storage->getSetting('allowed_values')); } } diff --git a/core/modules/page_cache/tests/src/Functional/PageCacheTest.php b/core/modules/page_cache/tests/src/Functional/PageCacheTest.php index ee3a21efa860..1090fd025793 100644 --- a/core/modules/page_cache/tests/src/Functional/PageCacheTest.php +++ b/core/modules/page_cache/tests/src/Functional/PageCacheTest.php @@ -76,7 +76,7 @@ public function testPageCacheTags() { 'rendered', 'system_test_cache_tags_page', ]; - $this->assertIdentical($cache_entry->tags, $expected_tags); + $this->assertIdentical($expected_tags, $cache_entry->tags); Cache::invalidateTags($tags); $this->drupalGet($path); @@ -111,7 +111,7 @@ public function testPageCacheTagsIndependentFromCacheabilityHeaders() { 'rendered', 'system_test_cache_tags_page', ]; - $this->assertIdentical($cache_entry->tags, $expected_tags); + $this->assertIdentical($expected_tags, $cache_entry->tags); Cache::invalidateTags($tags); $this->drupalGet($path); diff --git a/core/modules/path_alias/tests/src/Functional/UrlAlterFunctionalTest.php b/core/modules/path_alias/tests/src/Functional/UrlAlterFunctionalTest.php index de9e966ba6b6..65ba4b62789a 100644 --- a/core/modules/path_alias/tests/src/Functional/UrlAlterFunctionalTest.php +++ b/core/modules/path_alias/tests/src/Functional/UrlAlterFunctionalTest.php @@ -103,7 +103,7 @@ public function testUrlAlter() { protected function assertUrlOutboundAlter($original, $final) { // Test outbound altering. $result = $this->container->get('path_processor_manager')->processOutbound($original); - return $this->assertIdentical($result, $final, new FormattableMarkup('Altered outbound URL %original, expected %final, and got %result.', ['%original' => $original, '%final' => $final, '%result' => $result])); + return $this->assertIdentical($final, $result, new FormattableMarkup('Altered outbound URL %original, expected %final, and got %result.', ['%original' => $original, '%final' => $final, '%result' => $result])); } /** @@ -120,7 +120,7 @@ protected function assertUrlOutboundAlter($original, $final) { protected function assertUrlInboundAlter($original, $final) { // Test inbound altering. $result = $this->container->get('path_alias.manager')->getPathByAlias($original); - return $this->assertIdentical($result, $final, new FormattableMarkup('Altered inbound URL %original, expected %final, and got %result.', ['%original' => $original, '%final' => $final, '%result' => $result])); + return $this->assertIdentical($final, $result, new FormattableMarkup('Altered inbound URL %original, expected %final, and got %result.', ['%original' => $original, '%final' => $final, '%result' => $result])); } } diff --git a/core/modules/quickedit/tests/src/Functional/QuickEditCustomPipelineTest.php b/core/modules/quickedit/tests/src/Functional/QuickEditCustomPipelineTest.php index a2064ee05eb0..54d3d05e4617 100644 --- a/core/modules/quickedit/tests/src/Functional/QuickEditCustomPipelineTest.php +++ b/core/modules/quickedit/tests/src/Functional/QuickEditCustomPipelineTest.php @@ -100,7 +100,7 @@ public function testCustomPipeline() { $this->assertIdentical('quickeditFieldFormSaved', $ajax_commands[0]['command'], 'The first AJAX command is a quickeditFieldFormSaved command.'); $this->assertStringContainsString('Fine thanks.', $ajax_commands[0]['data'], 'Form value saved and printed back.'); $this->assertStringContainsString('<div class="quickedit-test-wrapper">', $ajax_commands[0]['data'], 'Custom render pipeline used to render the value.'); - $this->assertIdentical(array_keys($ajax_commands[0]['other_view_modes']), ['full'], 'Field was also rendered in the "full" view mode.'); + $this->assertIdentical(['full'], array_keys($ajax_commands[0]['other_view_modes']), 'Field was also rendered in the "full" view mode.'); $this->assertStringContainsString('Fine thanks.', $ajax_commands[0]['other_view_modes']['full'], '"full" version of field contains the form value.'); } diff --git a/core/modules/rest/tests/src/Functional/Views/ExcludedFieldTokenTest.php b/core/modules/rest/tests/src/Functional/Views/ExcludedFieldTokenTest.php index 084d03dda545..2354b0e750b9 100644 --- a/core/modules/rest/tests/src/Functional/Views/ExcludedFieldTokenTest.php +++ b/core/modules/rest/tests/src/Functional/Views/ExcludedFieldTokenTest.php @@ -86,7 +86,7 @@ public function testExcludedTitleTokenDisplay() { ['nothing' => 'Article test 2'], ['nothing' => 'Article test 1'], ]; - $this->assertIdentical($actual_json, json_encode($expected)); + $this->assertIdentical(json_encode($expected), $actual_json); } } diff --git a/core/modules/rest/tests/src/Functional/Views/FieldCounterTest.php b/core/modules/rest/tests/src/Functional/Views/FieldCounterTest.php index 09b9b178b617..d9c3b0dfe1f6 100644 --- a/core/modules/rest/tests/src/Functional/Views/FieldCounterTest.php +++ b/core/modules/rest/tests/src/Functional/Views/FieldCounterTest.php @@ -86,7 +86,7 @@ public function testExcludedTitleTokenDisplay() { ['counter' => '9'], ['counter' => '10'], ]; - $this->assertIdentical($actual_json, json_encode($expected)); + $this->assertIdentical(json_encode($expected), $actual_json); } } diff --git a/core/modules/rest/tests/src/Functional/Views/StyleSerializerTest.php b/core/modules/rest/tests/src/Functional/Views/StyleSerializerTest.php index 2adf01ce1ea7..9002d458e6e5 100644 --- a/core/modules/rest/tests/src/Functional/Views/StyleSerializerTest.php +++ b/core/modules/rest/tests/src/Functional/Views/StyleSerializerTest.php @@ -153,7 +153,7 @@ public function testSerializerResponses() { $expected[] = $expected_row; } - $this->assertIdentical($actual_json, json_encode($expected), 'The expected JSON output was found.'); + $this->assertIdentical(json_encode($expected), $actual_json, 'The expected JSON output was found.'); // Test that the rendered output and the preview output are the same. $view->destroy(); @@ -161,7 +161,7 @@ public function testSerializerResponses() { // Mock the request content type by setting it on the display handler. $view->display_handler->setContentType('json'); $output = $view->preview(); - $this->assertIdentical($actual_json, (string) $this->renderer->renderRoot($output), 'The expected JSON preview output was found.'); + $this->assertIdentical((string) $this->renderer->renderRoot($output), $actual_json, 'The expected JSON preview output was found.'); // Test a 403 callback. $this->drupalGet('test/serialize/denied', ['query' => ['_format' => 'json']]); @@ -184,7 +184,7 @@ public function testSerializerResponses() { $actual_json = $this->drupalGet('test/serialize/entity', ['query' => ['_format' => 'json']]); $this->assertSession()->statusCodeEquals(200); - $this->assertIdentical($actual_json, $expected, 'The expected JSON output was found.'); + $this->assertIdentical($expected, $actual_json, 'The expected JSON output was found.'); $expected_cache_tags = $view->getCacheTags(); $expected_cache_tags[] = 'entity_test_list'; /** @var \Drupal\Core\Entity\EntityInterface $entity */ @@ -196,7 +196,7 @@ public function testSerializerResponses() { $expected = $serializer->serialize($entities, 'hal_json'); $actual_json = $this->drupalGet('test/serialize/entity', ['query' => ['_format' => 'hal_json']]); - $this->assertIdentical($actual_json, $expected, 'The expected HAL output was found.'); + $this->assertIdentical($expected, $actual_json, 'The expected HAL output was found.'); $this->assertCacheTags($expected_cache_tags); // Change the format to xml. @@ -231,7 +231,7 @@ public function testSerializerResponses() { $view->save(); $expected = $serializer->serialize($entities, 'json'); $actual_json = $this->drupalGet('test/serialize/entity', ['query' => ['_format' => 'json']]); - $this->assertIdentical($actual_json, $expected, 'The expected JSON output was found.'); + $this->assertIdentical($expected, $actual_json, 'The expected JSON output was found.'); $expected = $serializer->serialize($entities, 'xml'); $actual_xml = $this->drupalGet('test/serialize/entity', ['query' => ['_format' => 'xml']]); $this->assertSame(trim($expected), $actual_xml); @@ -551,8 +551,8 @@ public function testFieldRawOutput() { // Just test the raw 'created' value against each row. foreach (Json::decode($this->drupalGet('test/serialize/field', ['query' => ['_format' => 'json']])) as $index => $values) { - $this->assertIdentical($values['created'], $view->result[$index]->views_test_data_created, 'Expected raw created value found.'); - $this->assertIdentical($values['name'], $view->result[$index]->views_test_data_name, 'Expected raw name value found.'); + $this->assertIdentical($view->result[$index]->views_test_data_created, $values['created'], 'Expected raw created value found.'); + $this->assertIdentical($view->result[$index]->views_test_data_name, $values['name'], 'Expected raw name value found.'); } // Test result with an excluded field. @@ -687,7 +687,7 @@ public function testFieldapiField() { // Test the raw 'created' value against each row. foreach (Json::decode($this->drupalGet('test/serialize/node-field', ['query' => ['_format' => 'json']])) as $index => $values) { - $this->assertIdentical($values['title'], $view->result[$index]->_entity->title->value, 'Expected raw title value found.'); + $this->assertIdentical($view->result[$index]->_entity->title->value, $values['title'], 'Expected raw title value found.'); } // Test that multiple raw body fields are shown. @@ -872,7 +872,7 @@ public function testMulEntityRows() { // Check that the names are correct. $expected = ['mul-l1-l2', 'mul-l1-orig', 'mul-l2-l1', 'mul-l2-orig', 'mul-none']; - $this->assertIdentical($names, $expected, 'The translated content was found in the JSON.'); + $this->assertIdentical($expected, $names, 'The translated content was found in the JSON.'); } } diff --git a/core/modules/search/tests/src/Functional/SearchConfigSettingsFormTest.php b/core/modules/search/tests/src/Functional/SearchConfigSettingsFormTest.php index b38c01fc7f19..5c6aa7a38457 100644 --- a/core/modules/search/tests/src/Functional/SearchConfigSettingsFormTest.php +++ b/core/modules/search/tests/src/Functional/SearchConfigSettingsFormTest.php @@ -239,9 +239,9 @@ public function testSearchModuleDisabling() { public function testDefaultSearchPageOrdering() { $this->drupalGet('search'); $elements = $this->xpath('//*[contains(@class, :class)]//a', [':class' => 'tabs primary']); - $this->assertIdentical($elements[0]->getAttribute('href'), Url::fromRoute('search.view_node_search')->toString()); - $this->assertIdentical($elements[1]->getAttribute('href'), Url::fromRoute('search.view_dummy_search_type')->toString()); - $this->assertIdentical($elements[2]->getAttribute('href'), Url::fromRoute('search.view_user_search')->toString()); + $this->assertIdentical(Url::fromRoute('search.view_node_search')->toString(), $elements[0]->getAttribute('href')); + $this->assertIdentical(Url::fromRoute('search.view_dummy_search_type')->toString(), $elements[1]->getAttribute('href')); + $this->assertIdentical(Url::fromRoute('search.view_user_search')->toString(), $elements[2]->getAttribute('href')); } /** @@ -294,8 +294,8 @@ public function testMultipleSearchPages() { // Ensure both search pages have their tabs displayed. $this->drupalGet('search'); $elements = $this->xpath('//*[contains(@class, :class)]//a', [':class' => 'tabs primary']); - $this->assertIdentical($elements[0]->getAttribute('href'), Url::fromRoute('search.view_' . $first_id)->toString()); - $this->assertIdentical($elements[1]->getAttribute('href'), Url::fromRoute('search.view_' . $second_id)->toString()); + $this->assertIdentical(Url::fromRoute('search.view_' . $first_id)->toString(), $elements[0]->getAttribute('href')); + $this->assertIdentical(Url::fromRoute('search.view_' . $second_id)->toString(), $elements[1]->getAttribute('href')); // Switch the weight of the search pages and check the order of the tabs. $edit = [ @@ -305,8 +305,8 @@ public function testMultipleSearchPages() { $this->drupalPostForm('admin/config/search/pages', $edit, 'Save configuration'); $this->drupalGet('search'); $elements = $this->xpath('//*[contains(@class, :class)]//a', [':class' => 'tabs primary']); - $this->assertIdentical($elements[0]->getAttribute('href'), Url::fromRoute('search.view_' . $second_id)->toString()); - $this->assertIdentical($elements[1]->getAttribute('href'), Url::fromRoute('search.view_' . $first_id)->toString()); + $this->assertIdentical(Url::fromRoute('search.view_' . $second_id)->toString(), $elements[0]->getAttribute('href')); + $this->assertIdentical(Url::fromRoute('search.view_' . $first_id)->toString(), $elements[1]->getAttribute('href')); // Check the initial state of the search pages. $this->drupalGet('admin/config/search/pages'); @@ -407,7 +407,7 @@ protected function verifySearchPageOperations($id, $edit, $delete, $disable, $en protected function assertDefaultSearch($expected, $message = '', $group = 'Other') { /** @var $search_page_repository \Drupal\search\SearchPageRepositoryInterface */ $search_page_repository = \Drupal::service('search.search_page_repository'); - $this->assertIdentical($search_page_repository->getDefaultSearchPage(), $expected, $message, $group); + $this->assertIdentical($expected, $search_page_repository->getDefaultSearchPage(), $message, $group); } /** diff --git a/core/modules/search/tests/src/Kernel/Migrate/d6/MigrateSearchPageTest.php b/core/modules/search/tests/src/Kernel/Migrate/d6/MigrateSearchPageTest.php index 574e9c18c16e..869f83bfb40d 100644 --- a/core/modules/search/tests/src/Kernel/Migrate/d6/MigrateSearchPageTest.php +++ b/core/modules/search/tests/src/Kernel/Migrate/d6/MigrateSearchPageTest.php @@ -35,14 +35,14 @@ public function testSearchPage() { $search_page = SearchPage::load($id); $this->assertIdentical($id, $search_page->id()); $configuration = $search_page->getPlugin()->getConfiguration(); - $this->assertIdentical($configuration['rankings'], [ + $this->assertIdentical([ 'comments' => 5, 'promote' => 0, 'recent' => 0, 'relevance' => 2, 'sticky' => 8, 'views' => 1, - ]); + ], $configuration['rankings']); $this->assertIdentical('node', $search_page->getPath()); // Test that we can re-import using the EntitySearchPage destination. diff --git a/core/modules/search/tests/src/Kernel/SearchSimplifyTest.php b/core/modules/search/tests/src/Kernel/SearchSimplifyTest.php index c2a6699fb7df..a5f2e165eda6 100644 --- a/core/modules/search/tests/src/Kernel/SearchSimplifyTest.php +++ b/core/modules/search/tests/src/Kernel/SearchSimplifyTest.php @@ -37,7 +37,7 @@ public function testSearchSimplifyUnicode() { if ($key % 2) { // Even line - should simplify down to a space. $simplified = $text_processor->analyze($string); - $this->assertIdentical($simplified, ' ', "Line $key is excluded from the index"); + $this->assertIdentical(' ', $simplified, "Line {$key} is excluded from the index"); } else { // Odd line, should be word characters. diff --git a/core/modules/serialization/tests/src/Kernel/EntitySerializationTest.php b/core/modules/serialization/tests/src/Kernel/EntitySerializationTest.php index 93945e5b8f85..202406d03fc4 100644 --- a/core/modules/serialization/tests/src/Kernel/EntitySerializationTest.php +++ b/core/modules/serialization/tests/src/Kernel/EntitySerializationTest.php @@ -199,7 +199,7 @@ public function testUserNormalize() { // The key 'pass' will now exist, but the password value should be // normalized to NULL. - $this->assertIdentical($normalized['pass'], [NULL], '"pass" value is normalized to [NULL]'); + $this->assertIdentical([NULL], $normalized['pass'], '"pass" value is normalized to [NULL]'); } /** @@ -213,14 +213,14 @@ public function testSerialize() { $expected = Json::encode($normalized); // Test 'json'. $actual = $this->serializer->serialize($this->entity, 'json'); - $this->assertIdentical($actual, $expected, 'Entity serializes to JSON when "json" is requested.'); + $this->assertIdentical($expected, $actual, 'Entity serializes to JSON when "json" is requested.'); $actual = $this->serializer->serialize($normalized, 'json'); - $this->assertIdentical($actual, $expected, 'A normalized array serializes to JSON when "json" is requested'); + $this->assertIdentical($expected, $actual, 'A normalized array serializes to JSON when "json" is requested'); // Test 'ajax'. $actual = $this->serializer->serialize($this->entity, 'ajax'); - $this->assertIdentical($actual, $expected, 'Entity serializes to JSON when "ajax" is requested.'); + $this->assertIdentical($expected, $actual, 'Entity serializes to JSON when "ajax" is requested.'); $actual = $this->serializer->serialize($normalized, 'ajax'); - $this->assertIdentical($actual, $expected, 'A normalized array serializes to JSON when "ajax" is requested'); + $this->assertIdentical($expected, $actual, 'A normalized array serializes to JSON when "ajax" is requested'); // Generate the expected xml in a way that allows changes to entity property // order. @@ -253,9 +253,9 @@ public function testSerialize() { $expected = implode('', $expected); // Test 'xml'. The output should match that of Symfony's XmlEncoder. $actual = $this->serializer->serialize($this->entity, 'xml'); - $this->assertIdentical($actual, $expected); + $this->assertIdentical($expected, $actual); $actual = $this->serializer->serialize($normalized, 'xml'); - $this->assertIdentical($actual, $expected); + $this->assertIdentical($expected, $actual); } /** @@ -267,9 +267,9 @@ public function testDenormalize() { foreach (['json', 'xml'] as $type) { $denormalized = $this->serializer->denormalize($normalized, $this->entityClass, $type, ['entity_type' => 'entity_test_mulrev']); $this->assertInstanceOf($this->entityClass, $denormalized); - $this->assertIdentical($denormalized->getEntityTypeId(), $this->entity->getEntityTypeId(), 'Expected entity type found.'); - $this->assertIdentical($denormalized->bundle(), $this->entity->bundle(), 'Expected entity bundle found.'); - $this->assertIdentical($denormalized->uuid(), $this->entity->uuid(), 'Expected entity UUID found.'); + $this->assertIdentical($this->entity->getEntityTypeId(), $denormalized->getEntityTypeId(), 'Expected entity type found.'); + $this->assertIdentical($this->entity->bundle(), $denormalized->bundle(), 'Expected entity bundle found.'); + $this->assertIdentical($this->entity->uuid(), $denormalized->uuid(), 'Expected entity UUID found.'); } } diff --git a/core/modules/serialization/tests/src/Kernel/SerializationTest.php b/core/modules/serialization/tests/src/Kernel/SerializationTest.php index 91d832a4b378..23d3a3b2349a 100644 --- a/core/modules/serialization/tests/src/Kernel/SerializationTest.php +++ b/core/modules/serialization/tests/src/Kernel/SerializationTest.php @@ -40,7 +40,7 @@ public function testSerializerComponentRegistration() { $expected = 'Normalized by SerializationTestNormalizer, Encoded by SerializationTestEncoder'; // Ensure the serialization invokes the expected normalizer and encoder. - $this->assertIdentical($this->serializer->serialize($object, $format), $expected); + $this->assertIdentical($expected, $this->serializer->serialize($object, $format)); // Ensure the serialization fails for an unsupported format. try { diff --git a/core/modules/shortcut/tests/src/Functional/ShortcutSetsTest.php b/core/modules/shortcut/tests/src/Functional/ShortcutSetsTest.php index e9a90a47f475..705b098ecc70 100644 --- a/core/modules/shortcut/tests/src/Functional/ShortcutSetsTest.php +++ b/core/modules/shortcut/tests/src/Functional/ShortcutSetsTest.php @@ -44,7 +44,7 @@ public function testShortcutSetAdd() { ]; $this->submitForm($edit, 'Save'); $new_set = $this->container->get('entity_type.manager')->getStorage('shortcut_set')->load($edit['id']); - $this->assertIdentical($new_set->id(), $edit['id'], 'Successfully created a shortcut set.'); + $this->assertIdentical($edit['id'], $new_set->id(), 'Successfully created a shortcut set.'); $this->drupalGet('user/' . $this->adminUser->id() . '/shortcuts'); // Verify that generated shortcut set was listed as a choice on the user // account page. diff --git a/core/modules/statistics/tests/src/Functional/StatisticsLoggingTest.php b/core/modules/statistics/tests/src/Functional/StatisticsLoggingTest.php index 7fec0e896b67..a37a1da4e97b 100644 --- a/core/modules/statistics/tests/src/Functional/StatisticsLoggingTest.php +++ b/core/modules/statistics/tests/src/Functional/StatisticsLoggingTest.php @@ -120,13 +120,13 @@ public function testLogging() { $this->drupalGet($path); $settings = $this->getDrupalSettings(); $this->assertSession()->responseMatches($expected_library); - $this->assertIdentical($this->node->id(), $settings['statistics']['data']['nid'], 'Found statistics settings on node page.'); + $this->assertIdentical($settings['statistics']['data']['nid'], $this->node->id(), 'Found statistics settings on node page.'); // Verify the same when loading the site in a non-default language. $this->drupalGet($this->language['langcode'] . '/' . $path); $settings = $this->getDrupalSettings(); $this->assertSession()->responseMatches($expected_library); - $this->assertIdentical($this->node->id(), $settings['statistics']['data']['nid'], 'Found statistics settings on valid node page in a non-default language.'); + $this->assertIdentical($settings['statistics']['data']['nid'], $this->node->id(), 'Found statistics settings on valid node page in a non-default language.'); // Manually call statistics.php to simulate ajax data collection behavior. global $base_root; diff --git a/core/modules/system/tests/src/Functional/Cache/AssertPageCacheContextsAndTagsTrait.php b/core/modules/system/tests/src/Functional/Cache/AssertPageCacheContextsAndTagsTrait.php index 6c70a38ae762..079c63a790d0 100644 --- a/core/modules/system/tests/src/Functional/Cache/AssertPageCacheContextsAndTagsTrait.php +++ b/core/modules/system/tests/src/Functional/Cache/AssertPageCacheContextsAndTagsTrait.php @@ -111,7 +111,7 @@ protected function assertCacheTags(array $expected_tags, $include_default_tags = $expected_tags = array_unique($expected_tags); sort($expected_tags); sort($actual_tags); - $this->assertIdentical($actual_tags, $expected_tags); + $this->assertIdentical($expected_tags, $actual_tags); } /** @@ -141,7 +141,7 @@ protected function assertCacheContexts(array $expected_contexts, $message = NULL $actual_contexts = $this->getCacheHeaderValues('X-Drupal-Cache-Contexts'); sort($expected_contexts); sort($actual_contexts); - $this->assertIdentical($actual_contexts, $expected_contexts, $message); + $this->assertIdentical($expected_contexts, $actual_contexts, $message); return $actual_contexts === $expected_contexts; } diff --git a/core/modules/system/tests/src/Functional/Form/CheckboxTest.php b/core/modules/system/tests/src/Functional/Form/CheckboxTest.php index 38585028faf6..cc6c4d5556b2 100644 --- a/core/modules/system/tests/src/Functional/Form/CheckboxTest.php +++ b/core/modules/system/tests/src/Functional/Form/CheckboxTest.php @@ -63,9 +63,9 @@ public function testFormCheckbox() { // checkboxes group that includes a 0-indexed array of options. $this->drupalPostForm('form-test/checkboxes-zero/1', [], 'Save'); $results = json_decode($this->getSession()->getPage()->getContent()); - $this->assertIdentical($results->checkbox_off, [0, 0, 0], 'All three in checkbox_off are zeroes: off.'); - $this->assertIdentical($results->checkbox_zero_default, ['0', 0, 0], 'The first choice is on in checkbox_zero_default'); - $this->assertIdentical($results->checkbox_string_zero_default, ['0', 0, 0], 'The first choice is on in checkbox_string_zero_default'); + $this->assertIdentical([0, 0, 0], $results->checkbox_off, 'All three in checkbox_off are zeroes: off.'); + $this->assertIdentical(['0', 0, 0], $results->checkbox_zero_default, 'The first choice is on in checkbox_zero_default'); + $this->assertIdentical(['0', 0, 0], $results->checkbox_string_zero_default, 'The first choice is on in checkbox_string_zero_default'); // Due to Mink driver differences, we cannot submit an empty checkbox value // to drupalPostForm(), even if that empty value is the 'true' value for // the checkbox. @@ -73,7 +73,7 @@ public function testFormCheckbox() { $this->assertSession()->fieldExists('checkbox_off[0]')->check(); $this->submitForm([], 'Save'); $results = json_decode($this->getSession()->getPage()->getContent()); - $this->assertIdentical($results->checkbox_off, ['0', 0, 0], 'The first choice is on in checkbox_off but the rest is not'); + $this->assertIdentical(['0', 0, 0], $results->checkbox_off, 'The first choice is on in checkbox_off but the rest is not'); // Ensure that each checkbox is rendered correctly for a checkboxes group // that includes a 0-indexed array of options. diff --git a/core/modules/system/tests/src/Functional/Form/ElementTest.php b/core/modules/system/tests/src/Functional/Form/ElementTest.php index 08195fd66721..18e82a4429a9 100644 --- a/core/modules/system/tests/src/Functional/Form/ElementTest.php +++ b/core/modules/system/tests/src/Functional/Form/ElementTest.php @@ -59,7 +59,7 @@ public function testOptions() { $expected_values = ['0', 'foo', '1', 'bar', '>']; foreach ($elements as $element) { $expected = array_shift($expected_values); - $this->assertIdentical((string) $element->getAttribute('value'), $expected); + $this->assertIdentical($expected, (string) $element->getAttribute('value')); } } @@ -79,7 +79,7 @@ public function testOptions() { $expected_values = ['0', 'foo', 'bar', '>', '1']; foreach ($elements as $element) { $expected = array_shift($expected_values); - $this->assertIdentical((string) $element->getAttribute('value'), $expected); + $this->assertIdentical($expected, (string) $element->getAttribute('value')); } } // Verify that custom #description properties are output. diff --git a/core/modules/system/tests/src/Functional/Form/EmailTest.php b/core/modules/system/tests/src/Functional/Form/EmailTest.php index a19e6f9ee95a..298e48fe8ddd 100644 --- a/core/modules/system/tests/src/Functional/Form/EmailTest.php +++ b/core/modules/system/tests/src/Functional/Form/EmailTest.php @@ -39,7 +39,7 @@ public function testFormEmail() { $edit['email_required'] = ' foo.bar@example.com '; $this->drupalPostForm('form-test/email', $edit, 'Submit'); $values = Json::decode($this->getSession()->getPage()->getContent()); - $this->assertIdentical($values['email'], ''); + $this->assertIdentical('', $values['email']); $this->assertEqual($values['email_required'], 'foo.bar@example.com'); $edit = []; diff --git a/core/modules/system/tests/src/Functional/Form/FormTest.php b/core/modules/system/tests/src/Functional/Form/FormTest.php index 0dabbdc09d34..10084b818309 100644 --- a/core/modules/system/tests/src/Functional/Form/FormTest.php +++ b/core/modules/system/tests/src/Functional/Form/FormTest.php @@ -472,11 +472,7 @@ public function testSelect() { 'multiple_no_default_required' => ['three' => 'three'], ]; foreach ($expected as $key => $value) { - $this->assertIdentical($values[$key], $value, new FormattableMarkup('@name: @actual is equal to @expected.', [ - '@name' => $key, - '@actual' => var_export($values[$key], TRUE), - '@expected' => var_export($value, TRUE), - ])); + $this->assertIdentical($value, $values[$key], new FormattableMarkup('@name: @actual is equal to @expected.', ['@name' => $key, '@actual' => var_export($values[$key], TRUE), '@expected' => var_export($value, TRUE)])); } } diff --git a/core/modules/system/tests/src/Functional/Form/UrlTest.php b/core/modules/system/tests/src/Functional/Form/UrlTest.php index 0e99a7255905..549019015c2e 100644 --- a/core/modules/system/tests/src/Functional/Form/UrlTest.php +++ b/core/modules/system/tests/src/Functional/Form/UrlTest.php @@ -42,7 +42,7 @@ public function testFormUrl() { $edit['url_required'] = 'http://example.com/ '; $this->drupalPostForm('form-test/url', $edit, 'Submit'); $values = Json::decode($this->getSession()->getPage()->getContent()); - $this->assertIdentical($values['url'], ''); + $this->assertIdentical('', $values['url']); $this->assertEqual($values['url_required'], 'http://example.com/'); $edit = []; diff --git a/core/modules/system/tests/src/Functional/Module/DependencyTest.php b/core/modules/system/tests/src/Functional/Module/DependencyTest.php index 47aecd30e440..b7be1d134263 100644 --- a/core/modules/system/tests/src/Functional/Module/DependencyTest.php +++ b/core/modules/system/tests/src/Functional/Module/DependencyTest.php @@ -186,7 +186,7 @@ public function testModuleEnableOrder() { // Check the actual order which is saved by module_test_modules_enabled(). $module_order = \Drupal::state()->get('module_test.install_order', []); - $this->assertIdentical($module_order, $expected_order); + $this->assertIdentical($expected_order, $module_order); } /** diff --git a/core/modules/system/tests/src/Functional/Module/InstallTest.php b/core/modules/system/tests/src/Functional/Module/InstallTest.php index 6598c524b006..839b9a52759c 100644 --- a/core/modules/system/tests/src/Functional/Module/InstallTest.php +++ b/core/modules/system/tests/src/Functional/Module/InstallTest.php @@ -32,7 +32,7 @@ class InstallTest extends BrowserTestBase { public function testGetSchemaAtInstallTime() { // @see module_test_install() $value = Database::getConnection()->select('module_test', 'mt')->fields('mt', ['data'])->execute()->fetchField(); - $this->assertIdentical($value, 'varchar'); + $this->assertIdentical('varchar', $value); } /** @@ -44,7 +44,7 @@ public function testGetSchemaAtInstallTime() { */ public function testEnableUserTwice() { \Drupal::service('module_installer')->install(['user'], FALSE); - $this->assertIdentical($this->config('core.extension')->get('module.user'), 0); + $this->assertIdentical(0, $this->config('core.extension')->get('module.user')); } /** diff --git a/core/modules/system/tests/src/Functional/Theme/TwigExtensionTest.php b/core/modules/system/tests/src/Functional/Theme/TwigExtensionTest.php index aad4b23c57fe..900005fffd23 100644 --- a/core/modules/system/tests/src/Functional/Theme/TwigExtensionTest.php +++ b/core/modules/system/tests/src/Functional/Theme/TwigExtensionTest.php @@ -76,8 +76,8 @@ public function testsRenderEscapedZeroValue() { $extension = \Drupal::service('twig.extension'); /** @var \Drupal\Core\Template\TwigEnvironment $twig */ $twig = \Drupal::service('twig'); - $this->assertIdentical($extension->escapeFilter($twig, 0), 0, 'TwigExtension::escapeFilter() returns zero correctly when provided as an integer.'); - $this->assertIdentical($extension->escapeFilter($twig, 0.0), 0, 'TwigExtension::escapeFilter() returns zero correctly when provided as a double.'); + $this->assertIdentical(0, $extension->escapeFilter($twig, 0), 'TwigExtension::escapeFilter() returns zero correctly when provided as an integer.'); + $this->assertIdentical(0, $extension->escapeFilter($twig, 0.0), 'TwigExtension::escapeFilter() returns zero correctly when provided as a double.'); } /** @@ -88,8 +88,8 @@ public function testsRenderEscapedZeroValue() { public function testsRenderZeroValue() { /** @var \Drupal\Core\Template\TwigExtension $extension */ $extension = \Drupal::service('twig.extension'); - $this->assertIdentical($extension->renderVar(0), 0, 'TwigExtension::renderVar() renders zero correctly when provided as an integer.'); - $this->assertIdentical($extension->renderVar(0.0), 0, 'TwigExtension::renderVar() renders zero correctly when provided as a double.'); + $this->assertIdentical(0, $extension->renderVar(0), 'TwigExtension::renderVar() renders zero correctly when provided as an integer.'); + $this->assertIdentical(0, $extension->renderVar(0.0), 'TwigExtension::renderVar() renders zero correctly when provided as a double.'); } } diff --git a/core/modules/system/tests/src/FunctionalJavascript/FrameworkTest.php b/core/modules/system/tests/src/FunctionalJavascript/FrameworkTest.php index 3b12707f1b14..c2bdb5decf6b 100644 --- a/core/modules/system/tests/src/FunctionalJavascript/FrameworkTest.php +++ b/core/modules/system/tests/src/FunctionalJavascript/FrameworkTest.php @@ -67,7 +67,7 @@ public function testLazyLoad() { // Verify the expected setting was added, both to drupalSettings, and as // the first AJAX command. - $this->assertIdentical($new_settings[$expected['setting_name']], $expected['setting_value'], new FormattableMarkup('Page now has the %setting.', ['%setting' => $expected['setting_name']])); + $this->assertIdentical($expected['setting_value'], $new_settings[$expected['setting_name']], new FormattableMarkup('Page now has the %setting.', ['%setting' => $expected['setting_name']])); // Verify the expected CSS file was added, both to drupalSettings, and as // the second AJAX command for inclusion into the HTML. diff --git a/core/modules/system/tests/src/Kernel/Extension/ModuleHandlerTest.php b/core/modules/system/tests/src/Kernel/Extension/ModuleHandlerTest.php index a987eb1ba27b..30dddc681871 100644 --- a/core/modules/system/tests/src/Kernel/Extension/ModuleHandlerTest.php +++ b/core/modules/system/tests/src/Kernel/Extension/ModuleHandlerTest.php @@ -149,7 +149,7 @@ public function testDependencyResolution() { // Finally, verify that the modules were enabled in the correct order. $enable_order = \Drupal::state()->get('module_test.install_order', []); - $this->assertIdentical($enable_order, ['help', 'config', 'color']); + $this->assertIdentical(['help', 'config', 'color'], $enable_order); } /** diff --git a/core/modules/system/tests/src/Kernel/Theme/ThemeTest.php b/core/modules/system/tests/src/Kernel/Theme/ThemeTest.php index 74b0e496eb9e..e9ad8d1d66da 100644 --- a/core/modules/system/tests/src/Kernel/Theme/ThemeTest.php +++ b/core/modules/system/tests/src/Kernel/Theme/ThemeTest.php @@ -63,7 +63,7 @@ public function testThemeDataTypes() { $this->assertIdentical((string) $example, $output->__toString()); } elseif (is_string($output)) { - $this->assertIdentical($output, '', 'A string will be return when the theme returns an empty string.'); + $this->assertIdentical('', $output, 'A string will be return when the theme returns an empty string.'); } } @@ -116,13 +116,13 @@ public function testListThemes() { $base_theme_list = ['test_basetheme' => 'Theme test base theme']; $sub_theme_list = ['test_subsubtheme' => 'Theme test subsubtheme', 'test_subtheme' => 'Theme test subtheme']; - $this->assertIdentical($themes['test_basetheme']->sub_themes, $sub_theme_list, 'Base theme\'s object includes list of subthemes.'); - $this->assertIdentical($themes['test_subtheme']->base_themes, $base_theme_list, 'Subtheme\'s object includes list of base themes.'); + $this->assertIdentical($sub_theme_list, $themes['test_basetheme']->sub_themes, 'Base theme\'s object includes list of subthemes.'); + $this->assertIdentical($base_theme_list, $themes['test_subtheme']->base_themes, 'Subtheme\'s object includes list of base themes.'); // Check for theme engine in subtheme. - $this->assertIdentical($themes['test_subtheme']->engine, 'twig', 'Subtheme\'s object includes the theme engine.'); + $this->assertIdentical('twig', $themes['test_subtheme']->engine, 'Subtheme\'s object includes the theme engine.'); // Check for theme engine prefix. - $this->assertIdentical($themes['test_basetheme']->prefix, 'twig', 'Base theme\'s object includes the theme engine prefix.'); - $this->assertIdentical($themes['test_subtheme']->prefix, 'twig', 'Subtheme\'s object includes the theme engine prefix.'); + $this->assertIdentical('twig', $themes['test_basetheme']->prefix, 'Base theme\'s object includes the theme engine prefix.'); + $this->assertIdentical('twig', $themes['test_subtheme']->prefix, 'Subtheme\'s object includes the theme engine prefix.'); } /** diff --git a/core/modules/taxonomy/tests/src/Functional/TermTest.php b/core/modules/taxonomy/tests/src/Functional/TermTest.php index 5c3a70ba7369..0244c30d9f56 100644 --- a/core/modules/taxonomy/tests/src/Functional/TermTest.php +++ b/core/modules/taxonomy/tests/src/Functional/TermTest.php @@ -606,16 +606,16 @@ public function testTermBreadcrumbs() { $this->drupalGet('taxonomy/term/' . $term->id() . '/edit'); $breadcrumbs = $this->getSession()->getPage()->findAll('css', 'nav.breadcrumb ol li a'); $this->assertCount(2, $breadcrumbs, 'The breadcrumbs are present on the page.'); - $this->assertIdentical($breadcrumbs[0]->getText(), 'Home', 'First breadcrumb text is Home'); - $this->assertIdentical($breadcrumbs[1]->getText(), $term->label(), 'Second breadcrumb text is term name on term edit page.'); + $this->assertIdentical('Home', $breadcrumbs[0]->getText(), 'First breadcrumb text is Home'); + $this->assertIdentical($term->label(), $breadcrumbs[1]->getText(), 'Second breadcrumb text is term name on term edit page.'); $this->assertSession()->assertEscaped($breadcrumbs[1]->getText()); // Check the breadcrumb on the term delete page. $this->drupalGet('taxonomy/term/' . $term->id() . '/delete'); $breadcrumbs = $this->getSession()->getPage()->findAll('css', 'nav.breadcrumb ol li a'); $this->assertCount(2, $breadcrumbs, 'The breadcrumbs are present on the page.'); - $this->assertIdentical($breadcrumbs[0]->getText(), 'Home', 'First breadcrumb text is Home'); - $this->assertIdentical($breadcrumbs[1]->getText(), $term->label(), 'Second breadcrumb text is term name on term delete page.'); + $this->assertIdentical('Home', $breadcrumbs[0]->getText(), 'First breadcrumb text is Home'); + $this->assertIdentical($term->label(), $breadcrumbs[1]->getText(), 'Second breadcrumb text is term name on term delete page.'); $this->assertSession()->assertEscaped($breadcrumbs[1]->getText()); } diff --git a/core/modules/taxonomy/tests/src/Kernel/TermEntityReferenceTest.php b/core/modules/taxonomy/tests/src/Kernel/TermEntityReferenceTest.php index 00e21a15d966..23d841867bb0 100644 --- a/core/modules/taxonomy/tests/src/Kernel/TermEntityReferenceTest.php +++ b/core/modules/taxonomy/tests/src/Kernel/TermEntityReferenceTest.php @@ -107,7 +107,7 @@ public function testSelectionTestVocabularyRestriction() { ], ]; - $this->assertIdentical($result, $expected_result, 'Terms selection restricted to a single vocabulary.'); + $this->assertIdentical($expected_result, $result, 'Terms selection restricted to a single vocabulary.'); } } diff --git a/core/modules/text/tests/src/Kernel/TextSummaryTest.php b/core/modules/text/tests/src/Kernel/TextSummaryTest.php index b7f975fda842..e2c9165ca03c 100644 --- a/core/modules/text/tests/src/Kernel/TextSummaryTest.php +++ b/core/modules/text/tests/src/Kernel/TextSummaryTest.php @@ -238,10 +238,7 @@ public function testInvalidFilterFormat() { */ public function assertTextSummary($text, $expected, $format = NULL, $size = NULL) { $summary = text_summary($text, $format, $size); - $this->assertIdentical($summary, $expected, new FormattableMarkup('<pre style="white-space: pre-wrap">@actual</pre> is identical to <pre style="white-space: pre-wrap">@expected</pre>', [ - '@actual' => $summary, - '@expected' => $expected, - ])); + $this->assertIdentical($expected, $summary, new FormattableMarkup('<pre style="white-space: pre-wrap">@actual</pre> is identical to <pre style="white-space: pre-wrap">@expected</pre>', ['@actual' => $summary, '@expected' => $expected])); } /** diff --git a/core/modules/user/tests/src/Functional/UserLoginTest.php b/core/modules/user/tests/src/Functional/UserLoginTest.php index bbd0e436737f..faa9174df391 100644 --- a/core/modules/user/tests/src/Functional/UserLoginTest.php +++ b/core/modules/user/tests/src/Functional/UserLoginTest.php @@ -134,7 +134,7 @@ public function testPasswordRehashOnLogin() { // Load the stored user. The password hash should reflect $default_count_log2. $user_storage = $this->container->get('entity_type.manager')->getStorage('user'); $account = User::load($account->id()); - $this->assertIdentical($password_hasher->getCountLog2($account->getPassword()), $default_count_log2); + $this->assertIdentical($default_count_log2, $password_hasher->getCountLog2($account->getPassword())); // Change the required number of iterations by loading a test-module // containing the necessary container builder code and then verify that the @@ -148,7 +148,7 @@ public function testPasswordRehashOnLogin() { // Load the stored user, which should have a different password hash now. $user_storage->resetCache([$account->id()]); $account = $user_storage->load($account->id()); - $this->assertIdentical($password_hasher->getCountLog2($account->getPassword()), $overridden_count_log2); + $this->assertIdentical($overridden_count_log2, $password_hasher->getCountLog2($account->getPassword())); $this->assertTrue($password_hasher->check($password, $account->getPassword())); } diff --git a/core/modules/user/tests/src/Functional/UserRoleAdminTest.php b/core/modules/user/tests/src/Functional/UserRoleAdminTest.php index 84b5e28fcbb3..ad64a767e92e 100644 --- a/core/modules/user/tests/src/Functional/UserRoleAdminTest.php +++ b/core/modules/user/tests/src/Functional/UserRoleAdminTest.php @@ -133,7 +133,7 @@ public function testRoleWeightOrdering() { $rids[] = $role->id(); } // The order of the roles should be reversed. - $this->assertIdentical($rids, array_reverse($saved_rids)); + $this->assertIdentical(array_reverse($saved_rids), $rids); } } diff --git a/core/modules/user/tests/src/Kernel/Migrate/MigrateUserAdminPassTest.php b/core/modules/user/tests/src/Kernel/Migrate/MigrateUserAdminPassTest.php index 030e266c9638..4f9d21b0c664 100644 --- a/core/modules/user/tests/src/Kernel/Migrate/MigrateUserAdminPassTest.php +++ b/core/modules/user/tests/src/Kernel/Migrate/MigrateUserAdminPassTest.php @@ -94,15 +94,15 @@ public function testAdminPasswordPreserved() { // Verify that admin username and email were changed, but password was not. /** @var \Drupal\user\Entity\User $admin_account */ $admin_account = User::load(1); - $this->assertIdentical($admin_account->getAccountName(), 'site_admin'); - $this->assertIdentical($admin_account->getEmail(), 'site_admin@example.com'); - $this->assertIdentical($admin_account->getPassword(), $this->originalPasswords[1]); + $this->assertIdentical('site_admin', $admin_account->getAccountName()); + $this->assertIdentical('site_admin@example.com', $admin_account->getEmail()); + $this->assertIdentical($this->originalPasswords[1], $admin_account->getPassword()); // Verify that everything changed for the regular user. /** @var \Drupal\user\Entity\User $user_account */ $user_account = User::load(2); - $this->assertIdentical($user_account->getAccountName(), 'random_user'); - $this->assertIdentical($user_account->getEmail(), 'random_user@example.com'); + $this->assertIdentical('random_user', $user_account->getAccountName()); + $this->assertIdentical('random_user@example.com', $user_account->getEmail()); $this->assertNotSame($this->originalPasswords[2], $user_account->getPassword()); } diff --git a/core/modules/user/tests/src/Kernel/UserAccountFormFieldsTest.php b/core/modules/user/tests/src/Kernel/UserAccountFormFieldsTest.php index 47d0a92f170f..f8fd82eca2f1 100644 --- a/core/modules/user/tests/src/Kernel/UserAccountFormFieldsTest.php +++ b/core/modules/user/tests/src/Kernel/UserAccountFormFieldsTest.php @@ -80,7 +80,7 @@ public function testUserEditForm() { // Verify that autocomplete is off on all account fields. foreach (['mail', 'name', 'pass'] as $key) { - $this->assertIdentical($form['account'][$key]['#attributes']['autocomplete'], 'off', "'$key' field: 'autocomplete' attribute is 'off'."); + $this->assertIdentical('off', $form['account'][$key]['#attributes']['autocomplete'], "'{$key}' field: 'autocomplete' attribute is 'off'."); } } diff --git a/core/modules/user/tests/src/Traits/UserCreationTrait.php b/core/modules/user/tests/src/Traits/UserCreationTrait.php index 034fc2ef800e..2625e230b716 100644 --- a/core/modules/user/tests/src/Traits/UserCreationTrait.php +++ b/core/modules/user/tests/src/Traits/UserCreationTrait.php @@ -272,10 +272,7 @@ protected function createRole(array $permissions, $rid = NULL, $name = NULL, $we } $result = $role->save(); - $this->assertIdentical($result, SAVED_NEW, new FormattableMarkup('Created role ID @rid with name @name.', [ - '@name' => var_export($role->label(), TRUE), - '@rid' => var_export($role->id(), TRUE), - ]), 'Role'); + $this->assertIdentical(SAVED_NEW, $result, new FormattableMarkup('Created role ID @rid with name @name.', ['@name' => var_export($role->label(), TRUE), '@rid' => var_export($role->id(), TRUE)]), 'Role'); if ($result === SAVED_NEW) { // Grant the specified permissions to the role, if any. diff --git a/core/modules/views/tests/src/Functional/Plugin/DisplayTest.php b/core/modules/views/tests/src/Functional/Plugin/DisplayTest.php index 0fe5c12212e5..cb4c0d6164bf 100644 --- a/core/modules/views/tests/src/Functional/Plugin/DisplayTest.php +++ b/core/modules/views/tests/src/Functional/Plugin/DisplayTest.php @@ -97,7 +97,7 @@ public function testDisplayPlugin() { $this->assertInstanceOf(DisplayTestPlugin::class, $view->display_handler); // Check the test option. - $this->assertIdentical($view->display_handler->getOption('test_option'), ''); + $this->assertIdentical('', $view->display_handler->getOption('test_option')); $style = $view->display_handler->getOption('style'); $style['type'] = 'test_style'; diff --git a/core/modules/views/tests/src/Functional/Plugin/FilterTest.php b/core/modules/views/tests/src/Functional/Plugin/FilterTest.php index 4e99847bb529..c9e848212710 100644 --- a/core/modules/views/tests/src/Functional/Plugin/FilterTest.php +++ b/core/modules/views/tests/src/Functional/Plugin/FilterTest.php @@ -85,15 +85,15 @@ public function testFilterQuery() { // Check the data added. $where = $view->query->where; - $this->assertIdentical($where[0]['conditions'][0]['field'], 'views_test_data.name', 'Where condition field matches'); - $this->assertIdentical($where[0]['conditions'][0]['value'], 'John', 'Where condition value matches'); - $this->assertIdentical($where[0]['conditions'][0]['operator'], '=', 'Where condition operator matches'); + $this->assertIdentical('views_test_data.name', $where[0]['conditions'][0]['field'], 'Where condition field matches'); + $this->assertIdentical('John', $where[0]['conditions'][0]['value'], 'Where condition value matches'); + $this->assertIdentical('=', $where[0]['conditions'][0]['operator'], 'Where condition operator matches'); $this->executeView($view); // Check that our operator and value match on the filter. - $this->assertIdentical($view->filter['test_filter']->operator, '='); - $this->assertIdentical($view->filter['test_filter']->value, 'John'); + $this->assertIdentical('=', $view->filter['test_filter']->operator); + $this->assertIdentical('John', $view->filter['test_filter']->value); // Check that we have a single element, as a result of applying the '= John' // filter. @@ -118,8 +118,8 @@ public function testFilterQuery() { $this->executeView($view); // Check that our operator and value match on the filter. - $this->assertIdentical($view->filter['test_filter']->operator, '<>'); - $this->assertIdentical($view->filter['test_filter']->value, 'John'); + $this->assertIdentical('<>', $view->filter['test_filter']->operator); + $this->assertIdentical('John', $view->filter['test_filter']->value); // Check if we have the other elements in the dataset, as a result of // applying the '<> John' filter. diff --git a/core/modules/views/tests/src/Functional/Plugin/MiniPagerTest.php b/core/modules/views/tests/src/Functional/Plugin/MiniPagerTest.php index 9458f3bb0ea9..284d2e51beee 100644 --- a/core/modules/views/tests/src/Functional/Plugin/MiniPagerTest.php +++ b/core/modules/views/tests/src/Functional/Plugin/MiniPagerTest.php @@ -133,7 +133,7 @@ public function testMiniPagerRender() { $view = Views::getView('test_mini_pager'); $this->executeView($view); $this->assertNull($view->get_total_rows, 'The query was not forced to calculate the total number of results.'); - $this->assertIdentical($view->total_rows, 1, 'The pager calculated the total number of rows.'); + $this->assertIdentical(1, $view->total_rows, 'The pager calculated the total number of rows.'); // Remove the last node as well and ensure that no "Page 1" is shown. $this->nodes[19]->delete(); diff --git a/core/modules/views/tests/src/Kernel/Handler/FieldKernelTest.php b/core/modules/views/tests/src/Kernel/Handler/FieldKernelTest.php index 702dcf83b358..98362c29a918 100644 --- a/core/modules/views/tests/src/Kernel/Handler/FieldKernelTest.php +++ b/core/modules/views/tests/src/Kernel/Handler/FieldKernelTest.php @@ -447,28 +447,28 @@ public function _testHideIfEmpty() { $render = $renderer->executeInRenderContext(new RenderContext(), function () use ($view) { return $view->field['name']->advancedRender($view->result[0]); }); - $this->assertIdentical((string) $render, $random_name, 'By default, a string should not be treated as empty.'); + $this->assertIdentical($random_name, (string) $render, 'By default, a string should not be treated as empty.'); // Test an empty string. $view->result[0]->{$column_map_reversed['name']} = ""; $render = $renderer->executeInRenderContext(new RenderContext(), function () use ($view) { return $view->field['name']->advancedRender($view->result[0]); }); - $this->assertIdentical($render, "", 'By default, "" should not be treated as empty.'); + $this->assertIdentical("", $render, 'By default, "" should not be treated as empty.'); // Test zero as an integer. $view->result[0]->{$column_map_reversed['name']} = 0; $render = $renderer->executeInRenderContext(new RenderContext(), function () use ($view) { return $view->field['name']->advancedRender($view->result[0]); }); - $this->assertIdentical((string) $render, '0', 'By default, 0 should not be treated as empty.'); + $this->assertIdentical('0', (string) $render, 'By default, 0 should not be treated as empty.'); // Test zero as a string. $view->result[0]->{$column_map_reversed['name']} = "0"; $render = $renderer->executeInRenderContext(new RenderContext(), function () use ($view) { return $view->field['name']->advancedRender($view->result[0]); }); - $this->assertIdentical((string) $render, "0", 'By default, "0" should not be treated as empty.'); + $this->assertIdentical("0", (string) $render, 'By default, "0" should not be treated as empty.'); // Test when results are not rewritten and non-zero empty values are hidden. $view->field['name']->options['hide_alter_empty'] = TRUE; @@ -480,28 +480,28 @@ public function _testHideIfEmpty() { $render = $renderer->executeInRenderContext(new RenderContext(), function () use ($view) { return $view->field['name']->advancedRender($view->result[0]); }); - $this->assertIdentical((string) $render, $random_name, 'If hide_empty is checked, a string should not be treated as empty.'); + $this->assertIdentical($random_name, (string) $render, 'If hide_empty is checked, a string should not be treated as empty.'); // Test an empty string. $view->result[0]->{$column_map_reversed['name']} = ""; $render = $renderer->executeInRenderContext(new RenderContext(), function () use ($view) { return $view->field['name']->advancedRender($view->result[0]); }); - $this->assertIdentical($render, "", 'If hide_empty is checked, "" should be treated as empty.'); + $this->assertIdentical("", $render, 'If hide_empty is checked, "" should be treated as empty.'); // Test zero as an integer. $view->result[0]->{$column_map_reversed['name']} = 0; $render = $renderer->executeInRenderContext(new RenderContext(), function () use ($view) { return $view->field['name']->advancedRender($view->result[0]); }); - $this->assertIdentical((string) $render, '0', 'If hide_empty is checked, but not empty_zero, 0 should not be treated as empty.'); + $this->assertIdentical('0', (string) $render, 'If hide_empty is checked, but not empty_zero, 0 should not be treated as empty.'); // Test zero as a string. $view->result[0]->{$column_map_reversed['name']} = "0"; $render = $renderer->executeInRenderContext(new RenderContext(), function () use ($view) { return $view->field['name']->advancedRender($view->result[0]); }); - $this->assertIdentical((string) $render, "0", 'If hide_empty is checked, but not empty_zero, "0" should not be treated as empty.'); + $this->assertIdentical("0", (string) $render, 'If hide_empty is checked, but not empty_zero, "0" should not be treated as empty.'); // Test when results are not rewritten and all empty values are hidden. $view->field['name']->options['hide_alter_empty'] = TRUE; @@ -513,14 +513,14 @@ public function _testHideIfEmpty() { $render = $renderer->executeInRenderContext(new RenderContext(), function () use ($view) { return $view->field['name']->advancedRender($view->result[0]); }); - $this->assertIdentical($render, "", 'If hide_empty and empty_zero are checked, 0 should be treated as empty.'); + $this->assertIdentical("", $render, 'If hide_empty and empty_zero are checked, 0 should be treated as empty.'); // Test zero as a string. $view->result[0]->{$column_map_reversed['name']} = "0"; $render = $renderer->executeInRenderContext(new RenderContext(), function () use ($view) { return $view->field['name']->advancedRender($view->result[0]); }); - $this->assertIdentical($render, "", 'If hide_empty and empty_zero are checked, "0" should be treated as empty.'); + $this->assertIdentical("", $render, 'If hide_empty and empty_zero are checked, "0" should be treated as empty.'); // Test when results are rewritten to a valid string and non-zero empty // results are hidden. @@ -535,28 +535,28 @@ public function _testHideIfEmpty() { $render = $renderer->executeInRenderContext(new RenderContext(), function () use ($view) { return $view->field['name']->advancedRender($view->result[0]); }); - $this->assertIdentical((string) $render, $random_name, 'If the rewritten string is not empty, it should not be treated as empty.'); + $this->assertIdentical($random_name, (string) $render, 'If the rewritten string is not empty, it should not be treated as empty.'); // Test an empty string. $view->result[0]->{$column_map_reversed['name']} = ""; $render = $renderer->executeInRenderContext(new RenderContext(), function () use ($view) { return $view->field['name']->advancedRender($view->result[0]); }); - $this->assertIdentical((string) $render, $random_name, 'If the rewritten string is not empty, "" should not be treated as empty.'); + $this->assertIdentical($random_name, (string) $render, 'If the rewritten string is not empty, "" should not be treated as empty.'); // Test zero as an integer. $view->result[0]->{$column_map_reversed['name']} = 0; $render = $renderer->executeInRenderContext(new RenderContext(), function () use ($view) { return $view->field['name']->advancedRender($view->result[0]); }); - $this->assertIdentical((string) $render, $random_name, 'If the rewritten string is not empty, 0 should not be treated as empty.'); + $this->assertIdentical($random_name, (string) $render, 'If the rewritten string is not empty, 0 should not be treated as empty.'); // Test zero as a string. $view->result[0]->{$column_map_reversed['name']} = "0"; $render = $renderer->executeInRenderContext(new RenderContext(), function () use ($view) { return $view->field['name']->advancedRender($view->result[0]); }); - $this->assertIdentical((string) $render, $random_name, 'If the rewritten string is not empty, "0" should not be treated as empty.'); + $this->assertIdentical($random_name, (string) $render, 'If the rewritten string is not empty, "0" should not be treated as empty.'); // Test when results are rewritten to an empty string and non-zero empty results are hidden. $view->field['name']->options['hide_alter_empty'] = TRUE; @@ -570,28 +570,28 @@ public function _testHideIfEmpty() { $render = $renderer->executeInRenderContext(new RenderContext(), function () use ($view) { return $view->field['name']->advancedRender($view->result[0]); }); - $this->assertIdentical((string) $render, $random_name, 'If the rewritten string is empty, it should not be treated as empty.'); + $this->assertIdentical($random_name, (string) $render, 'If the rewritten string is empty, it should not be treated as empty.'); // Test an empty string. $view->result[0]->{$column_map_reversed['name']} = ""; $render = $renderer->executeInRenderContext(new RenderContext(), function () use ($view) { return $view->field['name']->advancedRender($view->result[0]); }); - $this->assertIdentical($render, "", 'If the rewritten string is empty, "" should be treated as empty.'); + $this->assertIdentical("", $render, 'If the rewritten string is empty, "" should be treated as empty.'); // Test zero as an integer. $view->result[0]->{$column_map_reversed['name']} = 0; $render = $renderer->executeInRenderContext(new RenderContext(), function () use ($view) { return $view->field['name']->advancedRender($view->result[0]); }); - $this->assertIdentical((string) $render, '0', 'If the rewritten string is empty, 0 should not be treated as empty.'); + $this->assertIdentical('0', (string) $render, 'If the rewritten string is empty, 0 should not be treated as empty.'); // Test zero as a string. $view->result[0]->{$column_map_reversed['name']} = "0"; $render = $renderer->executeInRenderContext(new RenderContext(), function () use ($view) { return $view->field['name']->advancedRender($view->result[0]); }); - $this->assertIdentical((string) $render, "0", 'If the rewritten string is empty, "0" should not be treated as empty.'); + $this->assertIdentical("0", (string) $render, 'If the rewritten string is empty, "0" should not be treated as empty.'); // Test when results are rewritten to zero as a string and non-zero empty // results are hidden. @@ -606,28 +606,28 @@ public function _testHideIfEmpty() { $render = $renderer->executeInRenderContext(new RenderContext(), function () use ($view) { return $view->field['name']->advancedRender($view->result[0]); }); - $this->assertIdentical((string) $render, "0", 'If the rewritten string is zero and empty_zero is not checked, the string rewritten as 0 should not be treated as empty.'); + $this->assertIdentical("0", (string) $render, 'If the rewritten string is zero and empty_zero is not checked, the string rewritten as 0 should not be treated as empty.'); // Test an empty string. $view->result[0]->{$column_map_reversed['name']} = ""; $render = $renderer->executeInRenderContext(new RenderContext(), function () use ($view) { return $view->field['name']->advancedRender($view->result[0]); }); - $this->assertIdentical((string) $render, "0", 'If the rewritten string is zero and empty_zero is not checked, "" rewritten as 0 should not be treated as empty.'); + $this->assertIdentical("0", (string) $render, 'If the rewritten string is zero and empty_zero is not checked, "" rewritten as 0 should not be treated as empty.'); // Test zero as an integer. $view->result[0]->{$column_map_reversed['name']} = 0; $render = $renderer->executeInRenderContext(new RenderContext(), function () use ($view) { return $view->field['name']->advancedRender($view->result[0]); }); - $this->assertIdentical((string) $render, "0", 'If the rewritten string is zero and empty_zero is not checked, 0 should not be treated as empty.'); + $this->assertIdentical("0", (string) $render, 'If the rewritten string is zero and empty_zero is not checked, 0 should not be treated as empty.'); // Test zero as a string. $view->result[0]->{$column_map_reversed['name']} = "0"; $render = $renderer->executeInRenderContext(new RenderContext(), function () use ($view) { return $view->field['name']->advancedRender($view->result[0]); }); - $this->assertIdentical((string) $render, "0", 'If the rewritten string is zero and empty_zero is not checked, "0" should not be treated as empty.'); + $this->assertIdentical("0", (string) $render, 'If the rewritten string is zero and empty_zero is not checked, "0" should not be treated as empty.'); // Test when results are rewritten to a valid string and non-zero empty // results are hidden. @@ -642,28 +642,28 @@ public function _testHideIfEmpty() { $render = $renderer->executeInRenderContext(new RenderContext(), function () use ($view) { return $view->field['name']->advancedRender($view->result[0]); }); - $this->assertIdentical((string) $render, $random_value, 'If the original and rewritten strings are valid, it should not be treated as empty.'); + $this->assertIdentical($random_value, (string) $render, 'If the original and rewritten strings are valid, it should not be treated as empty.'); // Test an empty string. $view->result[0]->{$column_map_reversed['name']} = ""; $render = $renderer->executeInRenderContext(new RenderContext(), function () use ($view) { return $view->field['name']->advancedRender($view->result[0]); }); - $this->assertIdentical($render, "", 'If either the original or rewritten string is invalid, "" should be treated as empty.'); + $this->assertIdentical("", $render, 'If either the original or rewritten string is invalid, "" should be treated as empty.'); // Test zero as an integer. $view->result[0]->{$column_map_reversed['name']} = 0; $render = $renderer->executeInRenderContext(new RenderContext(), function () use ($view) { return $view->field['name']->advancedRender($view->result[0]); }); - $this->assertIdentical((string) $render, $random_value, 'If the original and rewritten strings are valid, 0 should not be treated as empty.'); + $this->assertIdentical($random_value, (string) $render, 'If the original and rewritten strings are valid, 0 should not be treated as empty.'); // Test zero as a string. $view->result[0]->{$column_map_reversed['name']} = "0"; $render = $renderer->executeInRenderContext(new RenderContext(), function () use ($view) { return $view->field['name']->advancedRender($view->result[0]); }); - $this->assertIdentical((string) $render, $random_value, 'If the original and rewritten strings are valid, "0" should not be treated as empty.'); + $this->assertIdentical($random_value, (string) $render, 'If the original and rewritten strings are valid, "0" should not be treated as empty.'); // Test when results are rewritten to zero as a string and all empty // original values and results are hidden. @@ -678,28 +678,28 @@ public function _testHideIfEmpty() { $render = $renderer->executeInRenderContext(new RenderContext(), function () use ($view) { return $view->field['name']->advancedRender($view->result[0]); }); - $this->assertIdentical((string) $render, "", 'If the rewritten string is zero, it should be treated as empty.'); + $this->assertIdentical("", (string) $render, 'If the rewritten string is zero, it should be treated as empty.'); // Test an empty string. $view->result[0]->{$column_map_reversed['name']} = ""; $render = $renderer->executeInRenderContext(new RenderContext(), function () use ($view) { return $view->field['name']->advancedRender($view->result[0]); }); - $this->assertIdentical($render, "", 'If the rewritten string is zero, "" should be treated as empty.'); + $this->assertIdentical("", $render, 'If the rewritten string is zero, "" should be treated as empty.'); // Test zero as an integer. $view->result[0]->{$column_map_reversed['name']} = 0; $render = $renderer->executeInRenderContext(new RenderContext(), function () use ($view) { return $view->field['name']->advancedRender($view->result[0]); }); - $this->assertIdentical($render, "", 'If the rewritten string is zero, 0 should not be treated as empty.'); + $this->assertIdentical("", $render, 'If the rewritten string is zero, 0 should not be treated as empty.'); // Test zero as a string. $view->result[0]->{$column_map_reversed['name']} = "0"; $render = $renderer->executeInRenderContext(new RenderContext(), function () use ($view) { return $view->field['name']->advancedRender($view->result[0]); }); - $this->assertIdentical($render, "", 'If the rewritten string is zero, "0" should not be treated as empty.'); + $this->assertIdentical("", $render, 'If the rewritten string is zero, "0" should not be treated as empty.'); } /** @@ -721,20 +721,20 @@ public function _testEmptyText() { $render = $renderer->executeInRenderContext(new RenderContext(), function () use ($view) { return $view->field['name']->advancedRender($view->result[0]); }); - $this->assertIdentical((string) $render, $empty_text, 'If a field is empty, the empty text should be used for the output.'); + $this->assertIdentical($empty_text, (string) $render, 'If a field is empty, the empty text should be used for the output.'); $view->result[0]->{$column_map_reversed['name']} = "0"; $render = $renderer->executeInRenderContext(new RenderContext(), function () use ($view) { return $view->field['name']->advancedRender($view->result[0]); }); - $this->assertIdentical((string) $render, "0", 'If a field is 0 and empty_zero is not checked, the empty text should not be used for the output.'); + $this->assertIdentical("0", (string) $render, 'If a field is 0 and empty_zero is not checked, the empty text should not be used for the output.'); $view->result[0]->{$column_map_reversed['name']} = "0"; $view->field['name']->options['empty_zero'] = TRUE; $render = $renderer->executeInRenderContext(new RenderContext(), function () use ($view) { return $view->field['name']->advancedRender($view->result[0]); }); - $this->assertIdentical((string) $render, $empty_text, 'If a field is 0 and empty_zero is checked, the empty text should be used for the output.'); + $this->assertIdentical($empty_text, (string) $render, 'If a field is 0 and empty_zero is checked, the empty text should be used for the output.'); $view->result[0]->{$column_map_reversed['name']} = ""; $view->field['name']->options['alter']['alter_text'] = TRUE; @@ -743,13 +743,13 @@ public function _testEmptyText() { $render = $renderer->executeInRenderContext(new RenderContext(), function () use ($view) { return $view->field['name']->advancedRender($view->result[0]); }); - $this->assertIdentical((string) $render, $alter_text, 'If a field is empty, some rewrite text exists, but hide_alter_empty is not checked, render the rewrite text.'); + $this->assertIdentical($alter_text, (string) $render, 'If a field is empty, some rewrite text exists, but hide_alter_empty is not checked, render the rewrite text.'); $view->field['name']->options['hide_alter_empty'] = TRUE; $render = $renderer->executeInRenderContext(new RenderContext(), function () use ($view) { return $view->field['name']->advancedRender($view->result[0]); }); - $this->assertIdentical((string) $render, $empty_text, 'If a field is empty, some rewrite text exists, and hide_alter_empty is checked, use the empty text.'); + $this->assertIdentical($empty_text, (string) $render, 'If a field is empty, some rewrite text exists, and hide_alter_empty is checked, use the empty text.'); } /** diff --git a/core/modules/views/tests/src/Kernel/Handler/HandlerAliasTest.php b/core/modules/views/tests/src/Kernel/Handler/HandlerAliasTest.php index ad6ea6060d29..2e11af154609 100644 --- a/core/modules/views/tests/src/Kernel/Handler/HandlerAliasTest.php +++ b/core/modules/views/tests/src/Kernel/Handler/HandlerAliasTest.php @@ -61,11 +61,11 @@ public function testPluginAliases() { $filter = $view->filter['test_filter']; // Check the definition values are present. - $this->assertIdentical($filter->definition['real table'], 'views_test_data'); - $this->assertIdentical($filter->definition['real field'], 'name'); + $this->assertIdentical('views_test_data', $filter->definition['real table']); + $this->assertIdentical('name', $filter->definition['real field']); - $this->assertIdentical($filter->table, 'views_test_data'); - $this->assertIdentical($filter->realField, 'name'); + $this->assertIdentical('views_test_data', $filter->table); + $this->assertIdentical('name', $filter->realField); // Test an existing user uid field. $view = Views::getView('test_alias'); @@ -74,11 +74,11 @@ public function testPluginAliases() { $filter = $view->filter['uid_raw']; - $this->assertIdentical($filter->definition['real field'], 'uid'); + $this->assertIdentical('uid', $filter->definition['real field']); - $this->assertIdentical($filter->field, 'uid_raw'); - $this->assertIdentical($filter->table, 'users_field_data'); - $this->assertIdentical($filter->realField, 'uid'); + $this->assertIdentical('uid_raw', $filter->field); + $this->assertIdentical('users_field_data', $filter->table); + $this->assertIdentical('uid', $filter->realField); } } diff --git a/core/modules/views/tests/src/Kernel/ModuleTest.php b/core/modules/views/tests/src/Kernel/ModuleTest.php index e0c4d7fb863a..267b6a6f8334 100644 --- a/core/modules/views/tests/src/Kernel/ModuleTest.php +++ b/core/modules/views/tests/src/Kernel/ModuleTest.php @@ -210,16 +210,16 @@ public function testViewsFetchPluginNames() { $expected[$id] = $definition['title']; } asort($expected); - $this->assertIdentical(array_keys($plugins), array_keys($expected)); + $this->assertIdentical(array_keys($expected), array_keys($plugins)); // Test using the 'test' style plugin type only returns the test_style and // mapping_test plugins. $plugins = Views::fetchPluginNames('style', 'test'); - $this->assertIdentical(array_keys($plugins), ['mapping_test', 'test_style', 'test_template_style']); + $this->assertIdentical(['mapping_test', 'test_style', 'test_template_style'], array_keys($plugins)); // Test a non existent style plugin type returns no plugins. $plugins = Views::fetchPluginNames('style', $this->randomString()); - $this->assertIdentical($plugins, []); + $this->assertIdentical([], $plugins); } /** diff --git a/core/modules/views/tests/src/Kernel/Plugin/CacheTest.php b/core/modules/views/tests/src/Kernel/Plugin/CacheTest.php index 3daf154310c8..ad9bbf8c97c7 100644 --- a/core/modules/views/tests/src/Kernel/Plugin/CacheTest.php +++ b/core/modules/views/tests/src/Kernel/Plugin/CacheTest.php @@ -347,7 +347,7 @@ public function testCacheData() { // items. foreach ($cache->data['result'] as $row) { $this->assertNull($row->_entity, 'Cached row "_entity" property is NULL'); - $this->assertIdentical($row->_relationship_entities, [], 'Cached row "_relationship_entities" property is empty'); + $this->assertIdentical([], $row->_relationship_entities, 'Cached row "_relationship_entities" property is empty'); } } diff --git a/core/modules/views/tests/src/Kernel/Plugin/PluginBaseTest.php b/core/modules/views/tests/src/Kernel/Plugin/PluginBaseTest.php index 1236ea3adc8d..cde8851f74fe 100644 --- a/core/modules/views/tests/src/Kernel/Plugin/PluginBaseTest.php +++ b/core/modules/views/tests/src/Kernel/Plugin/PluginBaseTest.php @@ -40,7 +40,7 @@ public function testViewsTokenReplace() { return $this->testPluginBase->viewsTokenReplace($text, $tokens); }); - $this->assertIdentical($result, 'en means English'); + $this->assertIdentical('en means English', $result); } /** @@ -54,7 +54,7 @@ public function testViewsTokenReplaceWithDots() { return $this->testPluginBase->viewsTokenReplace($text, $tokens); }); - $this->assertIdentical($result, 'first comes before second'); + $this->assertIdentical('first comes before second', $result); // Test tokens with numeric indexes. $text = '{{ argument.0.first }} comes before {{ argument.1.second }}'; @@ -64,7 +64,7 @@ public function testViewsTokenReplaceWithDots() { return $this->testPluginBase->viewsTokenReplace($text, $tokens); }); - $this->assertIdentical($result, 'first comes before second'); + $this->assertIdentical('first comes before second', $result); } /** @@ -74,7 +74,7 @@ public function testViewsTokenReplaceWithTwigTokens() { $text = 'Just some text'; $tokens = []; $result = $this->testPluginBase->viewsTokenReplace($text, $tokens); - $this->assertIdentical($result, 'Just some text'); + $this->assertIdentical('Just some text', $result); } } diff --git a/core/modules/views/tests/src/Kernel/Plugin/SqlQueryTest.php b/core/modules/views/tests/src/Kernel/Plugin/SqlQueryTest.php index ee59e157320f..f745b9faff6f 100644 --- a/core/modules/views/tests/src/Kernel/Plugin/SqlQueryTest.php +++ b/core/modules/views/tests/src/Kernel/Plugin/SqlQueryTest.php @@ -51,8 +51,8 @@ public function testExecuteMetadata() { $this->assertTrue($query->hasTag('test_tag')); // Check metadata. - $this->assertIdentical($query->getMetaData('key1'), 'test_metadata'); - $this->assertIdentical($query->getMetaData('key2'), 'test_metadata2'); + $this->assertIdentical('test_metadata', $query->getMetaData('key1')); + $this->assertIdentical('test_metadata2', $query->getMetaData('key2')); } $query_options = $view->display_handler->getOption('query'); diff --git a/core/modules/views/tests/src/Kernel/Plugin/StyleTableUnitTest.php b/core/modules/views/tests/src/Kernel/Plugin/StyleTableUnitTest.php index b86d16a034d8..c5e7846b0ee6 100644 --- a/core/modules/views/tests/src/Kernel/Plugin/StyleTableUnitTest.php +++ b/core/modules/views/tests/src/Kernel/Plugin/StyleTableUnitTest.php @@ -74,8 +74,8 @@ public function testTable() { $style_plugin->options['default'] = 'id'; $style_plugin->options['info']['id']['default_sort_order'] = 'desc'; $style_plugin->buildSortPost(); - $this->assertIdentical($style_plugin->order, 'desc', 'Fallback to the right default sort order.'); - $this->assertIdentical($style_plugin->active, 'id', 'Fallback to the right default sort field.'); + $this->assertIdentical('desc', $style_plugin->order, 'Fallback to the right default sort order.'); + $this->assertIdentical('id', $style_plugin->active, 'Fallback to the right default sort field.'); $view->destroy(); // Setup a valid default + table default sort order. @@ -85,8 +85,8 @@ public function testTable() { $style_plugin->options['info']['id']['default_sort_order'] = NULL; $style_plugin->options['order'] = 'asc'; $style_plugin->buildSortPost(); - $this->assertIdentical($style_plugin->order, 'asc', 'Fallback to the right default sort order.'); - $this->assertIdentical($style_plugin->active, 'id', 'Fallback to the right default sort field.'); + $this->assertIdentical('asc', $style_plugin->order, 'Fallback to the right default sort order.'); + $this->assertIdentical('id', $style_plugin->active, 'Fallback to the right default sort field.'); $view->destroy(); // Use an invalid field. @@ -96,7 +96,7 @@ public function testTable() { $random_name = $this->randomMachineName(); $request->query->set('order', $random_name); $style_plugin->buildSortPost(); - $this->assertIdentical($style_plugin->order, 'asc', 'No sort order was set, when invalid sort order was specified.'); + $this->assertIdentical('asc', $style_plugin->order, 'No sort order was set, when invalid sort order was specified.'); $this->assertNull($style_plugin->active, 'No sort field was set, when invalid sort order was specified.'); $view->destroy(); @@ -107,8 +107,8 @@ public function testTable() { $request->query->set('sort', $order); $request->query->set('order', 'id'); $style_plugin->buildSortPost(); - $this->assertIdentical($style_plugin->order, $order, 'Ensure the right sort order was set.'); - $this->assertIdentical($style_plugin->active, 'id', 'Ensure the right order was set.'); + $this->assertIdentical($order, $style_plugin->order, 'Ensure the right sort order was set.'); + $this->assertIdentical('id', $style_plugin->active, 'Ensure the right order was set.'); $view->destroy(); } diff --git a/core/modules/views/tests/src/Kernel/TokenReplaceTest.php b/core/modules/views/tests/src/Kernel/TokenReplaceTest.php index 4f4905fee320..abeb48995ddc 100644 --- a/core/modules/views/tests/src/Kernel/TokenReplaceTest.php +++ b/core/modules/views/tests/src/Kernel/TokenReplaceTest.php @@ -64,7 +64,7 @@ public function testTokenReplacement() { foreach ($expected as $token => $expected_output) { $bubbleable_metadata = new BubbleableMetadata(); $output = $token_handler->replace($token, ['view' => $view], [], $bubbleable_metadata); - $this->assertIdentical($output, $expected_output, new FormattableMarkup('Token %token replaced correctly.', ['%token' => $token])); + $this->assertIdentical($expected_output, $output, new FormattableMarkup('Token %token replaced correctly.', ['%token' => $token])); $this->assertEqual($bubbleable_metadata, $metadata_tests[$token]); } } @@ -121,7 +121,7 @@ public function testTokenReplacementNoResults() { foreach ($expected as $token => $expected_output) { $output = $token_handler->replace($token, ['view' => $view]); - $this->assertIdentical($output, $expected_output, new FormattableMarkup('Token %token replaced correctly.', ['%token' => $token])); + $this->assertIdentical($expected_output, $output, new FormattableMarkup('Token %token replaced correctly.', ['%token' => $token])); } } @@ -140,7 +140,7 @@ public function testTokenReplacementNoPath() { foreach ($expected as $token => $expected_output) { $output = $token_handler->replace($token, ['view' => $view]); - $this->assertIdentical($output, $expected_output, new FormattableMarkup('Token %token replaced correctly.', ['%token' => $token])); + $this->assertIdentical($expected_output, $output, new FormattableMarkup('Token %token replaced correctly.', ['%token' => $token])); } } diff --git a/core/modules/views/tests/src/Kernel/ViewExecutableTest.php b/core/modules/views/tests/src/Kernel/ViewExecutableTest.php index d69e5149ebfa..59cf5793dbef 100644 --- a/core/modules/views/tests/src/Kernel/ViewExecutableTest.php +++ b/core/modules/views/tests/src/Kernel/ViewExecutableTest.php @@ -321,7 +321,7 @@ public function testPropertyMethods() { 'views_test_data' => TRUE, '#global' => TRUE, ]; - $this->assertIdentical($view->getBaseTables(), $expected); + $this->assertIdentical($expected, $view->getBaseTables()); // Test response methods. $this->assertInstanceOf(Response::class, $view->getResponse()); @@ -498,10 +498,10 @@ public function testSerialization() { $unserialized = unserialize($serialized); $this->assertInstanceOf(ViewExecutable::class, $unserialized); - $this->assertIdentical($view->storage->id(), $unserialized->storage->id(), 'The expected storage entity was loaded on the unserialized view.'); - $this->assertIdentical($unserialized->current_display, 'page_1', 'The expected display was set on the unserialized view.'); - $this->assertIdentical($unserialized->args, ['test'], 'The expected argument was set on the unserialized view.'); - $this->assertIdentical($unserialized->getCurrentPage(), 2, 'The expected current page was set on the unserialized view.'); + $this->assertIdentical($unserialized->storage->id(), $view->storage->id(), 'The expected storage entity was loaded on the unserialized view.'); + $this->assertIdentical('page_1', $unserialized->current_display, 'The expected display was set on the unserialized view.'); + $this->assertIdentical(['test'], $unserialized->args, 'The expected argument was set on the unserialized view.'); + $this->assertIdentical(2, $unserialized->getCurrentPage(), 'The expected current page was set on the unserialized view.'); // Get the definition of node's nid field, for example. Only get it not from // the field manager directly, but from the item data definition. It should diff --git a/core/modules/views_ui/tests/src/Functional/DisplayTest.php b/core/modules/views_ui/tests/src/Functional/DisplayTest.php index 5fb1696f8e19..de9fb191a627 100644 --- a/core/modules/views_ui/tests/src/Functional/DisplayTest.php +++ b/core/modules/views_ui/tests/src/Functional/DisplayTest.php @@ -114,7 +114,7 @@ public function testDisplayPluginsAlter() { // Test the expected views_ui array exists on each definition. foreach ($definitions as $definition) { - $this->assertIdentical($definition['contextual links']['entity.view.edit_form'], $expected, 'Expected views_ui array found in plugin definition.'); + $this->assertIdentical($expected, $definition['contextual links']['entity.view.edit_form'], 'Expected views_ui array found in plugin definition.'); } } diff --git a/core/modules/views_ui/tests/src/Functional/HandlerTest.php b/core/modules/views_ui/tests/src/Functional/HandlerTest.php index 15bf5fb5a4a6..39f3573ff5f7 100644 --- a/core/modules/views_ui/tests/src/Functional/HandlerTest.php +++ b/core/modules/views_ui/tests/src/Functional/HandlerTest.php @@ -218,7 +218,7 @@ public function testBrokenHandlers() { $text = 'Broken/missing handler'; - $this->assertIdentical($result[0]->getText(), $text, 'Ensure the broken handler text was found.'); + $this->assertIdentical($text, $result[0]->getText(), 'Ensure the broken handler text was found.'); $this->drupalGet($href); $result = $this->xpath('//h1[@class="page-title"]'); diff --git a/core/modules/views_ui/tests/src/Functional/ViewEditTest.php b/core/modules/views_ui/tests/src/Functional/ViewEditTest.php index 6c0b45e5fb76..56ad8b94de03 100644 --- a/core/modules/views_ui/tests/src/Functional/ViewEditTest.php +++ b/core/modules/views_ui/tests/src/Functional/ViewEditTest.php @@ -66,7 +66,7 @@ public function testOtherOptions() { $view = \Drupal::entityTypeManager()->getStorage('view')->load('test_view'); $displays = $view->get('display'); $this->assertTrue(!empty($displays['test_1']), 'Display data found for new display ID key.'); - $this->assertIdentical($displays['test_1']['id'], 'test_1', 'New display ID matches the display ID key.'); + $this->assertIdentical('test_1', $displays['test_1']['id'], 'New display ID matches the display ID key.'); $this->assertArrayNotHasKey('attachment_1', $displays); // Set to the same machine name and save the View. diff --git a/core/tests/Drupal/KernelTests/AssertContentTrait.php b/core/tests/Drupal/KernelTests/AssertContentTrait.php index 48749a99c1b7..371e397d91a0 100644 --- a/core/tests/Drupal/KernelTests/AssertContentTrait.php +++ b/core/tests/Drupal/KernelTests/AssertContentTrait.php @@ -894,7 +894,7 @@ protected function assertThemeOutput($callback, array $variables = [], $expected $message = '%callback rendered correctly.'; } $message = new FormattableMarkup($message, ['%callback' => 'theme_' . $callback . '()']); - return $this->assertIdentical($output, $expected, $message, $group); + return $this->assertIdentical($expected, $output, $message, $group); } /** diff --git a/core/tests/Drupal/KernelTests/Core/Asset/AttachedAssetsTest.php b/core/tests/Drupal/KernelTests/Core/Asset/AttachedAssetsTest.php index d4dab294e8b1..8a8a22aa2f16 100644 --- a/core/tests/Drupal/KernelTests/Core/Asset/AttachedAssetsTest.php +++ b/core/tests/Drupal/KernelTests/Core/Asset/AttachedAssetsTest.php @@ -208,17 +208,17 @@ public function testSettings() { // Test whether the settings for core/drupalSettings are available. $this->assertTrue(isset($parsed_settings['path']['baseUrl']), 'drupalSettings.path.baseUrl is present.'); - $this->assertIdentical($parsed_settings['path']['pathPrefix'], 'yarhar', 'drupalSettings.path.pathPrefix is present and has the correct (overridden) value.'); - $this->assertIdentical($parsed_settings['path']['currentPath'], '', 'drupalSettings.path.currentPath is present and has the correct value.'); + $this->assertIdentical('yarhar', $parsed_settings['path']['pathPrefix'], 'drupalSettings.path.pathPrefix is present and has the correct (overridden) value.'); + $this->assertIdentical('', $parsed_settings['path']['currentPath'], 'drupalSettings.path.currentPath is present and has the correct value.'); $this->assertFalse($parsed_settings['path']['currentPathIsAdmin'], 'drupalSettings.path.currentPathIsAdmin is present and has the correct value.'); $this->assertFalse($parsed_settings['path']['isFront'], 'drupalSettings.path.isFront is present and has the correct value.'); - $this->assertIdentical($parsed_settings['path']['currentLanguage'], 'en', 'drupalSettings.path.currentLanguage is present and has the correct value.'); + $this->assertIdentical('en', $parsed_settings['path']['currentLanguage'], 'drupalSettings.path.currentLanguage is present and has the correct value.'); // Tests whether altering JavaScript settings via hook_js_settings_alter() // is working as expected. // @see common_test_js_settings_alter() - $this->assertIdentical($parsed_settings['pluralDelimiter'], '☃'); - $this->assertIdentical($parsed_settings['foo'], 'bar'); + $this->assertIdentical('☃', $parsed_settings['pluralDelimiter']); + $this->assertIdentical('bar', $parsed_settings['foo']); } /** @@ -318,7 +318,7 @@ public function testRenderOrder() { else { $result = []; } - $this->assertIdentical($result, $expected_order_js, 'JavaScript is added in the expected weight order.'); + $this->assertIdentical($expected_order_js, $result, 'JavaScript is added in the expected weight order.'); // Construct the expected result from the regex. $expected_order_css = [ @@ -360,7 +360,7 @@ public function testRenderOrder() { else { $result = []; } - $this->assertIdentical($result, $expected_order_css, 'CSS is added in the expected weight order.'); + $this->assertIdentical($expected_order_css, $result, 'CSS is added in the expected weight order.'); } /** diff --git a/core/tests/Drupal/KernelTests/Core/Bootstrap/GetFilenameTest.php b/core/tests/Drupal/KernelTests/Core/Bootstrap/GetFilenameTest.php index 0a063d12e111..2ec8ff16d1a7 100644 --- a/core/tests/Drupal/KernelTests/Core/Bootstrap/GetFilenameTest.php +++ b/core/tests/Drupal/KernelTests/Core/Bootstrap/GetFilenameTest.php @@ -31,18 +31,18 @@ public function register(ContainerBuilder $container) { */ public function testDrupalGetFilename() { // Retrieving the location of a module. - $this->assertIdentical(drupal_get_filename('module', 'system'), 'core/modules/system/system.info.yml'); + $this->assertIdentical('core/modules/system/system.info.yml', drupal_get_filename('module', 'system')); // Retrieving the location of a theme. \Drupal::service('theme_installer')->install(['stark']); - $this->assertIdentical(drupal_get_filename('theme', 'stark'), 'core/themes/stark/stark.info.yml'); + $this->assertIdentical('core/themes/stark/stark.info.yml', drupal_get_filename('theme', 'stark')); // Retrieving the location of a theme engine. - $this->assertIdentical(drupal_get_filename('theme_engine', 'twig'), 'core/themes/engines/twig/twig.info.yml'); + $this->assertIdentical('core/themes/engines/twig/twig.info.yml', drupal_get_filename('theme_engine', 'twig')); // Retrieving the location of a profile. Profiles are a special case with // a fixed location and naming. - $this->assertIdentical(drupal_get_filename('profile', 'testing'), 'core/profiles/testing/testing.info.yml'); + $this->assertIdentical('core/profiles/testing/testing.info.yml', drupal_get_filename('profile', 'testing')); // Set a custom error handler so we can ignore the file not found error. set_error_handler(function ($severity, $message, $file, $line) { diff --git a/core/tests/Drupal/KernelTests/Core/Cache/GenericCacheBackendUnitTestBase.php b/core/tests/Drupal/KernelTests/Core/Cache/GenericCacheBackendUnitTestBase.php index 86cdf27c5165..d7f1c5f0913b 100644 --- a/core/tests/Drupal/KernelTests/Core/Cache/GenericCacheBackendUnitTestBase.php +++ b/core/tests/Drupal/KernelTests/Core/Cache/GenericCacheBackendUnitTestBase.php @@ -329,10 +329,10 @@ public function testGetMultiple() { $this->assertFalse(isset($ret['test19']), "Nonexistent cache id test19 is not set."); $this->assertFalse(isset($ret['test21']), "Nonexistent cache id test21 is not set."); // Test values. - $this->assertIdentical($ret['test2']->data, 3, "Existing cache id test2 has the correct value."); - $this->assertIdentical($ret['test3']->data, 5, "Existing cache id test3 has the correct value."); - $this->assertIdentical($ret['test6']->data, 13, "Existing cache id test6 has the correct value."); - $this->assertIdentical($ret['test7']->data, 17, "Existing cache id test7 has the correct value."); + $this->assertIdentical(3, $ret['test2']->data, "Existing cache id test2 has the correct value."); + $this->assertIdentical(5, $ret['test3']->data, "Existing cache id test3 has the correct value."); + $this->assertIdentical(13, $ret['test6']->data, "Existing cache id test6 has the correct value."); + $this->assertIdentical(17, $ret['test7']->data, "Existing cache id test7 has the correct value."); // Test $cids array - ensure it contains cache id's that do not exist. $this->assertContains('test19', $cids, "Nonexistent cache id test19 is in cids array."); $this->assertContains('test21', $cids, "Nonexistent cache id test21 is in cids array."); @@ -359,9 +359,9 @@ public function testGetMultiple() { $this->assertFalse(isset($ret['test6']), "Deleted cache id test6 is not set"); $this->assertFalse(isset($ret['test21']), "Nonexistent cache id test21 is not set"); // Test values. - $this->assertIdentical($ret['test2']->data, 3, "Existing cache id test2 has the correct value."); - $this->assertIdentical($ret['test7']->data, 17, "Existing cache id test7 has the correct value."); - $this->assertIdentical($ret['test19']->data, 57, "Added cache id test19 has the correct value."); + $this->assertIdentical(3, $ret['test2']->data, "Existing cache id test2 has the correct value."); + $this->assertIdentical(17, $ret['test7']->data, "Existing cache id test7 has the correct value."); + $this->assertIdentical(57, $ret['test19']->data, "Added cache id test19 has the correct value."); // Test $cids array - ensure it contains cache id's that do not exist. $this->assertContains('test3', $cids, "Deleted cache id test3 is in cids array."); $this->assertContains('test6', $cids, "Deleted cache id test6 is in cids array."); diff --git a/core/tests/Drupal/KernelTests/Core/Command/DbDumpTest.php b/core/tests/Drupal/KernelTests/Core/Command/DbDumpTest.php index d121b8c3c831..de69025042f3 100644 --- a/core/tests/Drupal/KernelTests/Core/Command/DbDumpTest.php +++ b/core/tests/Drupal/KernelTests/Core/Command/DbDumpTest.php @@ -210,7 +210,7 @@ public function testScriptLoad() { // Ensure the test config has been replaced. $config = unserialize($connection->select('config', 'c')->fields('c', ['data'])->condition('name', 'test_config')->execute()->fetchField()); - $this->assertIdentical($config, $this->data, 'Script has properly restored the config table data.'); + $this->assertIdentical($this->data, $config, 'Script has properly restored the config table data.'); // Ensure the cache data was not exported. $this->assertFalse(\Drupal::cache('discovery') diff --git a/core/tests/Drupal/KernelTests/Core/Common/XssUnitTest.php b/core/tests/Drupal/KernelTests/Core/Common/XssUnitTest.php index 599ab8d93f6a..a09cd2df8fa2 100644 --- a/core/tests/Drupal/KernelTests/Core/Common/XssUnitTest.php +++ b/core/tests/Drupal/KernelTests/Core/Common/XssUnitTest.php @@ -48,8 +48,8 @@ public function testBadProtocolStripping() { $url = 'javascript:http://www.example.com/?x=1&y=2'; $expected_plain = 'http://www.example.com/?x=1&y=2'; $expected_html = 'http://www.example.com/?x=1&y=2'; - $this->assertIdentical(UrlHelper::filterBadProtocol($url), $expected_html, '\Drupal\Component\Utility\UrlHelper::filterBadProtocol() filters a URL and encodes it for HTML.'); - $this->assertIdentical(UrlHelper::stripDangerousProtocols($url), $expected_plain, '\Drupal\Component\Utility\UrlHelper::stripDangerousProtocols() filters a URL and returns plain text.'); + $this->assertIdentical($expected_html, UrlHelper::filterBadProtocol($url), '\\Drupal\\Component\\Utility\\UrlHelper::filterBadProtocol() filters a URL and encodes it for HTML.'); + $this->assertIdentical($expected_plain, UrlHelper::stripDangerousProtocols($url), '\\Drupal\\Component\\Utility\\UrlHelper::stripDangerousProtocols() filters a URL and returns plain text.'); } diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigCRUDTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigCRUDTest.php index e76ce3e8963b..ff83081b479d 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/ConfigCRUDTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigCRUDTest.php @@ -58,11 +58,11 @@ public function testCRUD() { // Verify the active configuration contains the saved value. $actual_data = $storage->read($name); - $this->assertIdentical($actual_data, ['value' => 'initial']); + $this->assertIdentical(['value' => 'initial'], $actual_data); // Verify the config factory contains the saved value. $actual_data = $config_factory->get($name)->getRawData(); - $this->assertIdentical($actual_data, ['value' => 'initial']); + $this->assertIdentical(['value' => 'initial'], $actual_data); // Create another instance of the config object using a custom collection. $collection_config = new Config( @@ -77,7 +77,7 @@ public function testCRUD() { // Verify that the config factory still returns the right value, from the // config instance in the default collection. $actual_data = $config_factory->get($name)->getRawData(); - $this->assertIdentical($actual_data, ['value' => 'initial']); + $this->assertIdentical(['value' => 'initial'], $actual_data); // Update the configuration object instance. $config->set('value', 'instance-update'); @@ -86,11 +86,11 @@ public function testCRUD() { // Verify the active configuration contains the updated value. $actual_data = $storage->read($name); - $this->assertIdentical($actual_data, ['value' => 'instance-update']); + $this->assertIdentical(['value' => 'instance-update'], $actual_data); // Verify a call to $this->config() immediately returns the updated value. $new_config = $this->config($name); - $this->assertIdentical($new_config->get(), $config->get()); + $this->assertIdentical($config->get(), $new_config->get()); $this->assertFalse($config->isNew()); // Pollute the config factory static cache. @@ -102,13 +102,13 @@ public function testCRUD() { $collection_config->delete(); $actual_config = $config_factory->get($name); $this->assertFalse($actual_config->isNew()); - $this->assertIdentical($actual_config->getRawData(), ['value' => 'instance-update']); + $this->assertIdentical(['value' => 'instance-update'], $actual_config->getRawData()); // Delete the configuration object. $config->delete(); // Verify the configuration object is empty. - $this->assertIdentical($config->get(), []); + $this->assertIdentical([], $config->get()); $this->assertTrue($config->isNew()); // Verify that all copies of the configuration has been removed from the @@ -121,7 +121,7 @@ public function testCRUD() { // Verify $this->config() returns no data. $new_config = $this->config($name); - $this->assertIdentical($new_config->get(), $config->get()); + $this->assertIdentical($config->get(), $new_config->get()); $this->assertTrue($config->isNew()); // Re-create the configuration object. @@ -131,24 +131,24 @@ public function testCRUD() { // Verify the active configuration contains the updated value. $actual_data = $storage->read($name); - $this->assertIdentical($actual_data, ['value' => 're-created']); + $this->assertIdentical(['value' => 're-created'], $actual_data); // Verify a call to $this->config() immediately returns the updated value. $new_config = $this->config($name); - $this->assertIdentical($new_config->get(), $config->get()); + $this->assertIdentical($config->get(), $new_config->get()); $this->assertFalse($config->isNew()); // Rename the configuration object. $new_name = 'config_test.crud_rename'; $this->container->get('config.factory')->rename($name, $new_name); $renamed_config = $this->config($new_name); - $this->assertIdentical($renamed_config->get(), $config->get()); + $this->assertIdentical($config->get(), $renamed_config->get()); $this->assertFalse($renamed_config->isNew()); // Ensure that the old configuration object is removed from both the cache // and the configuration storage. $config = $this->config($name); - $this->assertIdentical($config->get(), []); + $this->assertIdentical([], $config->get()); $this->assertTrue($config->isNew()); // Test renaming when config.factory does not have the object in its static @@ -162,7 +162,7 @@ public function testCRUD() { $new_name = 'config_test.crud_rename_no_cache'; $config_factory->rename($name, $new_name); $renamed_config = $config_factory->get($new_name); - $this->assertIdentical($renamed_config->get(), $config->get()); + $this->assertIdentical($config->get(), $renamed_config->get()); $this->assertFalse($renamed_config->isNew()); // Ensure the overrides static cache has been cleared. $this->assertTrue($config_factory->get($name)->isNew()); @@ -177,8 +177,8 @@ public function testCRUD() { ]; $new_config->merge($expected_values); $new_config->save(); - $this->assertIdentical($new_config->get('value'), $expected_values['value']); - $this->assertIdentical($new_config->get('404'), $expected_values['404']); + $this->assertIdentical($expected_values['value'], $new_config->get('value')); + $this->assertIdentical($expected_values['404'], $new_config->get('404')); // Test that getMultiple() does not return new config objects that were // previously accessed with get() @@ -287,22 +287,22 @@ public function testDataTypes() { 'string_int' => '1', ]; $data['_core']['default_config_hash'] = Crypt::hashBase64(serialize($data)); - $this->assertIdentical($config->get(), $data); + $this->assertIdentical($data, $config->get()); // Re-set each key using Config::set(). foreach ($data as $key => $value) { $config->set($key, $value); } $config->save(); - $this->assertIdentical($config->get(), $data); + $this->assertIdentical($data, $config->get()); // Assert the data against the file storage. - $this->assertIdentical($storage->read($name), $data); + $this->assertIdentical($data, $storage->read($name)); $this->verbose('<pre>' . $name . var_export($storage->read($name), TRUE)); // Set data using config::setData(). $config->setData($data)->save(); - $this->assertIdentical($config->get(), $data); - $this->assertIdentical($storage->read($name), $data); + $this->assertIdentical($data, $config->get()); + $this->assertIdentical($data, $storage->read($name)); // Test that schema type enforcement can be overridden by trusting the data. $this->assertSame(99, $config->get('int')); diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigDiffTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigDiffTest.php index 0ad2e2c8a657..35aa9f83f65e 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/ConfigDiffTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigDiffTest.php @@ -166,11 +166,11 @@ protected function assertYamlEdit(array $edits, $field, $type, $orig = NULL, $cl $this->assertEqual($edit->type, $type, "The $field item in the diff is a $type"); // If an original value was given, assert that it matches. if (isset($orig)) { - $this->assertIdentical($edit->orig, $orig, "The original value for key '$field' is correct."); + $this->assertIdentical($orig, $edit->orig, "The original value for key '{$field}' is correct."); } // If a closing value was given, assert that it matches. if (isset($closing)) { - $this->assertIdentical($edit->closing, $closing, "The closing value for key '$field' is correct."); + $this->assertIdentical($closing, $edit->closing, "The closing value for key '{$field}' is correct."); } // Break out of the search entirely. break 2; diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigEntityStaticCacheTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigEntityStaticCacheTest.php index ccb73d433ea0..18312961b3d8 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/ConfigEntityStaticCacheTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigEntityStaticCacheTest.php @@ -76,7 +76,7 @@ public function testReset() { $entity->label = 'New label'; $entity->save(); $entity = $storage->load($this->entityId); - $this->assertIdentical($entity->label, 'New label'); + $this->assertIdentical('New label', $entity->label); // Ensure loading after a delete retrieves NULL rather than an obsolete // cached one. @@ -97,7 +97,7 @@ public function testConfigOverride() { // despite the prior cache priming. \Drupal::configFactory()->addOverride(new ConfigOverrider()); $entity_override = $storage->load($this->entityId); - $this->assertIdentical($entity_override->label, 'Overridden label'); + $this->assertIdentical('Overridden label', $entity_override->label); // Load override free to ensure that loading the config entity again does // not return the overridden value. @@ -106,10 +106,10 @@ public function testConfigOverride() { $this->assertNotSame($entity_override->_loadStamp, $entity_no_override->_loadStamp); // Reload the entity and ensure the cache is used. - $this->assertIdentical($storage->loadOverrideFree($this->entityId)->_loadStamp, $entity_no_override->_loadStamp); + $this->assertIdentical($entity_no_override->_loadStamp, $storage->loadOverrideFree($this->entityId)->_loadStamp); // Enable overrides and reload the entity and ensure the cache is used. - $this->assertIdentical($storage->load($this->entityId)->_loadStamp, $entity_override->_loadStamp); + $this->assertIdentical($entity_override->_loadStamp, $storage->load($this->entityId)->_loadStamp); } } diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigEntityStorageTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigEntityStorageTest.php index 5ff7f1d34490..f4b8ec5a1b61 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/ConfigEntityStorageTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigEntityStorageTest.php @@ -48,7 +48,7 @@ public function testUUIDConflict() { // Ensure that the config entity was not corrupted. $entity = $storage->loadUnchanged($entity->id()); - $this->assertIdentical($entity->toArray(), $original_properties); + $this->assertIdentical($original_properties, $entity->toArray()); } /** diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigEntityUnitTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigEntityUnitTest.php index fe9490d32ede..3bd840b0e7fb 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/ConfigEntityUnitTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigEntityUnitTest.php @@ -52,7 +52,7 @@ public function testStorageMethods() { $expected_id = 'test_id'; $config_name = $entity_type->getConfigPrefix() . '.' . $expected_id; $storage = $this->storage; - $this->assertIdentical($storage::getIDFromConfigName($config_name, $entity_type->getConfigPrefix()), $expected_id); + $this->assertIdentical($expected_id, $storage::getIDFromConfigName($config_name, $entity_type->getConfigPrefix())); // Create three entities, two with the same style. $style = $this->randomMachineName(8); @@ -90,7 +90,7 @@ public function testStorageMethods() { // Assert that both returned entities have a matching style property. foreach ($entities as $entity) { - $this->assertIdentical($entity->get('style'), $style, 'The loaded entity has the correct style value specified.'); + $this->assertIdentical($style, $entity->get('style'), 'The loaded entity has the correct style value specified.'); } // Test that schema type enforcement can be overridden by trusting the data. diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigEventsTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigEventsTest.php index 851fd6a8c0de..f83185d23ba4 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/ConfigEventsTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigEventsTest.php @@ -28,28 +28,28 @@ public function testConfigEvents() { $config = new Config($name, \Drupal::service('config.storage'), \Drupal::service('event_dispatcher'), \Drupal::service('config.typed')); $config->set('key', 'initial'); - $this->assertIdentical(\Drupal::state()->get('config_events_test.event', []), [], 'No events fired by creating a new configuration object'); + $this->assertIdentical([], \Drupal::state()->get('config_events_test.event', []), 'No events fired by creating a new configuration object'); $config->save(); $event = \Drupal::state()->get('config_events_test.event', []); - $this->assertIdentical($event['event_name'], ConfigEvents::SAVE); - $this->assertIdentical($event['current_config_data'], ['key' => 'initial']); - $this->assertIdentical($event['raw_config_data'], ['key' => 'initial']); - $this->assertIdentical($event['original_config_data'], []); + $this->assertIdentical(ConfigEvents::SAVE, $event['event_name']); + $this->assertIdentical(['key' => 'initial'], $event['current_config_data']); + $this->assertIdentical(['key' => 'initial'], $event['raw_config_data']); + $this->assertIdentical([], $event['original_config_data']); $config->set('key', 'updated')->save(); $event = \Drupal::state()->get('config_events_test.event', []); - $this->assertIdentical($event['event_name'], ConfigEvents::SAVE); - $this->assertIdentical($event['current_config_data'], ['key' => 'updated']); - $this->assertIdentical($event['raw_config_data'], ['key' => 'updated']); - $this->assertIdentical($event['original_config_data'], ['key' => 'initial']); + $this->assertIdentical(ConfigEvents::SAVE, $event['event_name']); + $this->assertIdentical(['key' => 'updated'], $event['current_config_data']); + $this->assertIdentical(['key' => 'updated'], $event['raw_config_data']); + $this->assertIdentical(['key' => 'initial'], $event['original_config_data']); $config->delete(); $event = \Drupal::state()->get('config_events_test.event', []); - $this->assertIdentical($event['event_name'], ConfigEvents::DELETE); - $this->assertIdentical($event['current_config_data'], []); - $this->assertIdentical($event['raw_config_data'], []); - $this->assertIdentical($event['original_config_data'], ['key' => 'updated']); + $this->assertIdentical(ConfigEvents::DELETE, $event['event_name']); + $this->assertIdentical([], $event['current_config_data']); + $this->assertIdentical([], $event['raw_config_data']); + $this->assertIdentical(['key' => 'updated'], $event['original_config_data']); } /** @@ -64,18 +64,18 @@ public function testConfigRenameEvent() { $config = $this->config($name); $config->set('key', 'initial')->save(); $event = \Drupal::state()->get('config_events_test.event', []); - $this->assertIdentical($event['event_name'], ConfigEvents::SAVE); - $this->assertIdentical($event['current_config_data'], ['key' => 'initial']); + $this->assertIdentical(ConfigEvents::SAVE, $event['event_name']); + $this->assertIdentical(['key' => 'initial'], $event['current_config_data']); // Override applies when getting runtime config. $this->assertEqual($GLOBALS['config'][$name], \Drupal::config($name)->get()); \Drupal::configFactory()->rename($name, $new_name); $event = \Drupal::state()->get('config_events_test.event', []); - $this->assertIdentical($event['event_name'], ConfigEvents::RENAME); - $this->assertIdentical($event['current_config_data'], ['key' => 'new overridden']); - $this->assertIdentical($event['raw_config_data'], ['key' => 'initial']); - $this->assertIdentical($event['original_config_data'], ['key' => 'new overridden']); + $this->assertIdentical(ConfigEvents::RENAME, $event['event_name']); + $this->assertIdentical(['key' => 'new overridden'], $event['current_config_data']); + $this->assertIdentical(['key' => 'initial'], $event['raw_config_data']); + $this->assertIdentical(['key' => 'new overridden'], $event['original_config_data']); } } diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigImporterTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigImporterTest.php index 8348d7dc4ae0..e2371b69bbb9 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/ConfigImporterTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigImporterTest.php @@ -73,7 +73,7 @@ public function testNoImport() { // Verify the default configuration values exist. $config = $this->config($dynamic_name); - $this->assertIdentical($config->get('id'), 'dotted.default'); + $this->assertIdentical('dotted.default', $config->get('id')); // Verify that a bare $this->config() does not involve module APIs. $this->assertFalse(isset($GLOBALS['hook_config_test'])); @@ -128,7 +128,7 @@ public function testDeleted() { // Verify the default configuration values exist. $config = $this->config($dynamic_name); - $this->assertIdentical($config->get('id'), 'dotted.default'); + $this->assertIdentical('dotted.default', $config->get('id')); // Delete the file from the sync directory. $sync->delete($dynamic_name); @@ -189,7 +189,7 @@ public function testNew() { // Verify the values appeared. $config = $this->config($dynamic_name); - $this->assertIdentical($config->get('label'), $original_dynamic_data['label']); + $this->assertIdentical($original_dynamic_data['label'], $config->get('label')); // Verify that appropriate module API hooks have been invoked. $this->assertFalse(isset($GLOBALS['hook_config_test']['load'])); @@ -500,9 +500,9 @@ public function testUpdated() { // Verify the active configuration still returns the default values. $config = $this->config($name); - $this->assertIdentical($config->get('foo'), 'bar'); + $this->assertIdentical('bar', $config->get('foo')); $config = $this->config($dynamic_name); - $this->assertIdentical($config->get('label'), 'Default'); + $this->assertIdentical('Default', $config->get('label')); // Import. $this->configImporter->reset()->import(); @@ -510,13 +510,13 @@ public function testUpdated() { // Verify the values were updated. \Drupal::configFactory()->reset($name); $config = $this->config($name); - $this->assertIdentical($config->get('foo'), 'beer'); + $this->assertIdentical('beer', $config->get('foo')); $config = $this->config($dynamic_name); - $this->assertIdentical($config->get('label'), 'Updated'); + $this->assertIdentical('Updated', $config->get('label')); // Verify that the original file content is still the same. - $this->assertIdentical($sync->read($name), $original_name_data); - $this->assertIdentical($sync->read($dynamic_name), $original_dynamic_data); + $this->assertIdentical($original_name_data, $sync->read($name)); + $this->assertIdentical($original_dynamic_data, $sync->read($dynamic_name)); // Verify that appropriate module API hooks have been invoked. $this->assertTrue(isset($GLOBALS['hook_config_test']['load'])); diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigLanguageOverrideTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigLanguageOverrideTest.php index 995d022c9732..71dded493d6f 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/ConfigLanguageOverrideTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigLanguageOverrideTest.php @@ -42,22 +42,22 @@ public function testConfigLanguageOverride() { // English overrides work. \Drupal::languageManager()->setConfigOverrideLanguage(\Drupal::languageManager()->getLanguage('en')); $config = \Drupal::config('config_test.system'); - $this->assertIdentical($config->get('foo'), 'en bar'); + $this->assertIdentical('en bar', $config->get('foo')); // Ensure that the raw data is not translated. $raw = $config->getRawData(); - $this->assertIdentical($raw['foo'], 'bar'); + $this->assertIdentical('bar', $raw['foo']); ConfigurableLanguage::createFromLangcode('fr')->save(); ConfigurableLanguage::createFromLangcode('de')->save(); \Drupal::languageManager()->setConfigOverrideLanguage(\Drupal::languageManager()->getLanguage('fr')); $config = \Drupal::config('config_test.system'); - $this->assertIdentical($config->get('foo'), 'fr bar'); + $this->assertIdentical('fr bar', $config->get('foo')); \Drupal::languageManager()->setConfigOverrideLanguage(\Drupal::languageManager()->getLanguage('de')); $config = \Drupal::config('config_test.system'); - $this->assertIdentical($config->get('foo'), 'de bar'); + $this->assertIdentical('de bar', $config->get('foo')); // Test overrides of completely new configuration objects. In normal runtime // this should only happen for configuration entities as we should not be @@ -68,7 +68,7 @@ public function testConfigLanguageOverride() { ->save(); $config = \Drupal::config('config_test.new'); $this->assertTrue($config->isNew(), 'The configuration object config_test.new is new'); - $this->assertIdentical($config->get('language'), 'override'); + $this->assertIdentical('override', $config->get('language')); $this->assertNull($config->getOriginal('language', FALSE)); // Test how overrides react to base configuration changes. Set up some base @@ -88,7 +88,7 @@ public function testConfigLanguageOverride() { ->save(); \Drupal::configFactory()->clearStaticCache(); $config = \Drupal::config('config_test.foo'); - $this->assertIdentical($config->get('value'), ['key' => 'override']); + $this->assertIdentical(['key' => 'override'], $config->get('value')); // Ensure renaming the config will rename the override. \Drupal::languageManager()->setConfigOverrideLanguage(\Drupal::languageManager()->getLanguage('en')); diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigModuleOverridesTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigModuleOverridesTest.php index d170e3653ad3..568cae95b819 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/ConfigModuleOverridesTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigModuleOverridesTest.php @@ -42,7 +42,7 @@ public function testSimpleModuleOverrides() { // creating simple configuration objects on the fly. $config = $config_factory->get('config_override_test.new'); $this->assertTrue($config->isNew(), 'The configuration object config_override_test.new is new'); - $this->assertIdentical($config->get('module'), 'override'); + $this->assertIdentical('override', $config->get('module')); $this->assertNull($config->getOriginal('module', FALSE)); unset($GLOBALS['config_test_run_module_overrides']); diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigOverrideTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigOverrideTest.php index 3411662a6d27..62a9fca80632 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/ConfigOverrideTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigOverrideTest.php @@ -47,25 +47,25 @@ public function testConfOverride() { // directly otherwise overrides will apply. $active = $this->container->get('config.storage'); $data = $active->read('config_test.system'); - $this->assertIdentical($data['foo'], $expected_original_data['foo']); + $this->assertIdentical($expected_original_data['foo'], $data['foo']); $this->assertFalse(isset($data['baz'])); - $this->assertIdentical($data['404'], $expected_original_data['404']); + $this->assertIdentical($expected_original_data['404'], $data['404']); // Get the configuration object with overrides. $config = \Drupal::configFactory()->get('config_test.system'); // Verify that it contains the overridden data from $config. - $this->assertIdentical($config->get('foo'), $overrides['config_test.system']['foo']); - $this->assertIdentical($config->get('baz'), $overrides['config_test.system']['baz']); - $this->assertIdentical($config->get('404'), $overrides['config_test.system']['404']); + $this->assertIdentical($overrides['config_test.system']['foo'], $config->get('foo')); + $this->assertIdentical($overrides['config_test.system']['baz'], $config->get('baz')); + $this->assertIdentical($overrides['config_test.system']['404'], $config->get('404')); // Get the configuration object which does not have overrides. $config = \Drupal::configFactory()->getEditable('config_test.system'); // Verify that it does not contains the overridden data from $config. - $this->assertIdentical($config->get('foo'), $expected_original_data['foo']); + $this->assertIdentical($expected_original_data['foo'], $config->get('foo')); $this->assertNull($config->get('baz')); - $this->assertIdentical($config->get('404'), $expected_original_data['404']); + $this->assertIdentical($expected_original_data['404'], $config->get('404')); // Set the value for 'baz' (on the original data). $expected_original_data['baz'] = 'original baz'; @@ -80,14 +80,14 @@ public function testConfOverride() { // Reload it and verify that it still contains overridden data from $config. $config = \Drupal::config('config_test.system'); - $this->assertIdentical($config->get('foo'), $overrides['config_test.system']['foo']); - $this->assertIdentical($config->get('baz'), $overrides['config_test.system']['baz']); - $this->assertIdentical($config->get('404'), $overrides['config_test.system']['404']); + $this->assertIdentical($overrides['config_test.system']['foo'], $config->get('foo')); + $this->assertIdentical($overrides['config_test.system']['baz'], $config->get('baz')); + $this->assertIdentical($overrides['config_test.system']['404'], $config->get('404')); // Verify that raw config data has changed. - $this->assertIdentical($config->getOriginal('foo', FALSE), $expected_original_data['foo']); - $this->assertIdentical($config->getOriginal('baz', FALSE), $expected_original_data['baz']); - $this->assertIdentical($config->getOriginal('404', FALSE), $expected_original_data['404']); + $this->assertIdentical($expected_original_data['foo'], $config->getOriginal('foo', FALSE)); + $this->assertIdentical($expected_original_data['baz'], $config->getOriginal('baz', FALSE)); + $this->assertIdentical($expected_original_data['404'], $config->getOriginal('404', FALSE)); // Write file to sync. $sync = $this->container->get('config.storage.sync'); @@ -103,15 +103,15 @@ public function testConfOverride() { // Verify that the new configuration data exists. Have to read storage // directly otherwise overrides will apply. - $this->assertIdentical($data['foo'], $expected_new_data['foo']); + $this->assertIdentical($expected_new_data['foo'], $data['foo']); $this->assertFalse(isset($data['baz'])); - $this->assertIdentical($data['404'], $expected_new_data['404']); + $this->assertIdentical($expected_new_data['404'], $data['404']); // Verify that the overrides are still working. $config = \Drupal::config('config_test.system'); - $this->assertIdentical($config->get('foo'), $overrides['config_test.system']['foo']); - $this->assertIdentical($config->get('baz'), $overrides['config_test.system']['baz']); - $this->assertIdentical($config->get('404'), $overrides['config_test.system']['404']); + $this->assertIdentical($overrides['config_test.system']['foo'], $config->get('foo')); + $this->assertIdentical($overrides['config_test.system']['baz'], $config->get('baz')); + $this->assertIdentical($overrides['config_test.system']['404'], $config->get('404')); // Test overrides of completely new configuration objects. In normal runtime // this should only happen for configuration entities as we should not be @@ -119,7 +119,7 @@ public function testConfOverride() { $GLOBALS['config']['config_test.new']['key'] = 'override'; $config = \Drupal::config('config_test.new'); $this->assertTrue($config->isNew(), 'The configuration object config_test.new is new'); - $this->assertIdentical($config->get('key'), 'override'); + $this->assertIdentical('override', $config->get('key')); $config_raw = \Drupal::configFactory()->getEditable('config_test.new'); $this->assertNull($config_raw->get('key')); $config_raw @@ -130,10 +130,10 @@ public function testConfOverride() { // accordingly. $config = \Drupal::config('config_test.new'); $this->assertFalse($config->isNew(), 'The configuration object config_test.new is not new'); - $this->assertIdentical($config->get('key'), 'override'); - $this->assertIdentical($config->get('new_key'), 'new_value'); + $this->assertIdentical('override', $config->get('key')); + $this->assertIdentical('new_value', $config->get('new_key')); $raw_data = $config->getRawData(); - $this->assertIdentical($raw_data['key'], 'raw'); + $this->assertIdentical('raw', $raw_data['key']); } } diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigSchemaTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigSchemaTest.php index 2b67d9297e4d..1c739f1919e5 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/ConfigSchemaTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigSchemaTest.php @@ -401,13 +401,13 @@ public function testConfigSaveWithSchema() { $this->config('config_schema_test.schema_data_types') ->setData($untyped_to_typed) ->save(); - $this->assertIdentical($this->config('config_schema_test.schema_data_types')->get(), $typed_values); + $this->assertIdentical($typed_values, $this->config('config_schema_test.schema_data_types')->get()); // Save config which does not have a schema that enforces types. $this->config('config_schema_test.no_schema_data_types') ->setData($untyped_values) ->save(); - $this->assertIdentical($this->config('config_schema_test.no_schema_data_types')->get(), $untyped_values); + $this->assertIdentical($untyped_values, $this->config('config_schema_test.no_schema_data_types')->get()); // Ensure that configuration objects with keys marked as ignored are not // changed when saved. The 'config_schema_test.ignore' will have been saved @@ -417,7 +417,7 @@ public function testConfigSaveWithSchema() { $original_data = $install_storage->read('config_schema_test.ignore'); $installed_data = $this->config('config_schema_test.ignore')->get(); unset($installed_data['_core']); - $this->assertIdentical($installed_data, $original_data); + $this->assertIdentical($original_data, $installed_data); } /** @@ -623,8 +623,7 @@ public function testConfigSaveWithWrappingSchema() { \Drupal::configFactory()->getEditable('wrapping.config_schema_test.plugin_types') ->setData($untyped_values) ->save(); - $this->assertIdentical(\Drupal::config('wrapping.config_schema_test.plugin_types') - ->get(), $typed_values); + $this->assertIdentical($typed_values, \Drupal::config('wrapping.config_schema_test.plugin_types')->get()); } /** @@ -659,8 +658,7 @@ public function testConfigSaveWithWrappingSchemaDoubleBrackets() { \Drupal::configFactory()->getEditable('wrapping.config_schema_test.double_brackets') ->setData($untyped_values) ->save(); - $this->assertIdentical(\Drupal::config('wrapping.config_schema_test.double_brackets') - ->get(), $typed_values); + $this->assertIdentical($typed_values, \Drupal::config('wrapping.config_schema_test.double_brackets')->get()); $tests = \Drupal::service('config.typed')->get('wrapping.config_schema_test.double_brackets')->get('tests')->getElements(); $definition = $tests[0]->getDataDefinition()->toArray(); @@ -693,8 +691,7 @@ public function testConfigSaveWithWrappingSchemaDoubleBrackets() { \Drupal::configFactory()->getEditable('wrapping.config_schema_test.double_brackets') ->setData($untyped_values) ->save(); - $this->assertIdentical(\Drupal::config('wrapping.config_schema_test.double_brackets') - ->get(), $typed_values); + $this->assertIdentical($typed_values, \Drupal::config('wrapping.config_schema_test.double_brackets')->get()); $tests = \Drupal::service('config.typed')->get('wrapping.config_schema_test.double_brackets')->get('tests')->getElements(); $definition = $tests[0]->getDataDefinition()->toArray(); diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigSnapshotTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigSnapshotTest.php index 717b014928eb..457d93420794 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/ConfigSnapshotTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigSnapshotTest.php @@ -76,7 +76,7 @@ public function testSnapshot() { // Verify changed config was properly imported. \Drupal::configFactory()->reset($config_name); - $this->assertIdentical($this->config($config_name)->get($config_key), $new_data); + $this->assertIdentical($new_data, $this->config($config_name)->get($config_key)); // Verify that a new snapshot was created which and that it matches // the active config. diff --git a/core/tests/Drupal/KernelTests/Core/Config/Storage/ConfigStorageTestBase.php b/core/tests/Drupal/KernelTests/Core/Config/Storage/ConfigStorageTestBase.php index 848f4e5c8d49..3cbd235c3273 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/Storage/ConfigStorageTestBase.php +++ b/core/tests/Drupal/KernelTests/Core/Config/Storage/ConfigStorageTestBase.php @@ -49,7 +49,7 @@ public function testCRUD() { $this->assertTrue($result); $raw_data = $this->read($name); - $this->assertIdentical($raw_data, $data); + $this->assertIdentical($data, $raw_data); // Checking whether an existing name exists returns TRUE. $this->assertTrue($this->storage->exists($name)); @@ -72,7 +72,7 @@ public function testCRUD() { $new_name = 'config_test.storage_rename'; $this->storage->rename($name, $new_name); $raw_data = $this->read($new_name); - $this->assertIdentical($raw_data, $data); + $this->assertIdentical($data, $raw_data); // Rename it back so further tests work. $this->storage->rename($new_name, $name); @@ -102,7 +102,7 @@ public function testCRUD() { $result = $this->storage->deleteAll('config_test.'); $names = $this->storage->listAll('config_test.'); $this->assertTrue($result); - $this->assertIdentical($names, []); + $this->assertIdentical([], $names); // Test renaming an object that does not exist returns FALSE. $this->assertFalse($this->storage->rename('config_test.storage_does_not_exist', 'config_test.storage_does_not_exist_rename')); @@ -126,7 +126,7 @@ public function testInvalidStorage() { $this->assertTrue($result); $raw_data = $this->read($name); - $this->assertIdentical($raw_data, $data); + $this->assertIdentical($data, $raw_data); // Reading from a non-existing storage bin returns FALSE. $result = $this->invalidStorage->read($name); @@ -143,7 +143,7 @@ public function testInvalidStorage() { // Listing on a non-existing storage bin returns an empty array. $result = $this->invalidStorage->listAll(); - $this->assertIdentical($result, []); + $this->assertIdentical([], $result); // Getting all collections on a non-existing storage bin return an empty // array. @@ -152,7 +152,7 @@ public function testInvalidStorage() { // Writing to a non-existing storage bin creates the bin. $this->invalidStorage->write($name, ['foo' => 'bar']); $result = $this->invalidStorage->read($name); - $this->assertIdentical($result, ['foo' => 'bar']); + $this->assertIdentical(['foo' => 'bar'], $result); } /** @@ -176,7 +176,7 @@ public function testDataTypes() { $this->assertTrue($result); $read_data = $this->storage->read($name); - $this->assertIdentical($read_data, $data); + $this->assertIdentical($data, $read_data); } /** diff --git a/core/tests/Drupal/KernelTests/Core/Config/Storage/FileStorageTest.php b/core/tests/Drupal/KernelTests/Core/Config/Storage/FileStorageTest.php index 24a10f4f2284..78291de6bf56 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/Storage/FileStorageTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/Storage/FileStorageTest.php @@ -63,7 +63,7 @@ public function testlistAll() { ]; $config_files = $this->storage->listAll(); - $this->assertIdentical($config_files, $expected_files, 'Relative path, two config files found.'); + $this->assertIdentical($expected_files, $config_files, 'Relative path, two config files found.'); // @todo https://www.drupal.org/node/2666954 FileStorage::listAll() is // case-sensitive. However, \Drupal\Core\Config\DatabaseStorage::listAll() diff --git a/core/tests/Drupal/KernelTests/Core/Database/BasicSyntaxTest.php b/core/tests/Drupal/KernelTests/Core/Database/BasicSyntaxTest.php index 6d06d5bf9f4b..0bfc17977684 100644 --- a/core/tests/Drupal/KernelTests/Core/Database/BasicSyntaxTest.php +++ b/core/tests/Drupal/KernelTests/Core/Database/BasicSyntaxTest.php @@ -24,7 +24,7 @@ public function testConcatLiterals() { ':a4' => ' a ', ':a5' => 'test.', ]); - $this->assertIdentical($result->fetchField(), 'This is a test.', 'Basic CONCAT works.'); + $this->assertIdentical('This is a test.', $result->fetchField(), 'Basic CONCAT works.'); } /** @@ -57,7 +57,7 @@ public function testConcatWsLiterals() { ':a3' => '', ':a4' => 'world.', ]); - $this->assertIdentical($result->fetchField(), 'Hello, , world.'); + $this->assertIdentical('Hello, , world.', $result->fetchField()); } /** @@ -69,7 +69,7 @@ public function testConcatWsFields() { ':a2' => 'age', ':age' => 25, ]); - $this->assertIdentical($result->fetchField(), 'name-John-age-25'); + $this->assertIdentical('name-John-age-25', $result->fetchField()); } /** @@ -88,14 +88,14 @@ public function testLikeEscape() { ->countQuery() ->execute() ->fetchField(); - $this->assertIdentical($num_matches, '2', 'Found 2 records.'); + $this->assertIdentical('2', $num_matches, 'Found 2 records.'); // Match only "Ring_" using a LIKE expression with no wildcards. $num_matches = $this->connection->select('test', 't') ->condition('name', $this->connection->escapeLike('Ring_'), 'LIKE') ->countQuery() ->execute() ->fetchField(); - $this->assertIdentical($num_matches, '1', 'Found 1 record.'); + $this->assertIdentical('1', $num_matches, 'Found 1 record.'); } /** @@ -119,14 +119,14 @@ public function testLikeBackslash() { ->countQuery() ->execute() ->fetchField(); - $this->assertIdentical($num_matches, '2', 'Found 2 records.'); + $this->assertIdentical('2', $num_matches, 'Found 2 records.'); // Match only the former using a LIKE expression with no wildcards. $num_matches = $this->connection->select('test', 't') ->condition('name', $this->connection->escapeLike('abc%\_'), 'LIKE') ->countQuery() ->execute() ->fetchField(); - $this->assertIdentical($num_matches, '1', 'Found 1 record.'); + $this->assertIdentical('1', $num_matches, 'Found 1 record.'); } /** @@ -138,7 +138,7 @@ public function testGetFullQualifiedTableName() { ->countQuery() ->execute() ->fetchField(); - $this->assertIdentical($num_matches, '4', 'Found 4 records.'); + $this->assertIdentical('4', $num_matches, 'Found 4 records.'); } /** diff --git a/core/tests/Drupal/KernelTests/Core/Database/CaseSensitivityTest.php b/core/tests/Drupal/KernelTests/Core/Database/CaseSensitivityTest.php index a018c54c0c02..bb48fb5c8375 100644 --- a/core/tests/Drupal/KernelTests/Core/Database/CaseSensitivityTest.php +++ b/core/tests/Drupal/KernelTests/Core/Database/CaseSensitivityTest.php @@ -27,7 +27,7 @@ public function testCaseSensitiveInsert() { $num_records_after = $this->connection->query('SELECT COUNT(*) FROM {test}')->fetchField(); $this->assertSame($num_records_before + 1, (int) $num_records_after, 'Record inserts correctly.'); $saved_age = $this->connection->query('SELECT [age] FROM {test} WHERE [name] = :name', [':name' => 'john'])->fetchField(); - $this->assertIdentical($saved_age, '2', 'Can retrieve after inserting.'); + $this->assertIdentical('2', $saved_age, 'Can retrieve after inserting.'); } } diff --git a/core/tests/Drupal/KernelTests/Core/Database/ConnectionTest.php b/core/tests/Drupal/KernelTests/Core/Database/ConnectionTest.php index cbbfeffc378b..356dd350b3a7 100644 --- a/core/tests/Drupal/KernelTests/Core/Database/ConnectionTest.php +++ b/core/tests/Drupal/KernelTests/Core/Database/ConnectionTest.php @@ -106,7 +106,7 @@ public function testConnectionOptions() { // Get a fresh copy of the default connection options. $connectionOptions = $db->getConnectionOptions(); - $this->assertIdentical($connectionOptions, $connectionOptions2, 'The default and replica connection options are identical.'); + $this->assertIdentical($connectionOptions2, $connectionOptions, 'The default and replica connection options are identical.'); // Set up a new connection with different connection info. $test = $connection_info['default']; diff --git a/core/tests/Drupal/KernelTests/Core/Database/DeleteTruncateTest.php b/core/tests/Drupal/KernelTests/Core/Database/DeleteTruncateTest.php index 0ae0ddc9faa0..7390b9a45b0e 100644 --- a/core/tests/Drupal/KernelTests/Core/Database/DeleteTruncateTest.php +++ b/core/tests/Drupal/KernelTests/Core/Database/DeleteTruncateTest.php @@ -47,7 +47,7 @@ public function testSimpleDelete() { $num_deleted = $this->connection->delete('test') ->condition('id', 1) ->execute(); - $this->assertIdentical($num_deleted, 1, 'Deleted 1 record.'); + $this->assertIdentical(1, $num_deleted, 'Deleted 1 record.'); $num_records_after = $this->connection->query('SELECT COUNT(*) FROM {test}')->fetchField(); $this->assertEqual($num_records_before, $num_records_after + $num_deleted, 'Deletion adds up.'); diff --git a/core/tests/Drupal/KernelTests/Core/Database/FetchTest.php b/core/tests/Drupal/KernelTests/Core/Database/FetchTest.php index 9299e79a011d..5abb55d0f285 100644 --- a/core/tests/Drupal/KernelTests/Core/Database/FetchTest.php +++ b/core/tests/Drupal/KernelTests/Core/Database/FetchTest.php @@ -174,7 +174,7 @@ public function testQueryFetchCol() { $result = $this->connection->query('SELECT [name] FROM {test} WHERE [age] > :age', [':age' => 25]); $i = 0; foreach ($result as $record) { - $this->assertIdentical($record->name, $column[$i++], 'Column matches direct access.'); + $this->assertIdentical($column[$i++], $record->name, 'Column matches direct access.'); } } diff --git a/core/tests/Drupal/KernelTests/Core/Database/InsertTest.php b/core/tests/Drupal/KernelTests/Core/Database/InsertTest.php index 45a2f5de0dea..aedbf2701f65 100644 --- a/core/tests/Drupal/KernelTests/Core/Database/InsertTest.php +++ b/core/tests/Drupal/KernelTests/Core/Database/InsertTest.php @@ -24,13 +24,13 @@ public function testSimpleInsert() { ]); // Check how many records are queued for insertion. - $this->assertIdentical($query->count(), 1, 'One record is queued for insertion.'); + $this->assertIdentical(1, $query->count(), 'One record is queued for insertion.'); $query->execute(); $num_records_after = $this->connection->query('SELECT COUNT(*) FROM {test}')->fetchField(); $this->assertSame($num_records_before + 1, (int) $num_records_after, 'Record inserts correctly.'); $saved_age = $this->connection->query('SELECT [age] FROM {test} WHERE [name] = :name', [':name' => 'Yoko'])->fetchField(); - $this->assertIdentical($saved_age, '29', 'Can retrieve after inserting.'); + $this->assertIdentical('29', $saved_age, 'Can retrieve after inserting.'); } /** @@ -52,24 +52,24 @@ public function testMultiInsert() { ]); // Check how many records are queued for insertion. - $this->assertIdentical($query->count(), 2, 'Two records are queued for insertion.'); + $this->assertIdentical(2, $query->count(), 'Two records are queued for insertion.'); // We should be able to say "use the field order". // This is not the recommended mechanism for most cases, but it should work. $query->values(['Moe', '32']); // Check how many records are queued for insertion. - $this->assertIdentical($query->count(), 3, 'Three records are queued for insertion.'); + $this->assertIdentical(3, $query->count(), 'Three records are queued for insertion.'); $query->execute(); $num_records_after = (int) $this->connection->query('SELECT COUNT(*) FROM {test}')->fetchField(); $this->assertSame($num_records_before + 3, $num_records_after, 'Record inserts correctly.'); $saved_age = $this->connection->query('SELECT [age] FROM {test} WHERE [name] = :name', [':name' => 'Larry'])->fetchField(); - $this->assertIdentical($saved_age, '30', 'Can retrieve after inserting.'); + $this->assertIdentical('30', $saved_age, 'Can retrieve after inserting.'); $saved_age = $this->connection->query('SELECT [age] FROM {test} WHERE [name] = :name', [':name' => 'Curly'])->fetchField(); - $this->assertIdentical($saved_age, '31', 'Can retrieve after inserting.'); + $this->assertIdentical('31', $saved_age, 'Can retrieve after inserting.'); $saved_age = $this->connection->query('SELECT [age] FROM {test} WHERE [name] = :name', [':name' => 'Moe'])->fetchField(); - $this->assertIdentical($saved_age, '32', 'Can retrieve after inserting.'); + $this->assertIdentical('32', $saved_age, 'Can retrieve after inserting.'); } /** @@ -85,7 +85,7 @@ public function testRepeatedInsert() { 'age' => '30', ]); // Check how many records are queued for insertion. - $this->assertIdentical($query->count(), 1, 'One record is queued for insertion.'); + $this->assertIdentical(1, $query->count(), 'One record is queued for insertion.'); // This should run the insert, but leave the fields intact. $query->execute(); @@ -95,24 +95,24 @@ public function testRepeatedInsert() { 'name' => 'Curly', ]); // Check how many records are queued for insertion. - $this->assertIdentical($query->count(), 1, 'One record is queued for insertion.'); + $this->assertIdentical(1, $query->count(), 'One record is queued for insertion.'); $query->execute(); // We should be able to say "use the field order". $query->values(['Moe', '32']); // Check how many records are queued for insertion. - $this->assertIdentical($query->count(), 1, 'One record is queued for insertion.'); + $this->assertIdentical(1, $query->count(), 'One record is queued for insertion.'); $query->execute(); $num_records_after = $this->connection->query('SELECT COUNT(*) FROM {test}')->fetchField(); $this->assertSame((int) $num_records_before + 3, (int) $num_records_after, 'Record inserts correctly.'); $saved_age = $this->connection->query('SELECT [age] FROM {test} WHERE [name] = :name', [':name' => 'Larry'])->fetchField(); - $this->assertIdentical($saved_age, '30', 'Can retrieve after inserting.'); + $this->assertIdentical('30', $saved_age, 'Can retrieve after inserting.'); $saved_age = $this->connection->query('SELECT [age] FROM {test} WHERE [name] = :name', [':name' => 'Curly'])->fetchField(); - $this->assertIdentical($saved_age, '31', 'Can retrieve after inserting.'); + $this->assertIdentical('31', $saved_age, 'Can retrieve after inserting.'); $saved_age = $this->connection->query('SELECT [age] FROM {test} WHERE [name] = :name', [':name' => 'Moe'])->fetchField(); - $this->assertIdentical($saved_age, '32', 'Can retrieve after inserting.'); + $this->assertIdentical('32', $saved_age, 'Can retrieve after inserting.'); } /** @@ -128,11 +128,11 @@ public function testInsertFieldOnlyDefinition() { ->values(['Moe', '32']) ->execute(); $saved_age = $this->connection->query('SELECT [age] FROM {test} WHERE [name] = :name', [':name' => 'Larry'])->fetchField(); - $this->assertIdentical($saved_age, '30', 'Can retrieve after inserting.'); + $this->assertIdentical('30', $saved_age, 'Can retrieve after inserting.'); $saved_age = $this->connection->query('SELECT [age] FROM {test} WHERE [name] = :name', [':name' => 'Curly'])->fetchField(); - $this->assertIdentical($saved_age, '31', 'Can retrieve after inserting.'); + $this->assertIdentical('31', $saved_age, 'Can retrieve after inserting.'); $saved_age = $this->connection->query('SELECT [age] FROM {test} WHERE [name] = :name', [':name' => 'Moe'])->fetchField(); - $this->assertIdentical($saved_age, '32', 'Can retrieve after inserting.'); + $this->assertIdentical('32', $saved_age, 'Can retrieve after inserting.'); } /** @@ -146,7 +146,7 @@ public function testInsertLastInsertID() { ]) ->execute(); - $this->assertIdentical($id, '5', 'Auto-increment ID returned successfully.'); + $this->assertIdentical('5', $id, 'Auto-increment ID returned successfully.'); } /** @@ -172,7 +172,7 @@ public function testInsertSelectFields() { ->execute(); $saved_age = $this->connection->query('SELECT [age] FROM {test} WHERE [name] = :name', [':name' => 'Meredith'])->fetchField(); - $this->assertIdentical($saved_age, '30', 'Can retrieve after inserting.'); + $this->assertIdentical('30', $saved_age, 'Can retrieve after inserting.'); } /** @@ -193,7 +193,7 @@ public function testInsertSelectAll() { ->execute(); $saved_age = $this->connection->query('SELECT [age] FROM {test_people_copy} WHERE [name] = :name', [':name' => 'Meredith'])->fetchField(); - $this->assertIdentical($saved_age, '30', 'Can retrieve after inserting.'); + $this->assertIdentical('30', $saved_age, 'Can retrieve after inserting.'); } /** diff --git a/core/tests/Drupal/KernelTests/Core/Database/SchemaTest.php b/core/tests/Drupal/KernelTests/Core/Database/SchemaTest.php index f97fb6d9e7ce..0173f37fd432 100644 --- a/core/tests/Drupal/KernelTests/Core/Database/SchemaTest.php +++ b/core/tests/Drupal/KernelTests/Core/Database/SchemaTest.php @@ -1046,7 +1046,7 @@ protected function assertFieldChange($old_spec, $new_spec, $test_data = NULL) { ->condition('serial_column', $id) ->execute() ->fetchField(); - $this->assertIdentical($field_value, $test_data); + $this->assertIdentical($test_data, $field_value); } // Check the field was changed. diff --git a/core/tests/Drupal/KernelTests/Core/Database/TransactionTest.php b/core/tests/Drupal/KernelTests/Core/Database/TransactionTest.php index c6efaef589f4..396dc1cc3774 100644 --- a/core/tests/Drupal/KernelTests/Core/Database/TransactionTest.php +++ b/core/tests/Drupal/KernelTests/Core/Database/TransactionTest.php @@ -174,9 +174,9 @@ public function testCommittedTransaction() { // Because we committed, both of the inserted rows should be present. $saved_age = $this->connection->query('SELECT [age] FROM {test} WHERE [name] = :name', [':name' => 'DavidA'])->fetchField(); - $this->assertIdentical($saved_age, '24', 'Can retrieve DavidA row after commit.'); + $this->assertIdentical('24', $saved_age, 'Can retrieve DavidA row after commit.'); $saved_age = $this->connection->query('SELECT [age] FROM {test} WHERE [name] = :name', [':name' => 'DanielA'])->fetchField(); - $this->assertIdentical($saved_age, '19', 'Can retrieve DanielA row after commit.'); + $this->assertIdentical('19', $saved_age, 'Can retrieve DanielA row after commit.'); } catch (\Exception $e) { $this->fail($e->getMessage()); diff --git a/core/tests/Drupal/KernelTests/Core/Database/UpdateComplexTest.php b/core/tests/Drupal/KernelTests/Core/Database/UpdateComplexTest.php index 9911fea0046b..acbfef821d12 100644 --- a/core/tests/Drupal/KernelTests/Core/Database/UpdateComplexTest.php +++ b/core/tests/Drupal/KernelTests/Core/Database/UpdateComplexTest.php @@ -20,10 +20,10 @@ public function testOrConditionUpdate() { ->condition('name', 'Paul') ); $num_updated = $update->execute(); - $this->assertIdentical($num_updated, 2, 'Updated 2 records.'); + $this->assertIdentical(2, $num_updated, 'Updated 2 records.'); $num_matches = $this->connection->query('SELECT COUNT(*) FROM {test} WHERE [job] = :job', [':job' => 'Musician'])->fetchField(); - $this->assertIdentical($num_matches, '2', 'Updated fields successfully.'); + $this->assertIdentical('2', $num_matches, 'Updated fields successfully.'); } /** @@ -34,10 +34,10 @@ public function testInConditionUpdate() { ->fields(['job' => 'Musician']) ->condition('name', ['John', 'Paul'], 'IN') ->execute(); - $this->assertIdentical($num_updated, 2, 'Updated 2 records.'); + $this->assertIdentical(2, $num_updated, 'Updated 2 records.'); $num_matches = $this->connection->query('SELECT COUNT(*) FROM {test} WHERE [job] = :job', [':job' => 'Musician'])->fetchField(); - $this->assertIdentical($num_matches, '2', 'Updated fields successfully.'); + $this->assertIdentical('2', $num_matches, 'Updated fields successfully.'); } /** @@ -50,10 +50,10 @@ public function testNotInConditionUpdate() { ->fields(['job' => 'Musician']) ->condition('name', ['John', 'Paul', 'George'], 'NoT IN') ->execute(); - $this->assertIdentical($num_updated, 1, 'Updated 1 record.'); + $this->assertIdentical(1, $num_updated, 'Updated 1 record.'); $num_matches = $this->connection->query('SELECT COUNT(*) FROM {test} WHERE [job] = :job', [':job' => 'Musician'])->fetchField(); - $this->assertIdentical($num_matches, '1', 'Updated fields successfully.'); + $this->assertIdentical('1', $num_matches, 'Updated fields successfully.'); } /** @@ -64,10 +64,10 @@ public function testBetweenConditionUpdate() { ->fields(['job' => 'Musician']) ->condition('age', [25, 26], 'BETWEEN') ->execute(); - $this->assertIdentical($num_updated, 2, 'Updated 2 records.'); + $this->assertIdentical(2, $num_updated, 'Updated 2 records.'); $num_matches = $this->connection->query('SELECT COUNT(*) FROM {test} WHERE [job] = :job', [':job' => 'Musician'])->fetchField(); - $this->assertIdentical($num_matches, '2', 'Updated fields successfully.'); + $this->assertIdentical('2', $num_matches, 'Updated fields successfully.'); } /** @@ -78,10 +78,10 @@ public function testLikeConditionUpdate() { ->fields(['job' => 'Musician']) ->condition('name', '%ge%', 'LIKE') ->execute(); - $this->assertIdentical($num_updated, 1, 'Updated 1 record.'); + $this->assertIdentical(1, $num_updated, 'Updated 1 record.'); $num_matches = $this->connection->query('SELECT COUNT(*) FROM {test} WHERE [job] = :job', [':job' => 'Musician'])->fetchField(); - $this->assertIdentical($num_matches, '1', 'Updated fields successfully.'); + $this->assertIdentical('1', $num_matches, 'Updated fields successfully.'); } /** @@ -94,10 +94,10 @@ public function testUpdateExpression() { ->fields(['job' => 'Musician']) ->expression('age', '[age] + :age', [':age' => 4]) ->execute(); - $this->assertIdentical($num_updated, 1, 'Updated 1 record.'); + $this->assertIdentical(1, $num_updated, 'Updated 1 record.'); $num_matches = $this->connection->query('SELECT COUNT(*) FROM {test} WHERE [job] = :job', [':job' => 'Musician'])->fetchField(); - $this->assertIdentical($num_matches, '1', 'Updated fields successfully.'); + $this->assertIdentical('1', $num_matches, 'Updated fields successfully.'); $person = $this->connection->query('SELECT * FROM {test} WHERE [name] = :name', [':name' => 'Ringo'])->fetch(); $this->assertEqual($person->name, 'Ringo', 'Name set correctly.'); @@ -114,7 +114,7 @@ public function testUpdateOnlyExpression() { ->condition('name', 'Ringo') ->expression('age', '[age] + :age', [':age' => 4]) ->execute(); - $this->assertIdentical($num_updated, 1, 'Updated 1 record.'); + $this->assertIdentical(1, $num_updated, 'Updated 1 record.'); $after_age = $this->connection->query('SELECT [age] FROM {test} WHERE [name] = :name', [':name' => 'Ringo'])->fetchField(); $this->assertEqual($before_age + 4, $after_age, 'Age updated correctly'); diff --git a/core/tests/Drupal/KernelTests/Core/Database/UpdateTest.php b/core/tests/Drupal/KernelTests/Core/Database/UpdateTest.php index f8f564d96c55..60e7308180c1 100644 --- a/core/tests/Drupal/KernelTests/Core/Database/UpdateTest.php +++ b/core/tests/Drupal/KernelTests/Core/Database/UpdateTest.php @@ -17,10 +17,10 @@ public function testSimpleUpdate() { ->fields(['name' => 'Tiffany']) ->condition('id', 1) ->execute(); - $this->assertIdentical($num_updated, 1, 'Updated 1 record.'); + $this->assertIdentical(1, $num_updated, 'Updated 1 record.'); $saved_name = $this->connection->query('SELECT [name] FROM {test} WHERE [id] = :id', [':id' => 1])->fetchField(); - $this->assertIdentical($saved_name, 'Tiffany', 'Updated name successfully.'); + $this->assertIdentical('Tiffany', $saved_name, 'Updated name successfully.'); } /** @@ -32,7 +32,7 @@ public function testSimpleNullUpdate() { ->fields(['age' => NULL]) ->condition('name', 'Kermit') ->execute(); - $this->assertIdentical($num_updated, 1, 'Updated 1 record.'); + $this->assertIdentical(1, $num_updated, 'Updated 1 record.'); $saved_age = $this->connection->query('SELECT [age] FROM {test_null} WHERE [name] = :name', [':name' => 'Kermit'])->fetchField(); $this->assertNull($saved_age, 'Updated name successfully.'); @@ -46,10 +46,10 @@ public function testMultiUpdate() { ->fields(['job' => 'Musician']) ->condition('job', 'Singer') ->execute(); - $this->assertIdentical($num_updated, 2, 'Updated 2 records.'); + $this->assertIdentical(2, $num_updated, 'Updated 2 records.'); $num_matches = $this->connection->query('SELECT COUNT(*) FROM {test} WHERE [job] = :job', [':job' => 'Musician'])->fetchField(); - $this->assertIdentical($num_matches, '2', 'Updated fields successfully.'); + $this->assertIdentical('2', $num_matches, 'Updated fields successfully.'); } /** @@ -60,10 +60,10 @@ public function testMultiGTUpdate() { ->fields(['job' => 'Musician']) ->condition('age', 26, '>') ->execute(); - $this->assertIdentical($num_updated, 2, 'Updated 2 records.'); + $this->assertIdentical(2, $num_updated, 'Updated 2 records.'); $num_matches = $this->connection->query('SELECT COUNT(*) FROM {test} WHERE [job] = :job', [':job' => 'Musician'])->fetchField(); - $this->assertIdentical($num_matches, '2', 'Updated fields successfully.'); + $this->assertIdentical('2', $num_matches, 'Updated fields successfully.'); } /** @@ -74,10 +74,10 @@ public function testWhereUpdate() { ->fields(['job' => 'Musician']) ->where('[age] > :age', [':age' => 26]) ->execute(); - $this->assertIdentical($num_updated, 2, 'Updated 2 records.'); + $this->assertIdentical(2, $num_updated, 'Updated 2 records.'); $num_matches = $this->connection->query('SELECT COUNT(*) FROM {test} WHERE [job] = :job', [':job' => 'Musician'])->fetchField(); - $this->assertIdentical($num_matches, '2', 'Updated fields successfully.'); + $this->assertIdentical('2', $num_matches, 'Updated fields successfully.'); } /** @@ -89,10 +89,10 @@ public function testWhereAndConditionUpdate() { ->where('[age] > :age', [':age' => 26]) ->condition('name', 'Ringo'); $num_updated = $update->execute(); - $this->assertIdentical($num_updated, 1, 'Updated 1 record.'); + $this->assertIdentical(1, $num_updated, 'Updated 1 record.'); $num_matches = $this->connection->query('SELECT COUNT(*) FROM {test} WHERE [job] = :job', [':job' => 'Musician'])->fetchField(); - $this->assertIdentical($num_matches, '1', 'Updated fields successfully.'); + $this->assertIdentical('1', $num_matches, 'Updated fields successfully.'); } /** @@ -104,10 +104,10 @@ public function testExpressionUpdate() { $num_rows = $this->connection->update('test') ->expression('age', '[age] * [age]') ->execute(); - $this->assertIdentical($num_rows, 4, 'Updated 4 records.'); + $this->assertIdentical(4, $num_rows, 'Updated 4 records.'); $saved_name = $this->connection->query('SELECT [name] FROM {test} WHERE [age] = :age', [':age' => pow(26, 2)])->fetchField(); - $this->assertIdentical($saved_name, 'Paul', 'Successfully updated values using an algebraic expression.'); + $this->assertIdentical('Paul', $saved_name, 'Successfully updated values using an algebraic expression.'); } /** @@ -124,7 +124,7 @@ public function testUpdateAffectedRows() { ->condition('priority', 1, '<>') ->fields(['task' => 'sleep']) ->execute(); - $this->assertIdentical($num_rows, 5, 'Correctly returned 5 affected rows.'); + $this->assertIdentical(5, $num_rows, 'Correctly returned 5 affected rows.'); } /** @@ -137,7 +137,7 @@ public function testSpecialColumnUpdate() { ]) ->condition('id', 1) ->execute(); - $this->assertIdentical($num_updated, 1, 'Updated 1 special column record.'); + $this->assertIdentical(1, $num_updated, 'Updated 1 special column record.'); $saved_value = $this->connection->query('SELECT [update] FROM {select} WHERE [id] = :id', [':id' => 1])->fetchField(); $this->assertEquals('New update value', $saved_value); diff --git a/core/tests/Drupal/KernelTests/Core/DrupalKernel/DrupalKernelSiteTest.php b/core/tests/Drupal/KernelTests/Core/DrupalKernel/DrupalKernelSiteTest.php index deea2a91bf8e..09e30ad30762 100644 --- a/core/tests/Drupal/KernelTests/Core/DrupalKernel/DrupalKernelSiteTest.php +++ b/core/tests/Drupal/KernelTests/Core/DrupalKernel/DrupalKernelSiteTest.php @@ -23,7 +23,7 @@ public function testServicesYml() { // A service provider class always has precedence over services.yml files. // KernelTestBase::buildContainer() swaps out many services with in-memory // implementations already, so those cannot be tested. - $this->assertIdentical(get_class($this->container->get('cache.backend.database')), 'Drupal\Core\Cache\DatabaseBackendFactory'); + $this->assertIdentical('Drupal\\Core\\Cache\\DatabaseBackendFactory', get_class($this->container->get('cache.backend.database'))); $class = __CLASS__; $doc = <<<EOD @@ -41,7 +41,7 @@ class: Drupal\Core\Cache\MemoryBackendFactory $this->container->get('kernel')->rebuildContainer(); $this->assertTrue($this->container->has('site.service.yml')); - $this->assertIdentical(get_class($this->container->get('cache.backend.database')), 'Drupal\Core\Cache\MemoryBackendFactory'); + $this->assertIdentical('Drupal\\Core\\Cache\\MemoryBackendFactory', get_class($this->container->get('cache.backend.database'))); } } diff --git a/core/tests/Drupal/KernelTests/Core/Entity/ConfigEntityQueryTest.php b/core/tests/Drupal/KernelTests/Core/Entity/ConfigEntityQueryTest.php index ca15bae85286..140f90940191 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/ConfigEntityQueryTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/ConfigEntityQueryTest.php @@ -446,7 +446,7 @@ public function testCount() { ->condition($and_condition_2) ->count() ->execute(); - $this->assertIdentical($count, 2); + $this->assertIdentical(2, $count); } /** @@ -457,52 +457,52 @@ public function testSortRange() { $this->queryResults = $this->entityStorage->getQuery() ->sort('number', 'DESC') ->execute(); - $this->assertIdentical(array_values($this->queryResults), ['7', '3', '5', '2', '1', '4', '6']); + $this->assertIdentical(['7', '3', '5', '2', '1', '4', '6'], array_values($this->queryResults)); $this->queryResults = $this->entityStorage->getQuery() ->sort('number', 'ASC') ->execute(); - $this->assertIdentical(array_values($this->queryResults), ['6', '4', '1', '2', '5', '3', '7']); + $this->assertIdentical(['6', '4', '1', '2', '5', '3', '7'], array_values($this->queryResults)); // Apply some filters and sort. $this->queryResults = $this->entityStorage->getQuery() ->condition('id', '3', '>') ->sort('number', 'DESC') ->execute(); - $this->assertIdentical(array_values($this->queryResults), ['7', '5', '4', '6']); + $this->assertIdentical(['7', '5', '4', '6'], array_values($this->queryResults)); $this->queryResults = $this->entityStorage->getQuery() ->condition('id', '3', '>') ->sort('number', 'ASC') ->execute(); - $this->assertIdentical(array_values($this->queryResults), ['6', '4', '5', '7']); + $this->assertIdentical(['6', '4', '5', '7'], array_values($this->queryResults)); // Apply a pager and sort. $this->queryResults = $this->entityStorage->getQuery() ->sort('number', 'DESC') ->range('2', '2') ->execute(); - $this->assertIdentical(array_values($this->queryResults), ['5', '2']); + $this->assertIdentical(['5', '2'], array_values($this->queryResults)); $this->queryResults = $this->entityStorage->getQuery() ->sort('number', 'ASC') ->range('2', '2') ->execute(); - $this->assertIdentical(array_values($this->queryResults), ['1', '2']); + $this->assertIdentical(['1', '2'], array_values($this->queryResults)); // Add a range to a query without a start parameter. $this->queryResults = $this->entityStorage->getQuery() ->range(0, '3') ->sort('id', 'ASC') ->execute(); - $this->assertIdentical(array_values($this->queryResults), ['1', '2', '3']); + $this->assertIdentical(['1', '2', '3'], array_values($this->queryResults)); // Apply a pager with limit 4. $this->queryResults = $this->entityStorage->getQuery() ->pager('4', 0) ->sort('id', 'ASC') ->execute(); - $this->assertIdentical(array_values($this->queryResults), ['1', '2', '3', '4']); + $this->assertIdentical(['1', '2', '3', '4'], array_values($this->queryResults)); } /** @@ -520,28 +520,28 @@ public function testTableSort() { ->tableSort($header) ->sort('id', 'DESC') ->execute(); - $this->assertIdentical(array_values($this->queryResults), ['7', '6', '5', '4', '3', '2', '1']); + $this->assertIdentical(['7', '6', '5', '4', '3', '2', '1'], array_values($this->queryResults)); // Sorting with 'ASC' upper case $this->queryResults = $this->entityStorage->getQuery() ->tableSort($header) ->sort('id', 'ASC') ->execute(); - $this->assertIdentical(array_values($this->queryResults), ['1', '2', '3', '4', '5', '6', '7']); + $this->assertIdentical(['1', '2', '3', '4', '5', '6', '7'], array_values($this->queryResults)); // Sorting with 'desc' lower case $this->queryResults = $this->entityStorage->getQuery() ->tableSort($header) ->sort('id', 'desc') ->execute(); - $this->assertIdentical(array_values($this->queryResults), ['7', '6', '5', '4', '3', '2', '1']); + $this->assertIdentical(['7', '6', '5', '4', '3', '2', '1'], array_values($this->queryResults)); // Sorting with 'asc' lower case $this->queryResults = $this->entityStorage->getQuery() ->tableSort($header) ->sort('id', 'asc') ->execute(); - $this->assertIdentical(array_values($this->queryResults), ['1', '2', '3', '4', '5', '6', '7']); + $this->assertIdentical(['1', '2', '3', '4', '5', '6', '7'], array_values($this->queryResults)); // Sort key: number // Sorting with 'DeSc' mixed upper and lower case @@ -549,28 +549,28 @@ public function testTableSort() { ->tableSort($header) ->sort('number', 'DeSc') ->execute(); - $this->assertIdentical(array_values($this->queryResults), ['7', '3', '5', '2', '1', '4', '6']); + $this->assertIdentical(['7', '3', '5', '2', '1', '4', '6'], array_values($this->queryResults)); // Sorting with 'AsC' mixed upper and lower case $this->queryResults = $this->entityStorage->getQuery() ->tableSort($header) ->sort('number', 'AsC') ->execute(); - $this->assertIdentical(array_values($this->queryResults), ['6', '4', '1', '2', '5', '3', '7']); + $this->assertIdentical(['6', '4', '1', '2', '5', '3', '7'], array_values($this->queryResults)); // Sorting with 'dEsC' mixed upper and lower case $this->queryResults = $this->entityStorage->getQuery() ->tableSort($header) ->sort('number', 'dEsC') ->execute(); - $this->assertIdentical(array_values($this->queryResults), ['7', '3', '5', '2', '1', '4', '6']); + $this->assertIdentical(['7', '3', '5', '2', '1', '4', '6'], array_values($this->queryResults)); // Sorting with 'aSc' mixed upper and lower case $this->queryResults = $this->entityStorage->getQuery() ->tableSort($header) ->sort('number', 'aSc') ->execute(); - $this->assertIdentical(array_values($this->queryResults), ['6', '4', '1', '2', '5', '3', '7']); + $this->assertIdentical(['6', '4', '1', '2', '5', '3', '7'], array_values($this->queryResults)); } /** @@ -732,7 +732,7 @@ protected function assertResults($expected) { $this->assertCount($expected_count, $this->queryResults); foreach ($expected as $value) { // This also tests whether $this->queryResults[$value] is even set at all. - $this->assertIdentical($this->queryResults[$value], $value); + $this->assertIdentical($value, $this->queryResults[$value]); } } diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityAccessControlHandlerTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityAccessControlHandlerTest.php index 397fce77d32d..595f32449990 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityAccessControlHandlerTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityAccessControlHandlerTest.php @@ -285,10 +285,7 @@ public function testHooks() { // Test hook_entity_create_access() and hook_ENTITY_TYPE_create_access(). $entity->access('create'); $this->assertEqual($state->get('entity_test_entity_create_access'), TRUE); - $this->assertIdentical($state->get('entity_test_entity_create_access_context'), [ - 'entity_type_id' => 'entity_test', - 'langcode' => LanguageInterface::LANGCODE_DEFAULT, - ]); + $this->assertIdentical(['entity_type_id' => 'entity_test', 'langcode' => LanguageInterface::LANGCODE_DEFAULT], $state->get('entity_test_entity_create_access_context')); $this->assertEqual($state->get('entity_test_entity_test_create_access'), TRUE); // Test hook_entity_access() and hook_ENTITY_TYPE_access(). diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityAutocompleteTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityAutocompleteTest.php index af2f11b1ef58..f5d3e73c50af 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityAutocompleteTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityAutocompleteTest.php @@ -58,8 +58,8 @@ public function testEntityReferenceAutocompletion() { // We should get both entities in a JSON encoded string. $input = '10/'; $data = $this->getAutocompleteResult($input); - $this->assertIdentical($data[0]['label'], Html::escape($entity_1->name->value), 'Autocomplete returned the first matching entity'); - $this->assertIdentical($data[1]['label'], Html::escape($entity_2->name->value), 'Autocomplete returned the second matching entity'); + $this->assertIdentical(Html::escape($entity_1->name->value), $data[0]['label'], 'Autocomplete returned the first matching entity'); + $this->assertIdentical(Html::escape($entity_2->name->value), $data[1]['label'], 'Autocomplete returned the second matching entity'); // Try to autocomplete an entity label that matches the first entity. // We should only get the first entity in a JSON encoded string. @@ -69,13 +69,13 @@ public function testEntityReferenceAutocompletion() { 'value' => $entity_1->name->value . ' (1)', 'label' => Html::escape($entity_1->name->value), ]; - $this->assertIdentical(reset($data), $target, 'Autocomplete returns only the expected matching entity.'); + $this->assertIdentical($target, reset($data), 'Autocomplete returns only the expected matching entity.'); // Try to autocomplete an entity label that matches the second entity, and // the first entity is already typed in the autocomplete (tags) widget. $input = $entity_1->name->value . ' (1), 10/17'; $data = $this->getAutocompleteResult($input); - $this->assertIdentical($data[0]['label'], Html::escape($entity_2->name->value), 'Autocomplete returned the second matching entity'); + $this->assertIdentical(Html::escape($entity_2->name->value), $data[0]['label'], 'Autocomplete returned the second matching entity'); // Try to autocomplete an entity label with both comma, slash and markup. $input = '"label with, and /"'; @@ -87,7 +87,7 @@ public function testEntityReferenceAutocompletion() { 'value' => $n, 'label' => Html::escape($entity_3->name->value), ]; - $this->assertIdentical(reset($data), $target, 'Autocomplete returns an entity label containing a comma and a slash.'); + $this->assertIdentical($target, reset($data), 'Autocomplete returns an entity label containing a comma and a slash.'); } /** diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityDefinitionUpdateTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityDefinitionUpdateTest.php index 2c019acc66db..1538eef8d3a1 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityDefinitionUpdateTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityDefinitionUpdateTest.php @@ -100,8 +100,8 @@ public function testNewEntityType() { public function testNoUpdates() { // Ensure that the definition update manager reports no updates. $this->assertFalse($this->entityDefinitionUpdateManager->needsUpdates(), 'EntityDefinitionUpdateManager reports that no updates are needed.'); - $this->assertIdentical($this->entityDefinitionUpdateManager->getChangeSummary(), [], 'EntityDefinitionUpdateManager reports an empty change summary.'); - $this->assertIdentical($this->entityDefinitionUpdateManager->getChangeList(), [], 'EntityDefinitionUpdateManager reports an empty change list.'); + $this->assertIdentical([], $this->entityDefinitionUpdateManager->getChangeSummary(), 'EntityDefinitionUpdateManager reports an empty change summary.'); + $this->assertIdentical([], $this->entityDefinitionUpdateManager->getChangeList(), 'EntityDefinitionUpdateManager reports an empty change list.'); } /** @@ -394,7 +394,7 @@ public function testBaseFieldCreateDeleteWithExistingEntities() { $schema_handler = $this->database->schema(); $this->assertTrue($schema_handler->fieldExists('entity_test_update', 'new_base_field'), 'Column created in shared table for new_base_field.'); $entity = $this->entityTypeManager->getStorage('entity_test_update')->load($entity->id()); - $this->assertIdentical($entity->name->value, $name, 'Entity data preserved during field creation.'); + $this->assertIdentical($name, $entity->name->value, 'Entity data preserved during field creation.'); // Remove the base field and run the update. Ensure the base field's column // is deleted and the prior saved entity data is still there. @@ -402,7 +402,7 @@ public function testBaseFieldCreateDeleteWithExistingEntities() { $this->applyEntityUpdates(); $this->assertFalse($schema_handler->fieldExists('entity_test_update', 'new_base_field'), 'Column deleted from shared table for new_base_field.'); $entity = $this->entityTypeManager->getStorage('entity_test_update')->load($entity->id()); - $this->assertIdentical($entity->name->value, $name, 'Entity data preserved during field deletion.'); + $this->assertIdentical($name, $entity->name->value, 'Entity data preserved during field deletion.'); // Add a base field with a required property and run the update. Ensure // 'not null' is not applied and thus no exception is thrown. @@ -450,7 +450,7 @@ public function testBundleFieldCreateDeleteWithExistingEntities() { $schema_handler = $this->database->schema(); $this->assertTrue($schema_handler->tableExists('entity_test_update__new_bundle_field'), 'Dedicated table created for new_bundle_field.'); $entity = $this->entityTypeManager->getStorage('entity_test_update')->load($entity->id()); - $this->assertIdentical($entity->name->value, $name, 'Entity data preserved during field creation.'); + $this->assertIdentical($name, $entity->name->value, 'Entity data preserved during field creation.'); // Remove the base field and run the update. Ensure the bundle field's // table is deleted and the prior saved entity data is still there. @@ -458,7 +458,7 @@ public function testBundleFieldCreateDeleteWithExistingEntities() { $this->applyEntityUpdates(); $this->assertFalse($schema_handler->tableExists('entity_test_update__new_bundle_field'), 'Dedicated table deleted for new_bundle_field.'); $entity = $this->entityTypeManager->getStorage('entity_test_update')->load($entity->id()); - $this->assertIdentical($entity->name->value, $name, 'Entity data preserved during field deletion.'); + $this->assertIdentical($name, $entity->name->value, 'Entity data preserved during field deletion.'); // Test that required columns are created as 'not null'. $this->addBundleField('shape_required'); diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityFieldTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityFieldTest.php index 8b2719d5db76..8ce6231abe38 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityFieldTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityFieldTest.php @@ -229,7 +229,7 @@ protected function doTestReadWrite($entity_type) { $this->assertTrue(isset($entity->name), new FormattableMarkup('%entity_type: Name field is set.', ['%entity_type' => $entity_type])); $this->assertTrue($entity->name->isEmpty(), new FormattableMarkup('%entity_type: Name field is set.', ['%entity_type' => $entity_type])); $this->assertCount(0, $entity->name, new FormattableMarkup('%entity_type: Name field contains no items.', ['%entity_type' => $entity_type])); - $this->assertIdentical($entity->name->getValue(), [], new FormattableMarkup('%entity_type: Name field value is an empty array.', ['%entity_type' => $entity_type])); + $this->assertIdentical([], $entity->name->getValue(), new FormattableMarkup('%entity_type: Name field value is an empty array.', ['%entity_type' => $entity_type])); $this->assertFalse(isset($entity->name[0]), new FormattableMarkup('%entity_type: Name field item is not set.', ['%entity_type' => $entity_type])); $this->assertFalse(isset($entity->name[0]->value), new FormattableMarkup('%entity_type: First name item value is not set.', ['%entity_type' => $entity_type])); $this->assertFalse(isset($entity->name->value), new FormattableMarkup('%entity_type: Name value is not set.', ['%entity_type' => $entity_type])); @@ -347,7 +347,7 @@ protected function doTestReadWrite($entity_type) { 'field_test_text' => $text_item, ]); $this->assertNotNull($entity->user_id->target_id, new FormattableMarkup('%entity_type: User id is not NULL', ['%entity_type' => $entity_type])); - $this->assertIdentical($entity->user_id->target_id, 0, new FormattableMarkup('%entity_type: User id has been set to 0', ['%entity_type' => $entity_type])); + $this->assertIdentical(0, $entity->user_id->target_id, new FormattableMarkup('%entity_type: User id has been set to 0', ['%entity_type' => $entity_type])); // Test setting the ID with the value only. $entity = $this->container->get('entity_type.manager') @@ -358,7 +358,7 @@ protected function doTestReadWrite($entity_type) { 'field_test_text' => $text_item, ]); $this->assertNotNull($entity->user_id->target_id, new FormattableMarkup('%entity_type: User id is not NULL', ['%entity_type' => $entity_type])); - $this->assertIdentical($entity->user_id->target_id, 0, new FormattableMarkup('%entity_type: User id has been set to 0', ['%entity_type' => $entity_type])); + $this->assertIdentical(0, $entity->user_id->target_id, new FormattableMarkup('%entity_type: User id has been set to 0', ['%entity_type' => $entity_type])); } /** diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryTest.php index 274d3c79f6cc..0e481a7b7e97 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryTest.php @@ -319,7 +319,7 @@ public function testEntityQuery() { // This matches both the original and new current revisions, multiple // revisions are returned for some entities. $assert = [16 => '4', 17 => '5', 18 => '6', 19 => '7', 8 => '8', 9 => '9', 10 => '10', 11 => '11', 20 => '12', 21 => '13', 22 => '14', 23 => '15']; - $this->assertIdentical($results, $assert); + $this->assertIdentical($assert, $results); $results = $this->storage ->getQuery() ->condition("$greetings.value", 'siema', 'STARTS_WITH') @@ -327,7 +327,7 @@ public function testEntityQuery() { ->execute(); // Now we only get the ones that originally were siema, entity id 8 and // above. - $this->assertIdentical($results, array_slice($assert, 4, 8, TRUE)); + $this->assertIdentical(array_slice($assert, 4, 8, TRUE), $results); $results = $this->storage ->getQuery() ->condition("$greetings.value", 'a', 'ENDS_WITH') @@ -335,7 +335,7 @@ public function testEntityQuery() { ->execute(); // It is very important that we do not get the ones which only have // xsiemax despite originally they were merhaba, ie. ended with a. - $this->assertIdentical($results, array_slice($assert, 4, 8, TRUE)); + $this->assertIdentical(array_slice($assert, 4, 8, TRUE), $results); $results = $this->storage ->getQuery() ->condition("$greetings.value", 'a', 'ENDS_WITH') @@ -345,7 +345,7 @@ public function testEntityQuery() { ->execute(); // Now we get everything. $assert = [4 => '4', 5 => '5', 6 => '6', 7 => '7', 8 => '8', 9 => '9', 10 => '10', 11 => '11', 12 => '12', 20 => '12', 13 => '13', 21 => '13', 14 => '14', 22 => '14', 15 => '15', 23 => '15']; - $this->assertIdentical($results, $assert); + $this->assertIdentical($assert, $results); // Check that a query on the latest revisions without any condition returns // the correct results. @@ -694,7 +694,7 @@ protected function assertResult() { foreach ($expected as $binary) { $assert[$binary] = strval($binary); } - $this->assertIdentical($this->queryResults, $assert); + $this->assertIdentical($assert, $this->queryResults); } protected function assertRevisionResult($keys, $expected) { @@ -702,7 +702,7 @@ protected function assertRevisionResult($keys, $expected) { foreach ($expected as $key => $binary) { $assert[$keys[$key]] = strval($binary); } - $this->assertIdentical($this->queryResults, $assert); + $this->assertIdentical($assert, $this->queryResults); return $assert; } diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityReferenceSelection/EntityReferenceSelectionSortTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityReferenceSelection/EntityReferenceSelectionSortTest.php index 997af8c2cd2e..511a1d7f0e0d 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityReferenceSelection/EntityReferenceSelectionSortTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityReferenceSelection/EntityReferenceSelectionSortTest.php @@ -112,7 +112,7 @@ public function testSort() { $nodes['published2']->id() => $node_labels['published2'], $nodes['published1']->id() => $node_labels['published1'], ]; - $this->assertIdentical($result['article'], $expected_result, 'Query sorted by field returned expected values.'); + $this->assertIdentical($expected_result, $result['article'], 'Query sorted by field returned expected values.'); // Assert sort by base field. $selection_options['sort'] = [ @@ -125,7 +125,7 @@ public function testSort() { $nodes['published1']->id() => $node_labels['published1'], $nodes['published2']->id() => $node_labels['published2'], ]; - $this->assertIdentical($result['article'], $expected_result, 'Query sorted by property returned expected values.'); + $this->assertIdentical($expected_result, $result['article'], 'Query sorted by property returned expected values.'); } } diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityUUIDTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityUUIDTest.php index a28beb485aa0..b58f539a25ca 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityUUIDTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityUUIDTest.php @@ -46,7 +46,7 @@ protected function assertCRUD($entity_type) { 'name' => $this->randomMachineName(), 'uuid' => $uuid, ]); - $this->assertIdentical($custom_entity->uuid(), $uuid); + $this->assertIdentical($uuid, $custom_entity->uuid()); // Save this entity, so we have more than one later. $custom_entity->save(); @@ -62,7 +62,7 @@ protected function assertCRUD($entity_type) { // Verify that the UUID is retained upon saving. $entity->save(); - $this->assertIdentical($entity->uuid(), $uuid); + $this->assertIdentical($uuid, $entity->uuid()); // Verify that the UUID is retained upon loading. /** @var \Drupal\Core\Entity\EntityStorageInterface $storage */ @@ -70,11 +70,11 @@ protected function assertCRUD($entity_type) { ->getStorage($entity_type); $storage->resetCache([$entity->id()]); $entity_loaded = $storage->load($entity->id()); - $this->assertIdentical($entity_loaded->uuid(), $uuid); + $this->assertIdentical($uuid, $entity_loaded->uuid()); // Verify that \Drupal::service('entity.repository')->loadEntityByUuid() loads the same entity. $entity_loaded_by_uuid = \Drupal::service('entity.repository')->loadEntityByUuid($entity_type, $uuid, TRUE); - $this->assertIdentical($entity_loaded_by_uuid->uuid(), $uuid); + $this->assertIdentical($uuid, $entity_loaded_by_uuid->uuid()); $this->assertEqual($entity_loaded_by_uuid->id(), $entity_loaded->id()); // Creating a duplicate needs to result in a new UUID. diff --git a/core/tests/Drupal/KernelTests/Core/Form/FormDefaultHandlersTest.php b/core/tests/Drupal/KernelTests/Core/Form/FormDefaultHandlersTest.php index 3477b7a6269e..617838522edc 100644 --- a/core/tests/Drupal/KernelTests/Core/Form/FormDefaultHandlersTest.php +++ b/core/tests/Drupal/KernelTests/Core/Form/FormDefaultHandlersTest.php @@ -78,12 +78,12 @@ public function testDefaultAndCustomHandlers() { $handlers = $form_state->get('test_handlers'); $this->assertCount(2, $handlers['validate']); - $this->assertIdentical($handlers['validate'][0], 'customValidateForm'); - $this->assertIdentical($handlers['validate'][1], 'validateForm'); + $this->assertIdentical('customValidateForm', $handlers['validate'][0]); + $this->assertIdentical('validateForm', $handlers['validate'][1]); $this->assertCount(2, $handlers['submit']); - $this->assertIdentical($handlers['submit'][0], 'customSubmitForm'); - $this->assertIdentical($handlers['submit'][1], 'submitForm'); + $this->assertIdentical('customSubmitForm', $handlers['submit'][0]); + $this->assertIdentical('submitForm', $handlers['submit'][1]); } } diff --git a/core/tests/Drupal/KernelTests/Core/KeyValueStore/DatabaseStorageExpirableTest.php b/core/tests/Drupal/KernelTests/Core/KeyValueStore/DatabaseStorageExpirableTest.php index cfaa7d13e35f..0306c21f549c 100644 --- a/core/tests/Drupal/KernelTests/Core/KeyValueStore/DatabaseStorageExpirableTest.php +++ b/core/tests/Drupal/KernelTests/Core/KeyValueStore/DatabaseStorageExpirableTest.php @@ -128,7 +128,7 @@ public function testExpiration() { $this->assertFalse($stores[0]->has('yesterday')); $this->assertNull($stores[0]->get('yesterday')); $this->assertTrue($stores[0]->has('troubles')); - $this->assertIdentical($stores[0]->get('troubles'), 'here to stay'); + $this->assertIdentical('here to stay', $stores[0]->get('troubles')); $this->assertCount(1, $stores[0]->getMultiple(['yesterday', 'troubles'])); // Store items set to expire in the past in various ways. diff --git a/core/tests/Drupal/KernelTests/Core/KeyValueStore/KeyValueContentEntityStorageTest.php b/core/tests/Drupal/KernelTests/Core/KeyValueStore/KeyValueContentEntityStorageTest.php index 092cf1e0b507..76c507324d6f 100644 --- a/core/tests/Drupal/KernelTests/Core/KeyValueStore/KeyValueContentEntityStorageTest.php +++ b/core/tests/Drupal/KernelTests/Core/KeyValueStore/KeyValueContentEntityStorageTest.php @@ -45,17 +45,17 @@ public function testCRUD() { $this->assertNull($empty->id->value); $this->assertNull($empty->name->value); $this->assertNotEmpty($empty->uuid->value); - $this->assertIdentical($empty->langcode->value, $default_langcode); + $this->assertIdentical($default_langcode, $empty->langcode->value); // Verify ConfigEntity properties/methods on the newly created empty entity. $this->assertTrue($empty->isNew()); - $this->assertIdentical($empty->bundle(), 'entity_test_label'); + $this->assertIdentical('entity_test_label', $empty->bundle()); $this->assertNull($empty->id()); $this->assertNotEmpty($empty->uuid()); $this->assertNull($empty->label()); // Verify Entity properties/methods on the newly created empty entity. - $this->assertIdentical($empty->getEntityTypeId(), 'entity_test_label'); + $this->assertIdentical('entity_test_label', $empty->getEntityTypeId()); // The URI can only be checked after saving. try { $empty->toUrl(); @@ -92,18 +92,18 @@ public function testCRUD() { 'id' => $this->randomMachineName(), 'name' => $this->randomString(), ]); - $this->assertIdentical($entity_test->id->value, $expected['id']); + $this->assertIdentical($expected['id'], $entity_test->id->value); $this->assertNotEmpty($entity_test->uuid->value); $this->assertNotEquals($empty->uuid->value, $entity_test->uuid->value); - $this->assertIdentical($entity_test->name->value, $expected['name']); - $this->assertIdentical($entity_test->langcode->value, $default_langcode); + $this->assertIdentical($expected['name'], $entity_test->name->value); + $this->assertIdentical($default_langcode, $entity_test->langcode->value); // Verify methods on the newly created entity. $this->assertTrue($entity_test->isNew()); - $this->assertIdentical($entity_test->id(), $expected['id']); + $this->assertIdentical($expected['id'], $entity_test->id()); $this->assertNotEmpty($entity_test->uuid()); $expected['uuid'] = $entity_test->uuid(); - $this->assertIdentical($entity_test->label(), $expected['name']); + $this->assertIdentical($expected['name'], $entity_test->label()); // Verify that the entity can be saved. try { @@ -117,18 +117,18 @@ public function testCRUD() { $this->assertTrue($storage->hasData()); // Verify that the correct status is returned and properties did not change. - $this->assertIdentical($status, SAVED_NEW); - $this->assertIdentical($entity_test->id(), $expected['id']); - $this->assertIdentical($entity_test->uuid(), $expected['uuid']); - $this->assertIdentical($entity_test->label(), $expected['name']); + $this->assertIdentical(SAVED_NEW, $status); + $this->assertIdentical($expected['id'], $entity_test->id()); + $this->assertIdentical($expected['uuid'], $entity_test->uuid()); + $this->assertIdentical($expected['name'], $entity_test->label()); $this->assertFalse($entity_test->isNew()); // Save again, and verify correct status and properties again. $status = $entity_test->save(); - $this->assertIdentical($status, SAVED_UPDATED); - $this->assertIdentical($entity_test->id(), $expected['id']); - $this->assertIdentical($entity_test->uuid(), $expected['uuid']); - $this->assertIdentical($entity_test->label(), $expected['name']); + $this->assertIdentical(SAVED_UPDATED, $status); + $this->assertIdentical($expected['id'], $entity_test->id()); + $this->assertIdentical($expected['uuid'], $entity_test->uuid()); + $this->assertIdentical($expected['name'], $entity_test->label()); $this->assertFalse($entity_test->isNew()); // Ensure that creating an entity with the same id as an existing one is not @@ -151,17 +151,17 @@ public function testCRUD() { $old_id = $ids[$i - 1]; $new_id = $ids[$i]; // Before renaming, everything should point to the current ID. - $this->assertIdentical($entity_test->id(), $old_id); + $this->assertIdentical($old_id, $entity_test->id()); // Rename. $entity_test->id = $new_id; - $this->assertIdentical($entity_test->id(), $new_id); + $this->assertIdentical($new_id, $entity_test->id()); $status = $entity_test->save(); - $this->assertIdentical($status, SAVED_UPDATED); + $this->assertIdentical(SAVED_UPDATED, $status); $this->assertFalse($entity_test->isNew()); // Verify that originalID points to new ID directly after renaming. - $this->assertIdentical($entity_test->id(), $new_id); + $this->assertIdentical($new_id, $entity_test->id()); } } diff --git a/core/tests/Drupal/KernelTests/Core/KeyValueStore/StorageTestBase.php b/core/tests/Drupal/KernelTests/Core/KeyValueStore/StorageTestBase.php index ca4a30f1849c..cc2c43fa6f18 100644 --- a/core/tests/Drupal/KernelTests/Core/KeyValueStore/StorageTestBase.php +++ b/core/tests/Drupal/KernelTests/Core/KeyValueStore/StorageTestBase.php @@ -48,8 +48,8 @@ protected function setUp() { public function testCRUD() { $stores = $this->createStorage(); // Verify that each store returns its own collection name. - $this->assertIdentical($stores[0]->getCollectionName(), $this->collections[0]); - $this->assertIdentical($stores[1]->getCollectionName(), $this->collections[1]); + $this->assertIdentical($this->collections[0], $stores[0]->getCollectionName()); + $this->assertIdentical($this->collections[1], $stores[1]->getCollectionName()); // Verify that an item can be stored. $stores[0]->set('foo', $this->objects[0]); @@ -132,7 +132,7 @@ public function testNonExistingKeys() { $this->assertNull($stores[0]->get('foo')); // Verify that a non-existing key with a default returns the default. - $this->assertIdentical($stores[0]->get('foo', 'bar'), 'bar'); + $this->assertIdentical('bar', $stores[0]->get('foo', 'bar')); // Verify that a FALSE value can be stored. $stores[0]->set('foo', FALSE); @@ -146,7 +146,7 @@ public function testNonExistingKeys() { $stores[0]->set('bar', 'baz'); $values = $stores[0]->getMultiple(['foo', 'bar']); $this->assertFalse(isset($values['foo']), "Key 'foo' not found."); - $this->assertIdentical($values['bar'], 'baz'); + $this->assertIdentical('baz', $values['bar']); } /** @@ -183,9 +183,9 @@ public function testRename() { $store = $stores[0]; $store->set('old', 'thing'); - $this->assertIdentical($store->get('old'), 'thing'); + $this->assertIdentical('thing', $store->get('old')); $store->rename('old', 'new'); - $this->assertIdentical($store->get('new'), 'thing'); + $this->assertIdentical('thing', $store->get('new')); $this->assertNull($store->get('old')); } diff --git a/core/tests/Drupal/KernelTests/Core/Plugin/Discovery/DiscoveryTestBase.php b/core/tests/Drupal/KernelTests/Core/Plugin/Discovery/DiscoveryTestBase.php index 494731298639..354a54316c52 100644 --- a/core/tests/Drupal/KernelTests/Core/Plugin/Discovery/DiscoveryTestBase.php +++ b/core/tests/Drupal/KernelTests/Core/Plugin/Discovery/DiscoveryTestBase.php @@ -51,7 +51,7 @@ public function testDiscoveryInterface() { } // Ensure that an empty array is returned if no plugin definitions are found. - $this->assertIdentical($this->emptyDiscovery->getDefinitions(), [], 'array() returned if no plugin definitions are found.'); + $this->assertIdentical([], $this->emptyDiscovery->getDefinitions(), 'array() returned if no plugin definitions are found.'); // Ensure that NULL is returned as the definition of a non-existing plugin. $this->assertNull($this->emptyDiscovery->getDefinition('non_existing', FALSE), 'NULL returned as the definition of a non-existing plugin.'); @@ -78,7 +78,7 @@ protected function assertDefinitionIdentical(array $definition, array $expected_ }; array_walk_recursive($definition, $func); array_walk_recursive($expected_definition, $func); - return $this->assertIdentical($definition, $expected_definition); + return $this->assertIdentical($expected_definition, $definition); } } diff --git a/core/tests/Drupal/KernelTests/Core/Plugin/FactoryTest.php b/core/tests/Drupal/KernelTests/Core/Plugin/FactoryTest.php index 844fb43e0ab5..8cefcc055af5 100644 --- a/core/tests/Drupal/KernelTests/Core/Plugin/FactoryTest.php +++ b/core/tests/Drupal/KernelTests/Core/Plugin/FactoryTest.php @@ -22,8 +22,8 @@ class FactoryTest extends PluginTestBase { public function testDefaultFactory() { // Ensure a non-derivative plugin can be instantiated. $plugin = $this->testPluginManager->createInstance('user_login', ['title' => 'Please enter your login name and password']); - $this->assertIdentical(get_class($plugin), 'Drupal\plugin_test\Plugin\plugin_test\mock_block\MockUserLoginBlock', 'Correct plugin class instantiated with default factory.'); - $this->assertIdentical($plugin->getTitle(), 'Please enter your login name and password', 'Plugin instance correctly configured.'); + $this->assertIdentical('Drupal\\plugin_test\\Plugin\\plugin_test\\mock_block\\MockUserLoginBlock', get_class($plugin), 'Correct plugin class instantiated with default factory.'); + $this->assertIdentical('Please enter your login name and password', $plugin->getTitle(), 'Plugin instance correctly configured.'); // Ensure that attempting to instantiate non-existing plugins throws a // PluginException. @@ -49,12 +49,12 @@ public function testDefaultFactory() { public function testReflectionFactory() { // Ensure a non-derivative plugin can be instantiated. $plugin = $this->mockBlockManager->createInstance('user_login', ['title' => 'Please enter your login name and password']); - $this->assertIdentical(get_class($plugin), 'Drupal\plugin_test\Plugin\plugin_test\mock_block\MockUserLoginBlock', 'Correct plugin class instantiated.'); - $this->assertIdentical($plugin->getTitle(), 'Please enter your login name and password', 'Plugin instance correctly configured.'); + $this->assertIdentical('Drupal\\plugin_test\\Plugin\\plugin_test\\mock_block\\MockUserLoginBlock', get_class($plugin), 'Correct plugin class instantiated.'); + $this->assertIdentical('Please enter your login name and password', $plugin->getTitle(), 'Plugin instance correctly configured.'); // Ensure a derivative plugin can be instantiated. $plugin = $this->mockBlockManager->createInstance('menu:main_menu', ['depth' => 2]); - $this->assertIdentical($plugin->getContent(), '<ul><li>1<ul><li>1.1</li></ul></li></ul>', 'Derived plugin instance correctly instantiated and configured.'); + $this->assertIdentical('<ul><li>1<ul><li>1.1</li></ul></li></ul>', $plugin->getContent(), 'Derived plugin instance correctly instantiated and configured.'); // Ensure that attempting to instantiate non-existing plugins throws a // PluginException. Test this for a non-existing base plugin, a non-existing diff --git a/core/tests/Drupal/KernelTests/Core/Plugin/InspectionTest.php b/core/tests/Drupal/KernelTests/Core/Plugin/InspectionTest.php index 3541cf802c83..17126bdeaff2 100644 --- a/core/tests/Drupal/KernelTests/Core/Plugin/InspectionTest.php +++ b/core/tests/Drupal/KernelTests/Core/Plugin/InspectionTest.php @@ -21,16 +21,16 @@ public function testInspection() { foreach (['user_login'] as $id) { $plugin = $this->testPluginManager->createInstance($id); $expected_definition = $this->testPluginExpectedDefinitions[$id]; - $this->assertIdentical($plugin->getPluginId(), $id); - $this->assertIdentical($this->testPluginManager->getDefinition($id), $expected_definition); - $this->assertIdentical($plugin->getPluginDefinition(), $expected_definition); + $this->assertIdentical($id, $plugin->getPluginId()); + $this->assertIdentical($expected_definition, $this->testPluginManager->getDefinition($id)); + $this->assertIdentical($expected_definition, $plugin->getPluginDefinition()); } // Skip the 'menu' derived blocks, because MockMenuBlock does not implement // PluginInspectionInterface. The others do by extending PluginBase. foreach (['user_login', 'layout'] as $id) { $plugin = $this->mockBlockManager->createInstance($id); $expected_definition = $this->mockBlockExpectedDefinitions[$id]; - $this->assertIdentical($plugin->getPluginId(), $id); + $this->assertIdentical($id, $plugin->getPluginId()); $this->assertEquals($expected_definition, $this->mockBlockManager->getDefinition($id)); $this->assertEquals($expected_definition, $plugin->getPluginDefinition()); } @@ -38,8 +38,8 @@ public function testInspection() { foreach (['test_block1', 'test_block2'] as $id) { $plugin = $this->defaultsTestPluginManager->createInstance($id); $expected_definition = $this->defaultsTestPluginExpectedDefinitions[$id]; - $this->assertIdentical($plugin->getPluginId(), $id); - $this->assertIdentical($this->defaultsTestPluginManager->getDefinition($id), $expected_definition); + $this->assertIdentical($id, $plugin->getPluginId()); + $this->assertIdentical($expected_definition, $this->defaultsTestPluginManager->getDefinition($id)); $this->assertEquals($expected_definition, $plugin->getPluginDefinition()); } } diff --git a/core/tests/Drupal/KernelTests/Core/Render/Element/RenderElementTypesTest.php b/core/tests/Drupal/KernelTests/Core/Render/Element/RenderElementTypesTest.php index 8f9cf3c7064d..3b83e8ceea34 100644 --- a/core/tests/Drupal/KernelTests/Core/Render/Element/RenderElementTypesTest.php +++ b/core/tests/Drupal/KernelTests/Core/Render/Element/RenderElementTypesTest.php @@ -44,7 +44,7 @@ protected function assertElements(array $elements, $expected_html, $message) { $out .= '</tr></table>'; $this->verbose($out); - $this->assertIdentical($actual_html, $expected_html, Html::escape($message)); + $this->assertIdentical($expected_html, $actual_html, Html::escape($message)); } /** diff --git a/core/tests/Drupal/KernelTests/Core/Theme/ThemeInstallerTest.php b/core/tests/Drupal/KernelTests/Core/Theme/ThemeInstallerTest.php index 7973648f62d0..ca4674e81ffa 100644 --- a/core/tests/Drupal/KernelTests/Core/Theme/ThemeInstallerTest.php +++ b/core/tests/Drupal/KernelTests/Core/Theme/ThemeInstallerTest.php @@ -66,7 +66,7 @@ public function testInstall() { $this->themeInstaller()->install([$name]); - $this->assertIdentical($this->extensionConfig()->get("theme.$name"), 0); + $this->assertIdentical(0, $this->extensionConfig()->get("theme.{$name}")); $themes = $this->themeHandler()->listInfo(); $this->assertTrue(isset($themes[$name])); diff --git a/core/tests/Drupal/KernelTests/Core/Theme/ThemeSettingsTest.php b/core/tests/Drupal/KernelTests/Core/Theme/ThemeSettingsTest.php index b099d0cad806..ad5f3495dc2b 100644 --- a/core/tests/Drupal/KernelTests/Core/Theme/ThemeSettingsTest.php +++ b/core/tests/Drupal/KernelTests/Core/Theme/ThemeSettingsTest.php @@ -46,7 +46,7 @@ public function testDefaultConfig() { $path = $this->availableThemes[$name]->getPath(); $this->assertFileExists("$path/" . InstallStorage::CONFIG_INSTALL_DIRECTORY . "/$name.settings.yml"); $this->container->get('theme_installer')->install([$name]); - $this->assertIdentical(theme_get_setting('base', $name), 'only'); + $this->assertIdentical('only', theme_get_setting('base', $name)); } /** diff --git a/core/tests/Drupal/KernelTests/Core/TypedData/TypedDataTest.php b/core/tests/Drupal/KernelTests/Core/TypedData/TypedDataTest.php index 991de18177e9..b5cb777e2a91 100644 --- a/core/tests/Drupal/KernelTests/Core/TypedData/TypedDataTest.php +++ b/core/tests/Drupal/KernelTests/Core/TypedData/TypedDataTest.php @@ -225,7 +225,7 @@ public function testGetAndSet() { $value = 'PT20S'; $typed_data = $this->createTypedData(['type' => 'duration_iso8601'], $value); $this->assertInstanceOf(DurationInterface::class, $typed_data); - $this->assertIdentical($typed_data->getValue(), $value, 'DurationIso8601 value was fetched.'); + $this->assertIdentical($value, $typed_data->getValue(), 'DurationIso8601 value was fetched.'); $this->assertEqual($typed_data->validate()->count(), 0); $typed_data->setValue('P40D'); $this->assertEqual($typed_data->getDuration()->d, 40, 'DurationIso8601 value was changed and set by duration string.'); @@ -249,7 +249,7 @@ public function testGetAndSet() { $value = 20; $typed_data = $this->createTypedData(['type' => 'timespan'], $value); $this->assertInstanceOf(DurationInterface::class, $typed_data); - $this->assertIdentical($typed_data->getValue(), $value, 'Time span value was fetched.'); + $this->assertIdentical($value, $typed_data->getValue(), 'Time span value was fetched.'); $this->assertEqual($typed_data->validate()->count(), 0); $typed_data->setValue(60 * 60 * 4); $this->assertEqual($typed_data->getDuration()->s, 14400, 'Time span was changed'); @@ -300,10 +300,10 @@ public function testGetAndSet() { $value = $this->randomString(); $typed_data = $this->createTypedData(['type' => 'email'], $value); $this->assertInstanceOf(StringInterface::class, $typed_data); - $this->assertIdentical($typed_data->getValue(), $value, 'Email value was fetched.'); + $this->assertIdentical($value, $typed_data->getValue(), 'Email value was fetched.'); $new_value = 'test@example.com'; $typed_data->setValue($new_value); - $this->assertIdentical($typed_data->getValue(), $new_value, 'Email value was changed.'); + $this->assertIdentical($new_value, $typed_data->getValue(), 'Email value was changed.'); $this->assertIsString($typed_data->getString()); $this->assertEqual($typed_data->validate()->count(), 0); $typed_data->setValue(NULL); @@ -336,10 +336,10 @@ public function testGetAndSet() { // Any type. $value = ['foo']; $typed_data = $this->createTypedData(['type' => 'any'], $value); - $this->assertIdentical($typed_data->getValue(), $value, 'Any value was fetched.'); + $this->assertIdentical($value, $typed_data->getValue(), 'Any value was fetched.'); $new_value = 'test@example.com'; $typed_data->setValue($new_value); - $this->assertIdentical($typed_data->getValue(), $new_value, 'Any value was changed.'); + $this->assertIdentical($new_value, $typed_data->getValue(), 'Any value was changed.'); $this->assertIsString($typed_data->getString()); $this->assertEqual($typed_data->validate()->count(), 0); $typed_data->setValue(NULL); @@ -393,8 +393,8 @@ public function testTypedDataLists() { // Make sure that resetting the value using NULL results in an empty array. $clone->setValue([]); $typed_data->setValue(NULL); - $this->assertIdentical($typed_data->getValue(), []); - $this->assertIdentical($clone->getValue(), []); + $this->assertIdentical([], $typed_data->getValue()); + $this->assertIdentical([], $clone->getValue()); // Test dealing with NULL items. $typed_data[] = NULL; @@ -515,7 +515,7 @@ public function testTypedDataMaps() { $properties = $typed_data->getProperties(); $this->assertEqual(array_keys($properties), array_keys($value)); - $this->assertIdentical($properties['one'], $typed_data->get('one'), 'Properties are identical.'); + $this->assertIdentical($typed_data->get('one'), $properties['one'], 'Properties are identical.'); // Test setting a not defined property. It shouldn't show up in the // properties, but be kept in the values. @@ -589,7 +589,7 @@ public function testTypedDataValidation() { $message = t('This value should be %limit or more.', ['%limit' => 5]); $this->assertEqual($violations[0]->getMessage(), $message, 'Translated violation message retrieved.'); $this->assertEqual($violations[0]->getPropertyPath(), ''); - $this->assertIdentical($violations[0]->getRoot(), $integer, 'Root object returned.'); + $this->assertIdentical($integer, $violations[0]->getRoot(), 'Root object returned.'); // Test translating violation messages when pluralization is used. $definition = DataDefinition::create('string') @@ -668,7 +668,7 @@ public function testTypedDataValidation() { $this->assertEqual($violations->count(), 1); $this->assertEqual($violations[0]->getInvalidValue(), 'string'); - $this->assertIdentical($violations[0]->getPropertyPath(), '0.value'); + $this->assertIdentical('0.value', $violations[0]->getPropertyPath()); } } -- GitLab