diff --git a/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php b/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php index dcff3fc3..cce6cb83 100644 --- a/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php +++ b/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php @@ -4,6 +4,7 @@ use Drupal\Component\Render\FormattableMarkup; use Drupal\Component\Utility\ToStringTrait; +use Drupal\Core\DependencyInjection\ContainerNotInitializedException; /** * Provides translatable markup class. @@ -187,7 +188,14 @@ public function getArguments() { */ public function render() { if (!isset($this->translatedMarkup)) { - $this->translatedMarkup = $this->getStringTranslation()->translateString($this); + try { + $this->translatedMarkup = $this->getStringTranslation()->translateString($this); + } + catch (ContainerNotInitializedException $e) { + // In unit tests, there is no container initialized. In that case, we + // just return the untranslated string. + $this->translatedMarkup = $this->string; + } } // Handle any replacements. diff --git a/core/modules/block/tests/src/Kernel/BlockInterfaceTest.php b/core/modules/block/tests/src/Kernel/BlockInterfaceTest.php index 48d63a30..f6059c58 100644 --- a/core/modules/block/tests/src/Kernel/BlockInterfaceTest.php +++ b/core/modules/block/tests/src/Kernel/BlockInterfaceTest.php @@ -87,7 +87,7 @@ public function testBlockInterface() { $actual_form = $display_block->buildConfigurationForm([], $form_state); // Remove the visibility sections, as that just tests condition plugins. unset($actual_form['visibility'], $actual_form['visibility_tabs']); - $this->assertIdentical($this->castSafeStrings($actual_form), $this->castSafeStrings($expected_form), 'Only the expected form elements were present.'); + $this->assertEquals($expected_form, $actual_form, 'Only the expected form elements were present.'); $expected_build = [ '#children' => 'My custom display message.', diff --git a/core/modules/book/tests/src/Unit/BookUninstallValidatorTest.php b/core/modules/book/tests/src/Unit/BookUninstallValidatorTest.php index 496acf02..bf5b5df7 100644 --- a/core/modules/book/tests/src/Unit/BookUninstallValidatorTest.php +++ b/core/modules/book/tests/src/Unit/BookUninstallValidatorTest.php @@ -2,7 +2,6 @@ namespace Drupal\Tests\book\Unit; -use Drupal\Tests\AssertHelperTrait; use Drupal\Tests\UnitTestCase; /** @@ -11,8 +10,6 @@ */ class BookUninstallValidatorTest extends UnitTestCase { - use AssertHelperTrait; - /** * @var \Drupal\book\BookUninstallValidator|\PHPUnit\Framework\MockObject\MockObject */ @@ -42,7 +39,7 @@ public function testValidateNotBook() { $module = 'not_book'; $expected = []; $reasons = $this->bookUninstallValidator->validate($module); - $this->assertSame($expected, $this->castSafeStrings($reasons)); + $this->assertEquals($expected, $reasons); } /** @@ -59,7 +56,7 @@ public function testValidateEntityQueryWithoutResults() { $module = 'book'; $expected = []; $reasons = $this->bookUninstallValidator->validate($module); - $this->assertSame($expected, $this->castSafeStrings($reasons)); + $this->assertEquals($expected, $reasons); } /** @@ -76,7 +73,7 @@ public function testValidateEntityQueryWithResults() { $module = 'book'; $expected = ['To uninstall Book, delete all content that has the Book content type']; $reasons = $this->bookUninstallValidator->validate($module); - $this->assertSame($expected, $this->castSafeStrings($reasons)); + $this->assertEquals($expected, $reasons); } /** @@ -92,7 +89,7 @@ public function testValidateOutlineStorage() { $module = 'book'; $expected = ['To uninstall Book, delete all content that is part of a book']; $reasons = $this->bookUninstallValidator->validate($module); - $this->assertSame($expected, $this->castSafeStrings($reasons)); + $this->assertEquals($expected, $reasons); } } diff --git a/core/modules/breakpoint/tests/src/Kernel/BreakpointDiscoveryTest.php b/core/modules/breakpoint/tests/src/Kernel/BreakpointDiscoveryTest.php index 884c5a2b..d62ef8ab 100644 --- a/core/modules/breakpoint/tests/src/Kernel/BreakpointDiscoveryTest.php +++ b/core/modules/breakpoint/tests/src/Kernel/BreakpointDiscoveryTest.php @@ -188,7 +188,7 @@ public function testBreakpointGroups() { ]; $breakpoint_groups = \Drupal::service('breakpoint.manager')->getGroups(); // Ensure the order is as expected. Should be sorted by label. - $this->assertIdentical($expected, $this->castSafeStrings($breakpoint_groups)); + $this->assertEquals($expected, $breakpoint_groups); $expected = [ 'breakpoint_theme_test' => 'theme', diff --git a/core/modules/ckeditor/tests/src/Functional/CKEditorAdminTest.php b/core/modules/ckeditor/tests/src/Functional/CKEditorAdminTest.php index 26b71553..f7d10cd5 100644 --- a/core/modules/ckeditor/tests/src/Functional/CKEditorAdminTest.php +++ b/core/modules/ckeditor/tests/src/Functional/CKEditorAdminTest.php @@ -112,7 +112,7 @@ public function testExistingFormat() { ], 'plugins' => ['language' => ['language_list' => 'un']], ]; - $this->assertIdentical($this->castSafeStrings($ckeditor->getDefaultSettings()), $expected_default_settings); + $this->assertEquals($expected_default_settings, $ckeditor->getDefaultSettings()); // Keep the "CKEditor" editor selected and click the "Configure" button. $this->drupalPostForm(NULL, $edit, 'editor_configure'); @@ -300,7 +300,7 @@ public function testNewFormat() { $expected_settings['plugins']['stylescombo']['styles'] = ''; $editor = Editor::load('amazing_format'); $this->assertTrue($editor instanceof Editor, 'An Editor config entity exists now.'); - $this->assertEqual($this->castSafeStrings($expected_settings), $this->castSafeStrings($editor->getSettings()), 'The Editor config entity has the correct settings.'); + $this->assertEquals($expected_settings, $editor->getSettings(), 'The Editor config entity has the correct settings.'); } } diff --git a/core/modules/ckeditor/tests/src/Functional/CKEditorLoadingTest.php b/core/modules/ckeditor/tests/src/Functional/CKEditorLoadingTest.php index 71908383..a45bc146 100644 --- a/core/modules/ckeditor/tests/src/Functional/CKEditorLoadingTest.php +++ b/core/modules/ckeditor/tests/src/Functional/CKEditorLoadingTest.php @@ -111,14 +111,14 @@ public function testLoading() { 'filtered_html' => [ 'format' => 'filtered_html', 'editor' => 'ckeditor', - 'editorSettings' => $this->castSafeStrings($ckeditor_plugin->getJSSettings($editor)), + 'editorSettings' => $ckeditor_plugin->getJSSettings($editor), 'editorSupportsContentFiltering' => TRUE, 'isXssSafe' => FALSE, ], ], ]; $this->assertTrue($editor_settings_present, "Text Editor module's JavaScript settings are on the page."); - $this->assertIdentical($expected, $this->castSafeStrings($settings['editor']), "Text Editor module's JavaScript settings on the page are correct."); + $this->assertEquals($expected, $settings['editor'], "Text Editor module's JavaScript settings on the page are correct."); $this->assertTrue($editor_js_present, 'Text Editor JavaScript is present.'); $this->assertTrue(count($body) === 1, 'A body field exists.'); $this->assertTrue(count($format_selector) === 1, 'A single text format selector exists on the page.'); @@ -144,14 +144,14 @@ public function testLoading() { 'filtered_html' => [ 'format' => 'filtered_html', 'editor' => 'ckeditor', - 'editorSettings' => $this->castSafeStrings($ckeditor_plugin->getJSSettings($editor)), + 'editorSettings' => $ckeditor_plugin->getJSSettings($editor), 'editorSupportsContentFiltering' => TRUE, 'isXssSafe' => FALSE, ], ], ]; $this->assertTrue($editor_settings_present, "Text Editor module's JavaScript settings are on the page."); - $this->assertIdentical($expected, $this->castSafeStrings($settings['editor']), "Text Editor module's JavaScript settings on the page are correct."); + $this->assertEquals($expected, $settings['editor'], "Text Editor module's JavaScript settings on the page are correct."); $this->assertTrue($editor_js_present, 'Text Editor JavaScript is present.'); $this->assertTrue(in_array('ckeditor/drupal.ckeditor', explode(',', $settings['ajaxPageState']['libraries'])), 'CKEditor glue library is present.'); diff --git a/core/modules/ckeditor/tests/src/Kernel/CKEditorTest.php b/core/modules/ckeditor/tests/src/Kernel/CKEditorTest.php index a3d3e41a..cf9f1bd2 100644 --- a/core/modules/ckeditor/tests/src/Kernel/CKEditorTest.php +++ b/core/modules/ckeditor/tests/src/Kernel/CKEditorTest.php @@ -90,10 +90,7 @@ public function testGetJSSettings() { 'drupallink' => file_url_transform_relative(file_create_url('core/modules/ckeditor/js/plugins/drupallink/plugin.js')), ], ]; - $expected_config = $this->castSafeStrings($expected_config); - ksort($expected_config); - ksort($expected_config['allowedContent']); - $this->assertIdentical($expected_config, $this->castSafeStrings($this->ckeditor->getJSSettings($editor)), 'Generated JS settings are correct for default configuration.'); + $this->assertEquals($expected_config, $this->ckeditor->getJSSettings($editor), 'Generated JS settings are correct for default configuration.'); // Customize the configuration: add button, have two contextually enabled // buttons, and configure a CKEditor plugin setting. @@ -113,8 +110,7 @@ public function testGetJSSettings() { $expected_config['drupalExternalPlugins']['llama_contextual'] = file_url_transform_relative(file_create_url('core/modules/ckeditor/tests/modules/js/llama_contextual.js')); $expected_config['drupalExternalPlugins']['llama_contextual_and_button'] = file_url_transform_relative(file_create_url('core/modules/ckeditor/tests/modules/js/llama_contextual_and_button.js')); $expected_config['contentsCss'][] = file_url_transform_relative(file_create_url('core/modules/ckeditor/tests/modules/ckeditor_test.css')) . $query_string; - ksort($expected_config); - $this->assertIdentical($expected_config, $this->castSafeStrings($this->ckeditor->getJSSettings($editor)), 'Generated JS settings are correct for customized configuration.'); + $this->assertEquals($expected_config, $this->ckeditor->getJSSettings($editor), 'Generated JS settings are correct for customized configuration.'); // Change the allowed HTML tags; the "allowedContent" and "format_tags" // settings for CKEditor should automatically be updated as well. @@ -127,8 +123,7 @@ public function testGetJSSettings() { $expected_config['allowedContent']['blockquote'] = ['attributes' => 'class', 'styles' => FALSE, 'classes' => TRUE]; $expected_config['allowedContent']['address'] = ['attributes' => 'class', 'styles' => FALSE, 'classes' => 'foo,bar-*']; $expected_config['format_tags'] = 'p;h1;h2;h3;h4;h5;h6;pre'; - ksort($expected_config['allowedContent']); - $this->assertIdentical($expected_config, $this->castSafeStrings($this->ckeditor->getJSSettings($editor)), 'Generated JS settings are correct for customized configuration.'); + $this->assertEquals($expected_config, $this->ckeditor->getJSSettings($editor), 'Generated JS settings are correct for customized configuration.'); // Disable the filter_html filter: allow *all *tags. $format->setFilterConfig('filter_html', ['status' => 0]); @@ -137,7 +132,7 @@ public function testGetJSSettings() { $expected_config['allowedContent'] = TRUE; $expected_config['disallowedContent'] = FALSE; $expected_config['format_tags'] = 'p;h1;h2;h3;h4;h5;h6;pre'; - $this->assertIdentical($expected_config, $this->castSafeStrings($this->ckeditor->getJSSettings($editor)), 'Generated JS settings are correct for customized configuration.'); + $this->assertEquals($expected_config, $this->ckeditor->getJSSettings($editor), 'Generated JS settings are correct for customized configuration.'); // Enable the filter_test_restrict_tags_and_attributes filter. $format->setFilterConfig('filter_test_restrict_tags_and_attributes', [ @@ -208,10 +203,7 @@ public function testGetJSSettings() { ], ]; $expected_config['format_tags'] = 'p'; - ksort($expected_config); - ksort($expected_config['allowedContent']); - ksort($expected_config['disallowedContent']); - $this->assertIdentical($expected_config, $this->castSafeStrings($this->ckeditor->getJSSettings($editor)), 'Generated JS settings are correct for customized configuration.'); + $this->assertEquals($expected_config, $this->ckeditor->getJSSettings($editor), 'Generated JS settings are correct for customized configuration.'); } /** @@ -222,7 +214,7 @@ public function testBuildToolbarJSSetting() { // Default toolbar. $expected = $this->getDefaultToolbarConfig(); - $this->assertIdentical($expected, $this->castSafeStrings($this->ckeditor->buildToolbarJSSetting($editor)), '"toolbar" configuration part of JS settings built correctly for default toolbar.'); + $this->assertIdentical($expected, $this->ckeditor->buildToolbarJSSetting($editor), '"toolbar" configuration part of JS settings built correctly for default toolbar.'); // Customize the configuration. $settings = $editor->getSettings(); @@ -230,7 +222,7 @@ public function testBuildToolbarJSSetting() { $editor->setSettings($settings); $editor->save(); $expected[0]['items'][] = 'Strike'; - $this->assertIdentical($expected, $this->castSafeStrings($this->ckeditor->buildToolbarJSSetting($editor)), '"toolbar" configuration part of JS settings built correctly for customized toolbar.'); + $this->assertEquals($expected, $this->ckeditor->buildToolbarJSSetting($editor), '"toolbar" configuration part of JS settings built correctly for customized toolbar.'); // Enable the editor_test module, customize further. $this->enableModules(['ckeditor_test']); @@ -242,7 +234,7 @@ public function testBuildToolbarJSSetting() { $editor->save(); $expected[0]['name'] = 'JunkScience'; $expected[0]['items'][] = 'Llama'; - $this->assertIdentical($expected, $this->castSafeStrings($this->ckeditor->buildToolbarJSSetting($editor)), '"toolbar" configuration part of JS settings built correctly for customized toolbar with contrib module-provided CKEditor plugin.'); + $this->assertEquals($expected, $this->ckeditor->buildToolbarJSSetting($editor), '"toolbar" configuration part of JS settings built correctly for customized toolbar with contrib module-provided CKEditor plugin.'); } /** @@ -254,7 +246,7 @@ public function testBuildContentsCssJSSetting() { // Default toolbar. $expected = $this->getDefaultContentsCssConfig(); - $this->assertIdentical($expected, $this->ckeditor->buildContentsCssJSSetting($editor), '"contentsCss" configuration part of JS settings built correctly for default toolbar.'); + $this->assertEquals($expected, $this->ckeditor->buildContentsCssJSSetting($editor), '"contentsCss" configuration part of JS settings built correctly for default toolbar.'); // Enable the editor_test module, which implements hook_ckeditor_css_alter(). $this->enableModules(['ckeditor_test']); diff --git a/core/modules/field/tests/src/Unit/FieldUninstallValidatorTest.php b/core/modules/field/tests/src/Unit/FieldUninstallValidatorTest.php index 6032f024..87110a07 100644 --- a/core/modules/field/tests/src/Unit/FieldUninstallValidatorTest.php +++ b/core/modules/field/tests/src/Unit/FieldUninstallValidatorTest.php @@ -2,7 +2,6 @@ namespace Drupal\Tests\field\Unit; -use Drupal\Tests\AssertHelperTrait; use Drupal\Tests\UnitTestCase; /** @@ -11,8 +10,6 @@ */ class FieldUninstallValidatorTest extends UnitTestCase { - use AssertHelperTrait; - /** * @var \Drupal\field\FieldUninstallValidator|\PHPUnit\Framework\MockObject\MockObject */ @@ -48,7 +45,7 @@ public function testValidateNoStorages() { $module = $this->randomMachineName(); $expected = []; $reasons = $this->fieldUninstallValidator->validate($module); - $this->assertSame($expected, $this->castSafeStrings($reasons)); + $this->assertEquals($expected, $reasons); } /** @@ -68,7 +65,7 @@ public function testValidateDeleted() { $module = $this->randomMachineName(); $expected = ['Fields pending deletion']; $reasons = $this->fieldUninstallValidator->validate($module); - $this->assertSame($expected, $this->castSafeStrings($reasons)); + $this->assertEquals($expected, $reasons); } /** @@ -100,7 +97,7 @@ public function testValidateNoDeleted() { $module = $this->randomMachineName(); $expected = ["The $field_type_label field type is used in the following field: $field_name"]; $reasons = $this->fieldUninstallValidator->validate($module); - $this->assertSame($expected, $this->castSafeStrings($reasons)); + $this->assertEquals($expected, $reasons); } } diff --git a/core/modules/filter/tests/src/Unit/FilterUninstallValidatorTest.php b/core/modules/filter/tests/src/Unit/FilterUninstallValidatorTest.php index 9e5b7521..65bec0ed 100644 --- a/core/modules/filter/tests/src/Unit/FilterUninstallValidatorTest.php +++ b/core/modules/filter/tests/src/Unit/FilterUninstallValidatorTest.php @@ -2,7 +2,6 @@ namespace Drupal\Tests\filter\Unit; -use Drupal\Tests\AssertHelperTrait; use Drupal\Tests\UnitTestCase; /** @@ -11,8 +10,6 @@ */ class FilterUninstallValidatorTest extends UnitTestCase { - use AssertHelperTrait; - /** * @var \Drupal\filter\FilterUninstallValidator|\PHPUnit\Framework\MockObject\MockObject */ @@ -43,7 +40,7 @@ public function testValidateNoPlugins() { $module = $this->randomMachineName(); $expected = []; $reasons = $this->filterUninstallValidator->validate($module); - $this->assertSame($expected, $this->castSafeStrings($reasons)); + $this->assertEquals($expected, $reasons); } /** @@ -65,7 +62,7 @@ public function testValidateNoFormats() { $module = $this->randomMachineName(); $expected = []; $reasons = $this->filterUninstallValidator->validate($module); - $this->assertSame($expected, $this->castSafeStrings($reasons)); + $this->assertEquals($expected, $reasons); } /** @@ -160,7 +157,7 @@ public function testValidateNoMatchingFormats() { 'Provides a filter plugin that is in use in the following filter formats: Filter Format 1 Label, Filter Format 2 Label', ]; $reasons = $this->filterUninstallValidator->validate($this->randomMachineName()); - $this->assertSame($expected, $this->castSafeStrings($reasons)); + $this->assertEquals($expected, $reasons); } } diff --git a/core/modules/forum/tests/src/Unit/ForumUninstallValidatorTest.php b/core/modules/forum/tests/src/Unit/ForumUninstallValidatorTest.php index 6166ea91..e41e60c7 100644 --- a/core/modules/forum/tests/src/Unit/ForumUninstallValidatorTest.php +++ b/core/modules/forum/tests/src/Unit/ForumUninstallValidatorTest.php @@ -3,7 +3,6 @@ namespace Drupal\Tests\forum\Unit; use Drupal\Core\Url; -use Drupal\Tests\AssertHelperTrait; use Drupal\Tests\UnitTestCase; /** @@ -12,8 +11,6 @@ */ class ForumUninstallValidatorTest extends UnitTestCase { - use AssertHelperTrait; - /** * @var \Drupal\forum\ForumUninstallValidator|\PHPUnit\Framework\MockObject\MockObject */ @@ -45,7 +42,7 @@ public function testValidateNotForum() { $module = 'not_forum'; $expected = []; $reasons = $this->forumUninstallValidator->validate($module); - $this->assertSame($expected, $this->castSafeStrings($reasons)); + $this->assertEquals($expected, $reasons); } /** @@ -68,7 +65,7 @@ public function testValidate() { $module = 'forum'; $expected = []; $reasons = $this->forumUninstallValidator->validate($module); - $this->assertSame($expected, $this->castSafeStrings($reasons)); + $this->assertEquals($expected, $reasons); } /** @@ -93,7 +90,7 @@ public function testValidateHasForumNodes() { 'To uninstall Forum, first delete all Forum content', ]; $reasons = $this->forumUninstallValidator->validate($module); - $this->assertSame($expected, $this->castSafeStrings($reasons)); + $this->assertEquals($expected, $reasons); } /** @@ -131,7 +128,7 @@ public function testValidateHasTermsForVocabularyWithNodesAccess() { 'To uninstall Forum, first delete all Vocabulary label terms', ]; $reasons = $this->forumUninstallValidator->validate($module); - $this->assertSame($expected, $this->castSafeStrings($reasons)); + $this->assertEquals($expected, $reasons); } /** @@ -165,7 +162,7 @@ public function testValidateHasTermsForVocabularyWithNodesNoAccess() { 'To uninstall Forum, first delete all Vocabulary label terms', ]; $reasons = $this->forumUninstallValidator->validate($module); - $this->assertSame($expected, $this->castSafeStrings($reasons)); + $this->assertEquals($expected, $reasons); } /** @@ -202,7 +199,7 @@ public function testValidateHasTermsForVocabularyAccess() { 'To uninstall Forum, first delete all Vocabulary label terms', ]; $reasons = $this->forumUninstallValidator->validate($module); - $this->assertSame($expected, $this->castSafeStrings($reasons)); + $this->assertEquals($expected, $reasons); } /** @@ -235,7 +232,7 @@ public function testValidateHasTermsForVocabularyNoAccess() { 'To uninstall Forum, first delete all Vocabulary label terms', ]; $reasons = $this->forumUninstallValidator->validate($module); - $this->assertSame($expected, $this->castSafeStrings($reasons)); + $this->assertEquals($expected, $reasons); } } diff --git a/core/modules/rest/tests/src/Functional/Views/StyleSerializerTest.php b/core/modules/rest/tests/src/Functional/Views/StyleSerializerTest.php index 094d8797..9a374a90 100644 --- a/core/modules/rest/tests/src/Functional/Views/StyleSerializerTest.php +++ b/core/modules/rest/tests/src/Functional/Views/StyleSerializerTest.php @@ -462,7 +462,7 @@ public function testUIFieldAlias() { $expected[] = $expected_row; } - $this->assertIdentical(Json::decode($this->drupalGet('test/serialize/field', ['query' => ['_format' => 'json']])), $this->castSafeStrings($expected)); + $this->assertEquals($expected, Json::decode($this->drupalGet('test/serialize/field', ['query' => ['_format' => 'json']]))); // Test a random aliases for fields, they should be replaced. $alias_map = [ @@ -497,7 +497,7 @@ public function testUIFieldAlias() { $expected[] = $expected_row; } - $this->assertIdentical(Json::decode($this->drupalGet('test/serialize/field', ['query' => ['_format' => 'json']])), $this->castSafeStrings($expected)); + $this->assertEquals($expected, Json::decode($this->drupalGet('test/serialize/field', ['query' => ['_format' => 'json']]))); } /** diff --git a/core/modules/views/tests/src/Kernel/ModuleTest.php b/core/modules/views/tests/src/Kernel/ModuleTest.php index db43e96c..6eebd4a9 100644 --- a/core/modules/views/tests/src/Kernel/ModuleTest.php +++ b/core/modules/views/tests/src/Kernel/ModuleTest.php @@ -176,14 +176,14 @@ public function testLoadFunctions() { foreach ($all_views as $id => $view) { $expected_options[$id] = $view->label(); } - $this->assertIdentical($expected_options, $this->castSafeStrings(Views::getViewsAsOptions(TRUE)), 'Expected options array was returned.'); + $this->assertIdentical($expected_options, Views::getViewsAsOptions(TRUE), 'Expected options array was returned.'); // Test the default. - $this->assertIdentical($this->formatViewOptions($all_views), $this->castSafeStrings(Views::getViewsAsOptions()), 'Expected options array for all views was returned.'); + $this->assertEquals($this->formatViewOptions($all_views), Views::getViewsAsOptions(), 'Expected options array for all views was returned.'); // Test enabled views. - $this->assertIdentical($this->formatViewOptions($expected_enabled), $this->castSafeStrings(Views::getViewsAsOptions(FALSE, 'enabled')), 'Expected enabled options array was returned.'); + $this->assertEquals($this->formatViewOptions($expected_enabled), Views::getViewsAsOptions(FALSE, 'enabled'), 'Expected enabled options array was returned.'); // Test disabled views. - $this->assertIdentical($this->formatViewOptions($expected_disabled), $this->castSafeStrings(Views::getViewsAsOptions(FALSE, 'disabled')), 'Expected disabled options array was returned.'); + $this->assertEquals($this->formatViewOptions($expected_disabled), Views::getViewsAsOptions(FALSE, 'disabled'), 'Expected disabled options array was returned.'); // Test the sort parameter. $all_views_sorted = $all_views; @@ -202,7 +202,7 @@ public function testLoadFunctions() { $expected_opt_groups[$view->id()][$view->id() . ':' . $display['id']] = (string) t('@view : @display', ['@view' => $view->id(), '@display' => $display['id']]); } } - $this->assertIdentical($expected_opt_groups, $this->castSafeStrings(Views::getViewsAsOptions(FALSE, 'all', NULL, TRUE)), 'Expected option array for an option group returned.'); + $this->assertEquals($expected_opt_groups, Views::getViewsAsOptions(FALSE, 'all', NULL, TRUE), 'Expected option array for an option group returned.'); } /** diff --git a/core/tests/Drupal/KernelTests/AssertContentTrait.php b/core/tests/Drupal/KernelTests/AssertContentTrait.php index c2bd3257..c71543f8 100644 --- a/core/tests/Drupal/KernelTests/AssertContentTrait.php +++ b/core/tests/Drupal/KernelTests/AssertContentTrait.php @@ -801,8 +801,6 @@ protected function assertTitle($title, $message = '', $group = 'Other') { preg_match('@