diff -u b/core/modules/block/tests/src/Functional/BlockTest.php b/core/modules/block/tests/src/Functional/BlockTest.php --- b/core/modules/block/tests/src/Functional/BlockTest.php +++ b/core/modules/block/tests/src/Functional/BlockTest.php @@ -253,7 +253,7 @@ $theme_settings = $this->config('system.theme'); foreach (['bartik', 'seven', 'stark'] as $theme) { $this->drupalGet('admin/structure/block/list/' . $theme); - $this->assertSession()->titleEquals(t('Block layout') . ' | Drupal'); + $this->assertSession()->titleEquals((string) t('Block layout') . ' | Drupal'); // Select the 'Powered by Drupal' block to be placed. $block = []; $block['id'] = strtolower($this->randomMachineName()); diff -u b/core/modules/block_content/tests/src/Functional/BlockContentListTest.php b/core/modules/block_content/tests/src/Functional/BlockContentListTest.php --- b/core/modules/block_content/tests/src/Functional/BlockContentListTest.php +++ b/core/modules/block_content/tests/src/Functional/BlockContentListTest.php @@ -35,7 +35,7 @@ $this->drupalGet('admin/structure/block/block-content'); // Test for the page title. - $this->assertSession()->titleEquals(t('Custom block library') . ' | Drupal'); + $this->assertSession()->titleEquals((string) t('Custom block library') . ' | Drupal'); // Test for the table. $element = $this->xpath('//div[@class="layout-content"]//table'); diff -u b/core/modules/block_content/tests/src/Functional/BlockContentListViewsTest.php b/core/modules/block_content/tests/src/Functional/BlockContentListViewsTest.php --- b/core/modules/block_content/tests/src/Functional/BlockContentListViewsTest.php +++ b/core/modules/block_content/tests/src/Functional/BlockContentListViewsTest.php @@ -38,7 +38,7 @@ $this->drupalGet('admin/structure/block/block-content'); // Test for the page title. - $this->assertSession()->titleEquals(t('Custom block library') . ' | Drupal'); + $this->assertSession()->titleEquals((string) t('Custom block library') . ' | Drupal'); // Test for the exposed filters. $this->assertFieldByName('info'); diff -u b/core/modules/block_content/tests/src/Functional/BlockContentTypeTest.php b/core/modules/block_content/tests/src/Functional/BlockContentTypeTest.php --- b/core/modules/block_content/tests/src/Functional/BlockContentTypeTest.php +++ b/core/modules/block_content/tests/src/Functional/BlockContentTypeTest.php @@ -121,7 +121,7 @@ 'label' => 'Bar', ]; $this->drupalGet('admin/structure/block/block-content/manage/basic'); - $this->assertSession()->titleEquals(new FormattableMarkup('Edit @type custom block type | Drupal', ['@type' => 'basic'])); + $this->assertSession()->titleEquals((string) new FormattableMarkup('Edit @type custom block type | Drupal', ['@type' => 'basic'])); $this->drupalPostForm(NULL, $edit, t('Save')); $front_page_path = Url::fromRoute('')->toString(); $this->assertBreadcrumb('admin/structure/block/block-content/manage/basic/fields', [ diff -u b/core/modules/comment/tests/src/Functional/CommentInterfaceTest.php b/core/modules/comment/tests/src/Functional/CommentInterfaceTest.php --- b/core/modules/comment/tests/src/Functional/CommentInterfaceTest.php +++ b/core/modules/comment/tests/src/Functional/CommentInterfaceTest.php @@ -97,7 +97,7 @@ $this->setCommentPreview(DRUPAL_OPTIONAL); $this->drupalGet('comment/' . $comment->id() . '/edit'); - $this->assertSession()->titleEquals(t('Edit comment @title | Drupal', [ + $this->assertSession()->titleEquals((string) t('Edit comment @title | Drupal', [ '@title' => $comment->getSubject(), ])); diff -u b/core/modules/comment/tests/src/Functional/CommentPreviewTest.php b/core/modules/comment/tests/src/Functional/CommentPreviewTest.php --- b/core/modules/comment/tests/src/Functional/CommentPreviewTest.php +++ b/core/modules/comment/tests/src/Functional/CommentPreviewTest.php @@ -67,7 +67,7 @@ $this->drupalPostForm('node/' . $this->node->id(), $edit, t('Preview')); // Check that the preview is displaying the title and body. - $this->assertSession()->titleEquals(t('Preview comment | Drupal'), 'Page title is "Preview comment".'); + $this->assertSession()->titleEquals((string) t('Preview comment | Drupal'), 'Page title is "Preview comment".'); $this->assertText($edit['subject[0][value]'], 'Subject displayed.'); $this->assertText($edit['comment_body[0][value]'], 'Comment displayed.'); @@ -101,7 +101,7 @@ $this->drupalPostForm('node/' . $this->node->id(), $edit, t('Preview')); // Check that the preview is displaying the title and body. - $this->assertSession()->titleEquals(t('Preview comment | Drupal'), 'Page title is "Preview comment".'); + $this->assertSession()->titleEquals((string) t('Preview comment | Drupal'), 'Page title is "Preview comment".'); $this->assertText($edit['subject[0][value]'], 'Subject displayed.'); $this->assertText($edit['comment_body[0][value]'], 'Comment displayed.'); @@ -150,7 +150,7 @@ $this->drupalPostForm('comment/' . $comment->id() . '/edit', $edit, t('Preview')); // Check that the preview is displaying the subject, comment, author and date correctly. - $this->assertSession()->titleEquals(t('Preview comment | Drupal'), 'Page title is "Preview comment".'); + $this->assertSession()->titleEquals((string) t('Preview comment | Drupal'), 'Page title is "Preview comment".'); $this->assertText($edit['subject[0][value]'], 'Subject displayed.'); $this->assertText($edit['comment_body[0][value]'], 'Comment displayed.'); $this->assertText($web_user->getAccountName(), 'Author displayed.'); diff -u b/core/modules/config/tests/src/Functional/ConfigImportUITest.php b/core/modules/config/tests/src/Functional/ConfigImportUITest.php --- b/core/modules/config/tests/src/Functional/ConfigImportUITest.php +++ b/core/modules/config/tests/src/Functional/ConfigImportUITest.php @@ -301,7 +301,7 @@ // Load the diff UI and verify that the diff reflects the change. $this->drupalGet('admin/config/development/configuration/sync/diff/' . $config_name); $this->assertNoRaw(' '); - $this->assertSession()->titleEquals(new FormattableMarkup('View changes of @config_name | Drupal', ['@config_name' => $config_name])); + $this->assertSession()->titleEquals((string) new FormattableMarkup('View changes of @config_name | Drupal', ['@config_name' => $config_name])); // The following assertions do not use $this::assertEscaped() because // \Drupal\Component\Diff\DiffFormatter adds markup that signifies what has diff -u b/core/modules/content_translation/tests/src/Functional/Views/ContentTranslationViewsUITest.php b/core/modules/content_translation/tests/src/Functional/Views/ContentTranslationViewsUITest.php --- b/core/modules/content_translation/tests/src/Functional/Views/ContentTranslationViewsUITest.php +++ b/core/modules/content_translation/tests/src/Functional/Views/ContentTranslationViewsUITest.php @@ -35,7 +35,7 @@ */ public function testViewsUI() { $this->drupalGet('admin/structure/views/view/test_view/edit'); - $this->assertSession()->titleEquals(t('@label (@table) | @site-name', ['@label' => 'Test view', '@table' => 'Views test data', '@site-name' => $this->config('system.site')->get('name')])); + $this->assertSession()->titleEquals((string) t('@label (@table) | @site-name', ['@label' => 'Test view', '@table' => 'Views test data', '@site-name' => $this->config('system.site')->get('name')])); } } diff -u b/core/modules/file/tests/src/Functional/FileListingTest.php b/core/modules/file/tests/src/Functional/FileListingTest.php --- b/core/modules/file/tests/src/Functional/FileListingTest.php +++ b/core/modules/file/tests/src/Functional/FileListingTest.php @@ -95,7 +95,7 @@ $this->drupalGet('admin/content/files/usage/' . $file->id()); $this->assertSession()->statusCodeEquals(200); - $this->assertSession()->titleEquals(t('File usage information for @file | Drupal', ['@file' => $file->getFilename()])); + $this->assertSession()->titleEquals((string) t('File usage information for @file | Drupal', ['@file' => $file->getFilename()])); foreach ($nodes as &$node) { $this->drupalGet('node/' . $node->id() . '/edit'); diff -u b/core/modules/forum/tests/src/Functional/ForumTest.php b/core/modules/forum/tests/src/Functional/ForumTest.php --- b/core/modules/forum/tests/src/Functional/ForumTest.php +++ b/core/modules/forum/tests/src/Functional/ForumTest.php @@ -246,12 +246,12 @@ // Test the root forum page title change. $this->drupalGet('forum'); $this->assertCacheTag('config:taxonomy.vocabulary.' . $this->forum['vid']); - $this->assertSession()->titleEquals(t('Forums | Drupal')); + $this->assertSession()->titleEquals((string) t('Forums | Drupal')); $vocabulary = Vocabulary::load($this->forum['vid']); $vocabulary->set('name', 'Discussions'); $vocabulary->save(); $this->drupalGet('forum'); - $this->assertSession()->titleEquals(t('Discussions | Drupal')); + $this->assertSession()->titleEquals((string) t('Discussions | Drupal')); // Test anonymous action link. $this->drupalLogout(); @@ -620,7 +620,7 @@ $this->drupalGet('admin/help/forum'); $this->assertSession()->statusCodeEquals($response2); if ($response2 == 200) { - $this->assertSession()->titleEquals(t('Forum | Drupal'), 'Forum help title was displayed'); + $this->assertSession()->titleEquals((string) t('Forum | Drupal'), 'Forum help title was displayed'); $this->assertText(t('Forum'), 'Forum help node was displayed'); } diff -u b/core/modules/image/tests/src/Functional/ImageAdminStylesTest.php b/core/modules/image/tests/src/Functional/ImageAdminStylesTest.php --- b/core/modules/image/tests/src/Functional/ImageAdminStylesTest.php +++ b/core/modules/image/tests/src/Functional/ImageAdminStylesTest.php @@ -216,7 +216,7 @@ // Check that the URL was updated. $this->drupalGet($style_path); - $this->assertSession()->titleEquals(t('Edit style @name | Drupal', ['@name' => $style_label])); + $this->assertSession()->titleEquals((string) t('Edit style @name | Drupal', ['@name' => $style_label])); // Check that the available image effects are properly sorted. $option = $this->xpath('//select[@id=:id]//option', [':id' => 'edit-new--2']); diff -u b/core/modules/language/tests/src/Functional/LanguageListTest.php b/core/modules/language/tests/src/Functional/LanguageListTest.php --- b/core/modules/language/tests/src/Functional/LanguageListTest.php +++ b/core/modules/language/tests/src/Functional/LanguageListTest.php @@ -93,7 +93,7 @@ // Ensure 'Edit' link works. $this->drupalGet('admin/config/regional/language'); $this->clickLink(t('Edit')); - $this->assertSession()->titleEquals(t('Edit language | Drupal'), 'Page title is "Edit language".'); + $this->assertSession()->titleEquals((string) t('Edit language | Drupal'), 'Page title is "Edit language".'); // Edit a language. $name = $this->randomMachineName(16); $edit = [ diff -u b/core/modules/menu_ui/tests/src/Functional/MenuUiTest.php b/core/modules/menu_ui/tests/src/Functional/MenuUiTest.php --- b/core/modules/menu_ui/tests/src/Functional/MenuUiTest.php +++ b/core/modules/menu_ui/tests/src/Functional/MenuUiTest.php @@ -709,7 +709,7 @@ // Verify menu link link. $this->clickLink($title); $title = $parent_node->label(); - $this->assertSession()->titleEquals(t("@title | Drupal", ['@title' => $title]), 'Parent menu link link target was correct'); + $this->assertSession()->titleEquals((string) t("@title | Drupal", ['@title' => $title]), 'Parent menu link link target was correct'); } // Verify menu link. @@ -719,7 +719,7 @@ // Verify menu link link. $this->clickLink($title); $title = $item_node->label(); - $this->assertSession()->titleEquals(t("@title | Drupal", ['@title' => $title]), 'Menu link link target was correct'); + $this->assertSession()->titleEquals((string) t("@title | Drupal", ['@title' => $title]), 'Menu link link target was correct'); } /** diff -u b/core/modules/node/tests/src/Functional/PagePreviewTest.php b/core/modules/node/tests/src/Functional/PagePreviewTest.php --- b/core/modules/node/tests/src/Functional/PagePreviewTest.php +++ b/core/modules/node/tests/src/Functional/PagePreviewTest.php @@ -440,7 +440,7 @@ $this->drupalPostForm('node/add/page', $edit, t('Preview')); // Check that the preview is displaying the title, body and term. - $this->assertSession()->titleEquals(t('@title | Drupal', ['@title' => $edit[$title_key]]), 'Basic page title is preview.'); + $this->assertSession()->titleEquals((string) t('@title | Drupal', ['@title' => $edit[$title_key]]), 'Basic page title is preview.'); $this->assertText($edit[$title_key], 'Title displayed.'); $this->assertText($edit[$body_key], 'Body displayed.'); $this->assertText($edit[$term_key], 'Term displayed.'); diff -u b/core/modules/search/tests/src/Functional/SearchPageTextTest.php b/core/modules/search/tests/src/Functional/SearchPageTextTest.php --- b/core/modules/search/tests/src/Functional/SearchPageTextTest.php +++ b/core/modules/search/tests/src/Functional/SearchPageTextTest.php @@ -77,7 +77,7 @@ $this->assertText('search yielded no results'); $this->assertText(t('Search')); $title_source = 'Search for @keywords | Drupal'; - $this->assertSession()->titleEquals(t($title_source, ['@keywords' => Unicode::truncate($search_terms, 60, TRUE, TRUE)]), 'Search page title is correct'); + $this->assertSession()->titleEquals((string) t($title_source, ['@keywords' => Unicode::truncate($search_terms, 60, TRUE, TRUE)]), 'Search page title is correct'); $this->assertNoText('Node', 'Erroneous tab and breadcrumb text is not present'); $this->assertNoText(t('Node'), 'Erroneous translated tab and breadcrumb text is not present'); $this->assertText(t('Content'), 'Tab and breadcrumb text is present'); @@ -91,7 +91,7 @@ $search_terms = 'Every word is like an unnecessary stain on silence and nothingness.'; $edit['keys'] = $search_terms; $this->drupalPostForm('search/node', $edit, t('Search')); - $this->assertSession()->titleEquals(t($title_source, ['@keywords' => 'Every word is like an unnecessary stain on silence and…']), 'Search page title is correct'); + $this->assertSession()->titleEquals((string) t($title_source, ['@keywords' => 'Every word is like an unnecessary stain on silence and…']), 'Search page title is correct'); // Search for a string with a lot of special characters. $search_terms = 'Hear nothing > "see nothing" `feel' . " '1982."; @@ -103,7 +103,7 @@ $edit['keys'] = $this->searchingUser->getAccountName(); $this->drupalPostForm('search/user', $edit, t('Search')); $this->assertText(t('Search')); - $this->assertSession()->titleEquals(t($title_source, ['@keywords' => Unicode::truncate($this->searchingUser->getAccountName(), 60, TRUE, TRUE)])); + $this->assertSession()->titleEquals((string) t($title_source, ['@keywords' => Unicode::truncate($this->searchingUser->getAccountName(), 60, TRUE, TRUE)])); $this->clickLink('Search help'); $this->assertText('Search help', 'Correct title is on search help page'); diff -u b/core/modules/system/tests/src/Functional/Form/ConfirmFormTest.php b/core/modules/system/tests/src/Functional/Form/ConfirmFormTest.php --- b/core/modules/system/tests/src/Functional/Form/ConfirmFormTest.php +++ b/core/modules/system/tests/src/Functional/Form/ConfirmFormTest.php @@ -29,7 +29,7 @@ // Test the building of the form. $this->drupalGet('form-test/confirm-form'); $site_name = $this->config('system.site')->get('name'); - $this->assertSession()->titleEquals(t('ConfirmFormTestForm::getQuestion(). | @site-name', ['@site-name' => $site_name]), 'The question was found as the page title.'); + $this->assertSession()->titleEquals((string) t('ConfirmFormTestForm::getQuestion(). | @site-name', ['@site-name' => $site_name]), 'The question was found as the page title.'); $this->assertText(t('ConfirmFormTestForm::getDescription().'), 'The description was used.'); $this->assertFieldByXPath('//input[@id="edit-submit"]', t('ConfirmFormTestForm::getConfirmText().'), 'The confirm text was used.'); diff -u b/core/modules/taxonomy/tests/src/Functional/VocabularyUiTest.php b/core/modules/taxonomy/tests/src/Functional/VocabularyUiTest.php --- b/core/modules/taxonomy/tests/src/Functional/VocabularyUiTest.php +++ b/core/modules/taxonomy/tests/src/Functional/VocabularyUiTest.php @@ -81,7 +81,7 @@ $this->drupalPostForm('admin/structure/taxonomy/add', $edit, t('Save')); $site_name = $this->config('system.site')->get('name'); - $this->assertSession()->titleEquals(t("Don't Panic | @site-name", ['@site-name' => $site_name]), 'The page title contains the escaped character.'); + $this->assertSession()->titleEquals((string) t("Don't Panic | @site-name", ['@site-name' => $site_name]), 'The page title contains the escaped character.'); } /** diff -u b/core/modules/tracker/tests/src/Functional/TrackerTest.php b/core/modules/tracker/tests/src/Functional/TrackerTest.php --- b/core/modules/tracker/tests/src/Functional/TrackerTest.php +++ b/core/modules/tracker/tests/src/Functional/TrackerTest.php @@ -212,7 +212,7 @@ $this->assertNoLink($unpublished->label()); // Verify that title and tab title have been set correctly. $this->assertText('Activity', 'The user activity tab has the name "Activity".'); - $this->assertSession()->titleEquals(t('@name | @site', ['@name' => $this->user->getAccountName(), '@site' => $this->config('system.site')->get('name')]), 'The user tracker page has the correct page title.'); + $this->assertSession()->titleEquals((string) t('@name | @site', ['@name' => $this->user->getAccountName(), '@site' => $this->config('system.site')->get('name')]), 'The user tracker page has the correct page title.'); // Verify that unpublished comments are removed from the tracker. $admin_user = $this->drupalCreateUser(['post comments', 'administer comments', 'access user profiles']); diff -u b/core/modules/user/tests/src/Functional/UserPasswordResetTest.php b/core/modules/user/tests/src/Functional/UserPasswordResetTest.php --- b/core/modules/user/tests/src/Functional/UserPasswordResetTest.php +++ b/core/modules/user/tests/src/Functional/UserPasswordResetTest.php @@ -105,12 +105,12 @@ // Check the one-time login page. $this->assertText($this->account->getAccountName(), 'One-time login page contains the correct username.'); $this->assertText(t('This login can be used only once.'), 'Found warning about one-time login.'); - $this->assertSession()->titleEquals(t('Reset password | Drupal'), 'Page title is "Reset password".'); + $this->assertSession()->titleEquals((string) t('Reset password | Drupal'), 'Page title is "Reset password".'); // Check successful login. $this->drupalPostForm(NULL, NULL, t('Log in')); $this->assertLink(t('Log out')); - $this->assertSession()->titleEquals(t('@name | @site', ['@name' => $this->account->getAccountName(), '@site' => $this->config('system.site')->get('name')]), 'Logged in using password reset link.'); + $this->assertSession()->titleEquals((string) t('@name | @site', ['@name' => $this->account->getAccountName(), '@site' => $this->config('system.site')->get('name')]), 'Logged in using password reset link.'); // Change the forgotten password. $password = user_password(); @@ -189,7 +189,7 @@ $reset_url = $this->getResetURL(); $this->drupalGet($reset_url . '/login'); $this->assertLink(t('Log out')); - $this->assertSession()->titleEquals(t('@name | @site', ['@name' => $this->account->getAccountName(), '@site' => $this->config('system.site')->get('name')]), 'Logged in using password reset link.'); + $this->assertSession()->titleEquals((string) t('@name | @site', ['@name' => $this->account->getAccountName(), '@site' => $this->config('system.site')->get('name')]), 'Logged in using password reset link.'); // Ensure blocked and deleted accounts can't access the user.reset.login // route. @@ -359,7 +359,7 @@ $reset_url = $this->getResetURL(); $this->drupalGet($reset_url . '/login'); $this->assertLink(t('Log out')); - $this->assertSession()->titleEquals(t('@name | @site', ['@name' => $this->account->getAccountName(), '@site' => $this->config('system.site')->get('name')]), 'Logged in using password reset link.'); + $this->assertSession()->titleEquals((string) t('@name | @site', ['@name' => $this->account->getAccountName(), '@site' => $this->config('system.site')->get('name')]), 'Logged in using password reset link.'); $this->drupalLogout(); // The next request should *not* trigger flood control, since a successful diff -u b/core/modules/user/tests/src/Functional/UserRegistrationTest.php b/core/modules/user/tests/src/Functional/UserRegistrationTest.php --- b/core/modules/user/tests/src/Functional/UserRegistrationTest.php +++ b/core/modules/user/tests/src/Functional/UserRegistrationTest.php @@ -55,7 +55,7 @@ $this->assertTrue($new_user->isActive(), 'New account is active after registration.'); $resetURL = user_pass_reset_url($new_user); $this->drupalGet($resetURL); - $this->assertSession()->titleEquals(t('Set password | Drupal'), 'Page title is "Set password".'); + $this->assertSession()->titleEquals((string) t('Set password | Drupal'), 'Page title is "Set password".'); // Allow registration by site visitors, but require administrator approval. $config->set('register', UserInterface::REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL)->save(); diff -u b/core/modules/views/tests/src/Functional/Plugin/DisplayPageWebTest.php b/core/modules/views/tests/src/Functional/Plugin/DisplayPageWebTest.php --- b/core/modules/views/tests/src/Functional/Plugin/DisplayPageWebTest.php +++ b/core/modules/views/tests/src/Functional/Plugin/DisplayPageWebTest.php @@ -99,7 +99,7 @@ ':a_class' => 'is-active', ]); $this->assertEqual($element[0]->getText(), t('Test default tab')); - $this->assertSession()->titleEquals(t('Test default page | Drupal')); + $this->assertSession()->titleEquals((string) t('Test default page | Drupal')); $this->drupalGet('test_page_display_menu/default'); $this->assertSession()->statusCodeEquals(404); @@ -111,7 +111,7 @@ ':a_class' => 'is-active', ]); $this->assertEqual($element[0]->getText(), t('Test local tab')); - $this->assertSession()->titleEquals(t('Test local page | Drupal')); + $this->assertSession()->titleEquals((string) t('Test local page | Drupal')); // Check an ordinary menu link. $admin_user = $this->drupalCreateUser(['administer menu']); diff -u b/core/modules/views_ui/tests/src/Functional/DefaultViewsTest.php b/core/modules/views_ui/tests/src/Functional/DefaultViewsTest.php --- b/core/modules/views_ui/tests/src/Functional/DefaultViewsTest.php +++ b/core/modules/views_ui/tests/src/Functional/DefaultViewsTest.php @@ -93,7 +93,7 @@ $edit = [ 'id' => 'duplicate_of_glossary', ]; - $this->assertSession()->titleEquals(t('Duplicate of @label | @site-name', ['@label' => 'Glossary', '@site-name' => $this->config('system.site')->get('name')])); + $this->assertSession()->titleEquals((string) t('Duplicate of @label | @site-name', ['@label' => 'Glossary', '@site-name' => $this->config('system.site')->get('name')])); $this->drupalPostForm(NULL, $edit, t('Duplicate')); $this->assertUrl('admin/structure/views/view/duplicate_of_glossary', [], 'The normal duplicating name schema is applied.'); reverted: --- b/core/tests/Drupal/FunctionalTests/BrowserTestBaseTest.php +++ a/core/tests/Drupal/FunctionalTests/BrowserTestBaseTest.php @@ -249,17 +249,6 @@ $this->assertResponse(200); } - /** - * Tests legacy assertTitle(). - * - * @group legacy - * @expectedDeprecation AssertLegacyTrait::assertTitle() is deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use $this->assertSession()->titleEquals() instead. See https://www.drupal.org/node/3129738 - */ - public function testAssertTitle() { - $this->drupalGet('test-encoded'); - $this->assertTitle("Page with encoded HTML | Drupal"); - } - /** * Tests legacy text asserts. */