From 82949679ceac72d130bc29ab697537a91bff74f0 Mon Sep 17 00:00:00 2001
From: Lee Rowlands <lee.rowlands@previousnext.com.au>
Date: Fri, 28 Aug 2020 11:22:44 +1000
Subject: [PATCH] Issue #3143870 by mondrake, pavnish, longwave: Calls to
 AssertLegacyTrait::assertUrl() have wrong number of arguments

---
 .../tests/src/Functional/AddFeedTest.php       |  2 +-
 .../tests/src/Functional/UpdateFeedTest.php    |  2 +-
 .../src/Functional/BlockContentTypeTest.php    |  9 +++++----
 .../src/Functional/CommentInterfaceTest.php    |  2 +-
 .../tests/src/Functional/CommentTypeTest.php   |  3 ++-
 .../tests/src/Functional/Views/WizardTest.php  |  8 ++++++--
 .../ContentTranslationWorkflowsTest.php        | 10 +++++-----
 .../Functional/ManageFieldsFunctionalTest.php  |  2 +-
 .../LanguageBrowserDetectionTest.php           |  6 +++---
 .../Functional/LanguageConfigurationTest.php   |  4 ++--
 ...LanguageCustomLanguageConfigurationTest.php | 10 +++++-----
 .../tests/src/Functional/LanguageListTest.php  | 18 +++++++++---------
 .../src/Functional/LanguageLocaleListTest.php  |  2 +-
 .../Functional/LocaleImportFunctionalTest.php  |  4 ++--
 .../tests/src/Functional/NodeEditFormTest.php  |  2 +-
 .../tests/src/Functional/PagePreviewTest.php   |  4 ++--
 .../src/Functional/SearchLanguageTest.php      |  2 +-
 .../src/Functional/Form/ConfirmFormTest.php    |  6 +++---
 .../tests/src/Functional/Form/RedirectTest.php | 12 ++++++------
 .../src/Functional/Menu/MenuRouterTest.php     |  4 ++--
 .../Module/ExperimentalModuleTest.php          |  4 +++-
 .../Functional/Module/PrepareUninstallTest.php |  4 ++--
 .../tests/src/Functional/System/AdminTest.php  |  8 ++++++--
 .../src/Functional/System/DateTimeTest.php     | 18 ++++++++++++------
 .../src/Functional/ToolbarAdminMenuTest.php    |  3 ++-
 .../tests/src/Functional/UserBlocksTest.php    |  4 ++--
 .../tests/src/Functional/UserLoginTest.php     |  3 ++-
 .../src/Functional/UserPasswordResetTest.php   |  2 +-
 .../tests/src/Functional/CachedDataUITest.php  |  2 +-
 .../tests/src/Functional/DefaultViewsTest.php  |  4 ++--
 .../tests/src/Functional/DisplayCRUDTest.php   |  5 +++--
 .../tests/src/Functional/DuplicateTest.php     |  2 +-
 .../tests/src/Functional/ExposedFormUITest.php |  8 ++++----
 .../tests/src/Functional/HandlerTest.php       |  9 ++++++---
 .../tests/src/Functional/RedirectTest.php      |  8 ++++++--
 .../tests/src/Functional/ViewEditTest.php      |  3 ++-
 .../tests/src/Functional/WizardTest.php        |  4 +++-
 .../FunctionalTests/AssertLegacyTrait.php      |  3 +++
 .../Core/Assert/AssertLegacyTraitTest.php      | 12 ++++++++++++
 39 files changed, 132 insertions(+), 86 deletions(-)

diff --git a/core/modules/aggregator/tests/src/Functional/AddFeedTest.php b/core/modules/aggregator/tests/src/Functional/AddFeedTest.php
index 9837c5a15efd..caf0642b9549 100644
--- a/core/modules/aggregator/tests/src/Functional/AddFeedTest.php
+++ b/core/modules/aggregator/tests/src/Functional/AddFeedTest.php
@@ -30,7 +30,7 @@ public function testAddFeed() {
     $feed->refreshItems();
 
     // Check feed data.
-    $this->assertUrl(Url::fromRoute('aggregator.feed_add', [], ['absolute' => TRUE])->toString(), [], 'Directed to correct URL.');
+    $this->assertUrl(Url::fromRoute('aggregator.feed_add'));
     $this->assertTrue($this->uniqueFeed($feed->label(), $feed->getUrl()), 'The feed is unique.');
 
     // Check feed source.
diff --git a/core/modules/aggregator/tests/src/Functional/UpdateFeedTest.php b/core/modules/aggregator/tests/src/Functional/UpdateFeedTest.php
index 798bc5578129..86f4bf2750de 100644
--- a/core/modules/aggregator/tests/src/Functional/UpdateFeedTest.php
+++ b/core/modules/aggregator/tests/src/Functional/UpdateFeedTest.php
@@ -39,7 +39,7 @@ public function testUpdateFeed() {
       $this->assert(isset($view_link), 'The message area contains a link to a feed');
 
       // Check feed data.
-      $this->assertUrl($feed->toUrl('canonical', ['absolute' => TRUE])->toString());
+      $this->assertUrl($feed->toUrl('canonical'));
       $this->assertTrue($this->uniqueFeed($edit['title[0][value]'], $edit['url[0][value]']), 'The feed is unique.');
 
       // Check feed source.
diff --git a/core/modules/block_content/tests/src/Functional/BlockContentTypeTest.php b/core/modules/block_content/tests/src/Functional/BlockContentTypeTest.php
index 38ea25e555c0..867e8381d123 100644
--- a/core/modules/block_content/tests/src/Functional/BlockContentTypeTest.php
+++ b/core/modules/block_content/tests/src/Functional/BlockContentTypeTest.php
@@ -134,7 +134,8 @@ public function testBlockContentTypeEditing() {
     $this->drupalGet('block/add');
     $this->assertRaw('Bar', 'New name was displayed.');
     $this->clickLink('Bar');
-    $this->assertUrl(Url::fromRoute('block_content.add_form', ['block_content_type' => 'basic'], ['absolute' => TRUE])->toString(), [], 'Original machine name was used in URL.');
+    // Verify that the original machine name was used in the URL.
+    $this->assertUrl(Url::fromRoute('block_content.add_form', ['block_content_type' => 'basic']));
 
     // Remove the body field.
     $this->drupalPostForm('admin/structure/block/block-content/manage/basic/fields/block_content.basic.body/delete', [], t('Delete'));
@@ -226,9 +227,9 @@ public function testsBlockContentAddTypes() {
         $blocks = $storage->loadByProperties(['info' => $edit['info[0][value]']]);
         if (!empty($blocks)) {
           $block = reset($blocks);
-          $this->assertUrl(Url::fromRoute('block.admin_add', ['plugin_id' => 'block_content:' . $block->uuid(), 'theme' => $theme], ['absolute' => TRUE])->toString());
+          $this->assertUrl(Url::fromRoute('block.admin_add', ['plugin_id' => 'block_content:' . $block->uuid(), 'theme' => $theme]));
           $this->drupalPostForm(NULL, ['region' => 'content'], t('Save block'));
-          $this->assertUrl(Url::fromRoute('block.admin_display_theme', ['theme' => $theme], ['absolute' => TRUE, 'query' => ['block-placement' => Html::getClass($edit['info[0][value]'])]])->toString());
+          $this->assertUrl(Url::fromRoute('block.admin_display_theme', ['theme' => $theme], ['query' => ['block-placement' => Html::getClass($edit['info[0][value]'])]]));
         }
         else {
           $this->fail('Could not load created block.');
@@ -245,7 +246,7 @@ public function testsBlockContentAddTypes() {
     $this->drupalPostForm(NULL, $edit, t('Save'));
     $blocks = $storage->loadByProperties(['info' => $edit['info[0][value]']]);
     if (!empty($blocks)) {
-      $this->assertUrl(Url::fromRoute('entity.block_content.collection', [], ['absolute' => TRUE])->toString());
+      $this->assertUrl(Url::fromRoute('entity.block_content.collection'));
     }
     else {
       $this->fail('Could not load created block.');
diff --git a/core/modules/comment/tests/src/Functional/CommentInterfaceTest.php b/core/modules/comment/tests/src/Functional/CommentInterfaceTest.php
index cdf3e5cbc2b6..4998f43d4687 100644
--- a/core/modules/comment/tests/src/Functional/CommentInterfaceTest.php
+++ b/core/modules/comment/tests/src/Functional/CommentInterfaceTest.php
@@ -124,7 +124,7 @@ public function testCommentInterface() {
     // \Drupal\comment\Controller\CommentController::redirectNode().
     $this->drupalGet('comment/' . $this->node->id() . '/reply');
     // Verify we were correctly redirected.
-    $this->assertUrl(Url::fromRoute('comment.reply', ['entity_type' => 'node', 'entity' => $this->node->id(), 'field_name' => 'comment'], ['absolute' => TRUE])->toString());
+    $this->assertUrl(Url::fromRoute('comment.reply', ['entity_type' => 'node', 'entity' => $this->node->id(), 'field_name' => 'comment']));
     $this->drupalGet('comment/reply/node/' . $this->node->id() . '/comment/' . $comment->id());
     $this->assertText($subject_text, 'Individual comment-reply subject found.');
     $this->assertText($comment_text, 'Individual comment-reply body found.');
diff --git a/core/modules/comment/tests/src/Functional/CommentTypeTest.php b/core/modules/comment/tests/src/Functional/CommentTypeTest.php
index d1ca4ee5e7f7..5d41ad52ff4c 100644
--- a/core/modules/comment/tests/src/Functional/CommentTypeTest.php
+++ b/core/modules/comment/tests/src/Functional/CommentTypeTest.php
@@ -114,7 +114,8 @@ public function testCommentTypeEditing() {
     $this->drupalGet('admin/structure/comment');
     $this->assertRaw('Bar', 'New name was displayed.');
     $this->clickLink('Manage fields');
-    $this->assertUrl(Url::fromRoute('entity.comment.field_ui_fields', ['comment_type' => 'comment'], ['absolute' => TRUE])->toString(), [], 'Original machine name was used in URL.');
+    // Verify that the original machine name was used in the URL.
+    $this->assertUrl(Url::fromRoute('entity.comment.field_ui_fields', ['comment_type' => 'comment']));
     $this->assertCount(1, $this->cssSelect('tr#comment-body'), 'Body field exists.');
 
     // Remove the body field.
diff --git a/core/modules/comment/tests/src/Functional/Views/WizardTest.php b/core/modules/comment/tests/src/Functional/Views/WizardTest.php
index 933c4d5d45bc..77f5137c8a90 100644
--- a/core/modules/comment/tests/src/Functional/Views/WizardTest.php
+++ b/core/modules/comment/tests/src/Functional/Views/WizardTest.php
@@ -52,7 +52,9 @@ public function testCommentWizard() {
     // Just triggering the saving should automatically choose a proper row
     // plugin.
     $this->drupalPostForm('admin/structure/views/add', $view, t('Save and edit'));
-    $this->assertUrl('admin/structure/views/view/' . $view['id'], [], 'Make sure the view saving was successful and the browser got redirected to the edit page.');
+    // Verify that the view saving was successful and the browser got redirected
+    // to the edit page.
+    $this->assertUrl('admin/structure/views/view/' . $view['id']);
 
     // If we update the type first we should get a selection of comment valid
     // row plugins as the select field.
@@ -75,7 +77,9 @@ public function testCommentWizard() {
 
     $view['id'] = strtolower($this->randomMachineName(16));
     $this->drupalPostForm(NULL, $view, t('Save and edit'));
-    $this->assertUrl('admin/structure/views/view/' . $view['id'], [], 'Make sure the view saving was successful and the browser got redirected to the edit page.');
+    // Verify that the view saving was successful and the browser got redirected
+    // to the edit page.
+    $this->assertUrl('admin/structure/views/view/' . $view['id']);
 
     $user = $this->drupalCreateUser(['access comments']);
     $this->drupalLogin($user);
diff --git a/core/modules/content_translation/tests/src/Functional/ContentTranslationWorkflowsTest.php b/core/modules/content_translation/tests/src/Functional/ContentTranslationWorkflowsTest.php
index 0624fd85a04c..6d66e3cb5709 100644
--- a/core/modules/content_translation/tests/src/Functional/ContentTranslationWorkflowsTest.php
+++ b/core/modules/content_translation/tests/src/Functional/ContentTranslationWorkflowsTest.php
@@ -329,7 +329,7 @@ protected function doTestWorkflows(UserInterface $user, $expected_status) {
     $add_translation_url = Url::fromRoute("entity.$this->entityTypeId.content_translation_add", [$this->entityTypeId => $this->entity->id(), 'source' => $default_langcode, 'target' => $langcode], $options);
     if ($expected_status['add_translation'] == 200) {
       $this->clickLink('Add');
-      $this->assertUrl($add_translation_url->toString(), [], 'The translation overview points to the translation form when creating translations.');
+      $this->assertUrl($add_translation_url);
       // Check that the translation form does not contain shared elements for
       // translators.
       if ($expected_status['edit'] == 403) {
@@ -354,12 +354,12 @@ protected function doTestWorkflows(UserInterface $user, $expected_status) {
         // An editor should be pointed to the entity form in multilingual mode.
         // We need a new expected edit path with a new language.
         $expected_edit_path = $this->entity->toUrl('edit-form', $options)->toString();
-        $this->assertUrl($expected_edit_path, [], 'The translation overview points to the edit form for editors when editing translations.');
+        $this->assertUrl($expected_edit_path);
       }
       else {
         $this->clickLink('Edit');
         // While a translator should be pointed to the translation form.
-        $this->assertUrl($edit_translation_url->toString(), [], 'The translation overview points to the translation form for translators when editing translations.');
+        $this->assertUrl($edit_translation_url);
         // Check that the translation form does not contain shared elements.
         $this->assertNoSharedElements();
       }
@@ -396,13 +396,13 @@ protected function doTestWorkflows(UserInterface $user, $expected_status) {
         // multilingual mode. We need a new expected delete path with a new
         // language.
         $expected_delete_path = $this->entity->toUrl('delete-form', $options)->toString();
-        $this->assertUrl($expected_delete_path, [], 'The translation overview points to the delete form for editors when deleting translations.');
+        $this->assertUrl($expected_delete_path);
       }
       else {
         $this->clickLink('Delete');
         // While a translator should be pointed to the translation deletion
         // form.
-        $this->assertUrl($delete_translation_url->toString(), [], 'The translation overview points to the translation deletion form for translators when deleting translations.');
+        $this->assertUrl($delete_translation_url);
       }
     }
     else {
diff --git a/core/modules/field_ui/tests/src/Functional/ManageFieldsFunctionalTest.php b/core/modules/field_ui/tests/src/Functional/ManageFieldsFunctionalTest.php
index fa1c89b1098f..2a6b1e45bb2a 100644
--- a/core/modules/field_ui/tests/src/Functional/ManageFieldsFunctionalTest.php
+++ b/core/modules/field_ui/tests/src/Functional/ManageFieldsFunctionalTest.php
@@ -670,7 +670,7 @@ public function testDuplicateFieldName() {
     $this->drupalPostForm($url, $edit, t('Save and continue'));
 
     $this->assertText(t('The machine-readable name is already in use. It must be unique.'));
-    $this->assertUrl($url, [], 'Stayed on the same page.');
+    $this->assertUrl($url);
   }
 
   /**
diff --git a/core/modules/language/tests/src/Functional/LanguageBrowserDetectionTest.php b/core/modules/language/tests/src/Functional/LanguageBrowserDetectionTest.php
index 7d3bbe0ba4ab..680ddb4effc6 100644
--- a/core/modules/language/tests/src/Functional/LanguageBrowserDetectionTest.php
+++ b/core/modules/language/tests/src/Functional/LanguageBrowserDetectionTest.php
@@ -59,7 +59,7 @@ public function testUIBrowserLanguageMappings() {
     $this->assertRaw(t('The mapping for the %browser browser language code has been deleted.', $t_args), 'The test browser language code has been deleted.');
 
     // Check we went back to the browser negotiation mapping overview.
-    $this->assertUrl(Url::fromRoute('language.negotiation_browser', [], ['absolute' => TRUE])->toString());
+    $this->assertUrl(Url::fromRoute('language.negotiation_browser'));
     // Check that Chinese browser language code no longer exists.
     $this->assertSession()->fieldNotExists('edit-mappings-zh-cn-browser-langcode');
 
@@ -69,7 +69,7 @@ public function testUIBrowserLanguageMappings() {
       'new_mapping[drupal_langcode]' => 'en',
     ];
     $this->drupalPostForm('admin/config/regional/language/detection/browser', $edit, t('Save configuration'));
-    $this->assertUrl(Url::fromRoute('language.negotiation_browser', [], ['absolute' => TRUE])->toString());
+    $this->assertUrl(Url::fromRoute('language.negotiation_browser'));
     $this->assertFieldById('edit-mappings-xx-browser-langcode', 'xx');
     $this->assertFieldById('edit-mappings-xx-drupal-langcode', 'en');
 
@@ -91,7 +91,7 @@ public function testUIBrowserLanguageMappings() {
       'mappings[xx][drupal_langcode]' => 'zh-hans',
     ];
     $this->drupalPostForm('admin/config/regional/language/detection/browser', $edit, t('Save configuration'));
-    $this->assertUrl(Url::fromRoute('language.negotiation_browser', [], ['absolute' => TRUE])->toString());
+    $this->assertUrl(Url::fromRoute('language.negotiation_browser'));
     $this->assertFieldById('edit-mappings-xx-browser-langcode', 'xx');
     $this->assertFieldById('edit-mappings-xx-drupal-langcode', 'zh-hans');
   }
diff --git a/core/modules/language/tests/src/Functional/LanguageConfigurationTest.php b/core/modules/language/tests/src/Functional/LanguageConfigurationTest.php
index f316f44b3cac..64f5efa834b2 100644
--- a/core/modules/language/tests/src/Functional/LanguageConfigurationTest.php
+++ b/core/modules/language/tests/src/Functional/LanguageConfigurationTest.php
@@ -56,7 +56,7 @@ public function testLanguageConfiguration() {
     ];
     $this->drupalPostForm(NULL, $edit, 'Add language');
     $this->assertText('French');
-    $this->assertUrl(Url::fromRoute('entity.configurable_language.collection', [], ['absolute' => TRUE])->toString(), [], 'Correct page redirection.');
+    $this->assertUrl(Url::fromRoute('entity.configurable_language.collection'));
     // Langcode for Languages is always 'en'.
     $language = $this->config('language.entity.fr')->get();
     $this->assertEqual($language['langcode'], 'en');
@@ -79,7 +79,7 @@ public function testLanguageConfiguration() {
     $this->drupalPostForm(NULL, $edit, t('Save configuration'));
     $this->rebuildContainer();
     $this->assertSession()->checkboxChecked('edit-site-default-language-fr');
-    $this->assertUrl(Url::fromRoute('entity.configurable_language.collection', [], ['absolute' => TRUE, 'langcode' => 'fr'])->toString(), [], 'Correct page redirection.');
+    $this->assertUrl(Url::fromRoute('entity.configurable_language.collection', [], ['langcode' => 'fr']));
 
     // Check if a valid language prefix is added after changing the default
     // language.
diff --git a/core/modules/language/tests/src/Functional/LanguageCustomLanguageConfigurationTest.php b/core/modules/language/tests/src/Functional/LanguageCustomLanguageConfigurationTest.php
index 235e09ad0c27..5250570bd7c8 100644
--- a/core/modules/language/tests/src/Functional/LanguageCustomLanguageConfigurationTest.php
+++ b/core/modules/language/tests/src/Functional/LanguageCustomLanguageConfigurationTest.php
@@ -48,7 +48,7 @@ public function testLanguageConfiguration() {
     $this->assertText(t('@name field is required.', ['@name' => t('Language name')]));
     $empty_language = new Language();
     $this->assertSession()->checkboxChecked('edit-direction-' . $empty_language->getDirection());
-    $this->assertUrl(Url::fromRoute('language.add', [], ['absolute' => TRUE])->toString(), [], 'Correct page redirection.');
+    $this->assertUrl(Url::fromRoute('language.add'));
 
     // Test validation of invalid values.
     $edit = [
@@ -65,7 +65,7 @@ public function testLanguageConfiguration() {
     ]));
 
     $this->assertRaw(t('%field cannot contain any markup.', ['%field' => t('Language name')]));
-    $this->assertUrl(Url::fromRoute('language.add', [], ['absolute' => TRUE])->toString(), [], 'Correct page redirection.');
+    $this->assertUrl(Url::fromRoute('language.add'));
 
     // Test adding a custom language with a numeric region code.
     $edit = [
@@ -80,7 +80,7 @@ public function testLanguageConfiguration() {
       'The language %language has been created and can now be used.',
       ['%language' => $edit['label']]
     ));
-    $this->assertUrl(Url::fromRoute('entity.configurable_language.collection', [], ['absolute' => TRUE])->toString(), [], 'Correct page redirection.');
+    $this->assertUrl(Url::fromRoute('entity.configurable_language.collection'));
 
     // Test validation of existing language values.
     $edit = [
@@ -96,7 +96,7 @@ public function testLanguageConfiguration() {
       'The language %language has been created and can now be used.',
       ['%language' => $edit['label']]
     ));
-    $this->assertUrl(Url::fromRoute('entity.configurable_language.collection', [], ['absolute' => TRUE])->toString(), [], 'Correct page redirection.');
+    $this->assertUrl(Url::fromRoute('entity.configurable_language.collection'));
 
     // Add the language a second time and confirm that this is not allowed.
     $this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add custom language'));
@@ -104,7 +104,7 @@ public function testLanguageConfiguration() {
       'The language %language (%langcode) already exists.',
       ['%language' => $edit['label'], '%langcode' => $edit['langcode']]
     ));
-    $this->assertUrl(Url::fromRoute('language.add', [], ['absolute' => TRUE])->toString(), [], 'Correct page redirection.');
+    $this->assertUrl(Url::fromRoute('language.add'));
   }
 
 }
diff --git a/core/modules/language/tests/src/Functional/LanguageListTest.php b/core/modules/language/tests/src/Functional/LanguageListTest.php
index 9f3205ec1a40..d600d452440e 100644
--- a/core/modules/language/tests/src/Functional/LanguageListTest.php
+++ b/core/modules/language/tests/src/Functional/LanguageListTest.php
@@ -49,7 +49,7 @@ public function testLanguageList() {
     ];
     $this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add language'));
     $this->assertText('French', 'Language added successfully.');
-    $this->assertUrl(Url::fromRoute('entity.configurable_language.collection', [], ['absolute' => TRUE])->toString());
+    $this->assertUrl(Url::fromRoute('entity.configurable_language.collection'));
 
     // Get the weight of the last language and check that the weight is one unit
     // heavier than the last configurable language.
@@ -69,7 +69,7 @@ public function testLanguageList() {
       'direction' => Language::DIRECTION_LTR,
     ];
     $this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add custom language'));
-    $this->assertUrl(Url::fromRoute('entity.configurable_language.collection', [], ['absolute' => TRUE])->toString());
+    $this->assertUrl(Url::fromRoute('entity.configurable_language.collection'));
     $this->assertRaw('"edit-languages-' . $langcode . '-weight"', 'Language code found.');
     $this->assertText(t($name), 'Test language added.');
 
@@ -87,7 +87,7 @@ public function testLanguageList() {
     $this->drupalPostForm(NULL, $edit, t('Save configuration'));
     $this->rebuildContainer();
     $this->assertSession()->checkboxNotChecked('edit-site-default-language-en');
-    $this->assertUrl(Url::fromRoute('entity.configurable_language.collection', [], ['absolute' => TRUE, 'language' => $language])->toString());
+    $this->assertUrl(Url::fromRoute('entity.configurable_language.collection', [], ['language' => $language]));
 
     // Ensure we can't delete the default language.
     $this->drupalGet('admin/config/regional/language/delete/' . $langcode);
@@ -104,7 +104,7 @@ public function testLanguageList() {
     ];
     $this->drupalPostForm('admin/config/regional/language/edit/' . $langcode, $edit, t('Save language'));
     $this->assertRaw($name, 'The language has been updated.');
-    $this->assertUrl(Url::fromRoute('entity.configurable_language.collection', [], ['absolute' => TRUE, 'language' => $language])->toString());
+    $this->assertUrl(Url::fromRoute('entity.configurable_language.collection', [], ['language' => $language]));
 
     // Change back the default language.
     $edit = [
@@ -120,7 +120,7 @@ public function testLanguageList() {
     $this->drupalGet('admin/config/regional/language/delete/' . $langcode);
     // First test the 'cancel' link.
     $this->clickLink(t('Cancel'));
-    $this->assertUrl(Url::fromRoute('entity.configurable_language.collection', [], ['absolute' => TRUE, 'language' => $english])->toString());
+    $this->assertUrl(Url::fromRoute('entity.configurable_language.collection', [], ['language' => $english]));
     $this->assertRaw($name, 'The language was not deleted.');
     // Delete the language for real. This a confirm form, we do not need any
     // fields changed.
@@ -128,7 +128,7 @@ public function testLanguageList() {
     // We need raw here because %language and %langcode will add HTML.
     $t_args = ['%language' => $name, '%langcode' => $langcode];
     $this->assertRaw(t('The %language (%langcode) language has been removed.', $t_args), 'The test language has been removed.');
-    $this->assertUrl(Url::fromRoute('entity.configurable_language.collection', [], ['absolute' => TRUE, 'language' => $english])->toString());
+    $this->assertUrl(Url::fromRoute('entity.configurable_language.collection', [], ['language' => $english]));
     // Verify that language is no longer found.
     $this->drupalGet('admin/config/regional/language/delete/' . $langcode);
     $this->assertSession()->statusCodeEquals(404);
@@ -140,7 +140,7 @@ public function testLanguageList() {
     // We need raw here because %language and %langcode will add HTML.
     $t_args = ['%language' => 'French', '%langcode' => 'fr'];
     $this->assertRaw(t('The %language (%langcode) language has been removed.', $t_args), 'The French language has been removed.');
-    $this->assertUrl(Url::fromRoute('entity.configurable_language.collection', [], ['absolute' => TRUE])->toString());
+    $this->assertUrl(Url::fromRoute('entity.configurable_language.collection'));
     // Verify that language is no longer found.
     $this->drupalGet('admin/config/regional/language/delete/fr');
     $this->assertSession()->statusCodeEquals(404);
@@ -158,7 +158,7 @@ public function testLanguageList() {
       'direction' => Language::DIRECTION_LTR,
     ];
     $this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add custom language'));
-    $this->assertUrl(Url::fromRoute('entity.configurable_language.collection', [], ['absolute' => TRUE])->toString());
+    $this->assertUrl(Url::fromRoute('entity.configurable_language.collection'));
     $this->assertText($name, 'Name found.');
 
     // Check if we can change the default language.
@@ -172,7 +172,7 @@ public function testLanguageList() {
     $this->drupalPostForm(NULL, $edit, t('Save configuration'));
     $this->rebuildContainer();
     $this->assertSession()->checkboxNotChecked('edit-site-default-language-en');
-    $this->assertUrl(Url::fromRoute('entity.configurable_language.collection', [], ['absolute' => TRUE, 'language' => $language])->toString());
+    $this->assertUrl(Url::fromRoute('entity.configurable_language.collection', [], ['language' => $language]));
 
     $this->drupalPostForm('admin/config/regional/language/delete/en', [], t('Delete'));
     // We need raw here because %language and %langcode will add HTML.
diff --git a/core/modules/language/tests/src/Functional/LanguageLocaleListTest.php b/core/modules/language/tests/src/Functional/LanguageLocaleListTest.php
index bf1eb3f67030..8608903341d7 100644
--- a/core/modules/language/tests/src/Functional/LanguageLocaleListTest.php
+++ b/core/modules/language/tests/src/Functional/LanguageLocaleListTest.php
@@ -50,7 +50,7 @@ public function testLanguageLocaleList() {
     ];
     $this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add language'));
     $this->assertText('The language French has been created and can now be used');
-    $this->assertUrl(Url::fromRoute('entity.configurable_language.collection', [], ['absolute' => TRUE])->toString());
+    $this->assertUrl(Url::fromRoute('entity.configurable_language.collection'));
     $this->rebuildContainer();
 
     // Translate Spanish language to French (Espagnol).
diff --git a/core/modules/locale/tests/src/Functional/LocaleImportFunctionalTest.php b/core/modules/locale/tests/src/Functional/LocaleImportFunctionalTest.php
index 38b4840f35f1..616b4ae3b24e 100644
--- a/core/modules/locale/tests/src/Functional/LocaleImportFunctionalTest.php
+++ b/core/modules/locale/tests/src/Functional/LocaleImportFunctionalTest.php
@@ -96,7 +96,7 @@ public function testStandalonePoFile() {
     $this->assertEqual(2, $locale_plurals, 'Plural number initialized.');
 
     // Ensure we were redirected correctly.
-    $this->assertUrl(Url::fromRoute('locale.translate_page', [], ['absolute' => TRUE])->toString(), [], 'Correct page redirection.');
+    $this->assertUrl(Url::fromRoute('locale.translate_page'));
 
     // Try importing a .po file with invalid tags.
     $this->importPoFile($this->getBadPoFile(), [
@@ -146,7 +146,7 @@ public function testStandalonePoFile() {
       'langcode' => 'fr',
       'files[file]' => $name,
     ], t('Import'));
-    $this->assertUrl(Url::fromRoute('locale.translate_import', [], ['absolute' => TRUE])->toString(), [], 'Correct page redirection.');
+    $this->assertUrl(Url::fromRoute('locale.translate_import'));
     $this->assertText(t('File to import not found.'), 'File to import not found message.');
 
     // Try importing a .po file with overriding strings, and ensure existing
diff --git a/core/modules/node/tests/src/Functional/NodeEditFormTest.php b/core/modules/node/tests/src/Functional/NodeEditFormTest.php
index 705469e9a9da..7f89aef5e249 100644
--- a/core/modules/node/tests/src/Functional/NodeEditFormTest.php
+++ b/core/modules/node/tests/src/Functional/NodeEditFormTest.php
@@ -81,7 +81,7 @@ public function testNodeEdit() {
 
     // Check that "edit" link points to correct page.
     $this->clickLink(t('Edit'));
-    $this->assertUrl($node->toUrl('edit-form', ['absolute' => TRUE])->toString());
+    $this->assertUrl($node->toUrl('edit-form'));
 
     // Check that the title and body fields are displayed with the correct values.
     // @todo Ideally assertLink would support HTML, but it doesn't.
diff --git a/core/modules/node/tests/src/Functional/PagePreviewTest.php b/core/modules/node/tests/src/Functional/PagePreviewTest.php
index 9c0e7cd8bca9..cf8feb6f976e 100644
--- a/core/modules/node/tests/src/Functional/PagePreviewTest.php
+++ b/core/modules/node/tests/src/Functional/PagePreviewTest.php
@@ -339,7 +339,7 @@ public function testPagePreview() {
     // Check that preview page works as expected without a destination set.
     $this->drupalPostForm($node->toUrl('edit-form'), [], t('Preview'));
     $parameters = ['node_preview' => $node->uuid(), 'view_mode_id' => 'full'];
-    $this->assertUrl(Url::fromRoute('entity.node.preview', $parameters, ['absolute' => TRUE]));
+    $this->assertUrl(Url::fromRoute('entity.node.preview', $parameters));
     $this->drupalPostForm(NULL, ['view_mode' => 'teaser'], t('Switch'));
     $this->clickLink(t('Back to content editing'));
     $this->drupalPostForm(NULL, [], t('Save'));
@@ -495,7 +495,7 @@ public function testSimultaneousPreview() {
 
     $edit2 = [$title_key => 'Another page title'];
     $this->drupalPostForm('node/' . $node->id() . '/edit', $edit2, t('Preview'));
-    $this->assertUrl(Url::fromRoute('entity.node.preview', ['node_preview' => $node->uuid(), 'view_mode_id' => 'full'], ['absolute' => TRUE])->toString());
+    $this->assertUrl(Url::fromRoute('entity.node.preview', ['node_preview' => $node->uuid(), 'view_mode_id' => 'full']));
     $this->assertText($edit2[$title_key]);
   }
 
diff --git a/core/modules/search/tests/src/Functional/SearchLanguageTest.php b/core/modules/search/tests/src/Functional/SearchLanguageTest.php
index b1677ef06b46..7b9488a95f1f 100644
--- a/core/modules/search/tests/src/Functional/SearchLanguageTest.php
+++ b/core/modules/search/tests/src/Functional/SearchLanguageTest.php
@@ -114,7 +114,7 @@ public function testLanguages() {
 
     // Ensure selecting no language does not make the query different.
     $this->drupalPostForm('search/node', [], 'edit-submit--2');
-    $this->assertUrl(Url::fromRoute('search.view_node_search', [], ['query' => ['keys' => ''], 'absolute' => TRUE])->toString(), [], 'Correct page redirection, no language filtering.');
+    $this->assertUrl(Url::fromRoute('search.view_node_search', [], ['query' => ['keys' => '']]));
 
     // Pick French and ensure it is selected.
     $edit = ['language[fr]' => TRUE];
diff --git a/core/modules/system/tests/src/Functional/Form/ConfirmFormTest.php b/core/modules/system/tests/src/Functional/Form/ConfirmFormTest.php
index 2a0e059098ed..3e036e52aa69 100644
--- a/core/modules/system/tests/src/Functional/Form/ConfirmFormTest.php
+++ b/core/modules/system/tests/src/Functional/Form/ConfirmFormTest.php
@@ -35,16 +35,16 @@ public function testConfirmForm() {
 
     // Test cancelling the form.
     $this->clickLink(t('ConfirmFormTestForm::getCancelText().'));
-    $this->assertUrl('form-test/autocomplete', [], "The form's cancel link was followed.");
+    $this->assertUrl('form-test/autocomplete');
 
     // Test submitting the form.
     $this->drupalPostForm('form-test/confirm-form', NULL, t('ConfirmFormTestForm::getConfirmText().'));
     $this->assertText('The ConfirmFormTestForm::submitForm() method was used for this form.');
-    $this->assertUrl('', [], "The form's redirect was followed.");
+    $this->assertUrl('');
 
     // Test submitting the form with a destination.
     $this->drupalPostForm('form-test/confirm-form', NULL, t('ConfirmFormTestForm::getConfirmText().'), ['query' => ['destination' => 'admin/config']]);
-    $this->assertUrl('admin/config', [], "The form's redirect was not followed, the destination query string was followed.");
+    $this->assertUrl('admin/config');
 
     // Test cancelling the form with a complex destination.
     $this->drupalGet('form-test/confirm-form-array-path');
diff --git a/core/modules/system/tests/src/Functional/Form/RedirectTest.php b/core/modules/system/tests/src/Functional/Form/RedirectTest.php
index f875eedc8008..d32a49cc5984 100644
--- a/core/modules/system/tests/src/Functional/Form/RedirectTest.php
+++ b/core/modules/system/tests/src/Functional/Form/RedirectTest.php
@@ -38,14 +38,14 @@ public function testRedirect() {
       'destination' => $this->randomMachineName(),
     ];
     $this->drupalPostForm($path, $edit, t('Submit'));
-    $this->assertUrl($edit['destination'], [], 'Basic redirection works.');
+    $this->assertUrl($edit['destination']);
 
     // Test without redirection.
     $edit = [
       'redirection' => FALSE,
     ];
     $this->drupalPostForm($path, $edit, t('Submit'));
-    $this->assertUrl($path, [], 'When redirect is set to FALSE, there should be no redirection.');
+    $this->assertUrl($path);
 
     // Test redirection with query parameters.
     $edit = [
@@ -53,7 +53,7 @@ public function testRedirect() {
       'destination' => $this->randomMachineName(),
     ];
     $this->drupalPostForm($path, $edit, t('Submit'), $options);
-    $this->assertUrl($edit['destination'], [], 'Redirection with query parameters works.');
+    $this->assertUrl($edit['destination']);
 
     // Test without redirection but with query parameters.
     $edit = [
@@ -70,7 +70,7 @@ public function testRedirect() {
       'destination' => '',
     ];
     $this->drupalPostForm($path, $edit, t('Submit'));
-    $this->assertUrl($path, [], 'When using an empty redirection string, there should be no redirection.');
+    $this->assertUrl($path);
 
     // Test redirection back to the original path with query parameters.
     $edit = [
@@ -101,7 +101,7 @@ public function testRedirectFromErrorPages() {
     $this->assertSession()->statusCodeEquals(404);
     $this->drupalPostForm(NULL, [], t('Submit'));
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertUrl($expected, [], 'Redirected to correct URL/query.');
+    $this->assertUrl($expected);
 
     // Visit the block admin page (403 page) and submit the form. Verify it
     // ends up at the right URL.
@@ -109,7 +109,7 @@ public function testRedirectFromErrorPages() {
     $this->assertSession()->statusCodeEquals(403);
     $this->drupalPostForm(NULL, [], t('Submit'));
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertUrl($expected, [], 'Redirected to correct URL/query.');
+    $this->assertUrl($expected);
   }
 
 }
diff --git a/core/modules/system/tests/src/Functional/Menu/MenuRouterTest.php b/core/modules/system/tests/src/Functional/Menu/MenuRouterTest.php
index b5602e3b8c1e..a9b3f30713e6 100644
--- a/core/modules/system/tests/src/Functional/Menu/MenuRouterTest.php
+++ b/core/modules/system/tests/src/Functional/Menu/MenuRouterTest.php
@@ -230,11 +230,11 @@ public function testAuthUserUserLogin() {
 
     $this->drupalGet('user/login');
     // Check that we got to 'user'.
-    $this->assertUrl($this->loggedInUser->toUrl('canonical', ['absolute' => TRUE])->toString());
+    $this->assertUrl($this->loggedInUser->toUrl('canonical'));
 
     // user/register should redirect to user/UID/edit.
     $this->drupalGet('user/register');
-    $this->assertUrl($this->loggedInUser->toUrl('edit-form', ['absolute' => TRUE])->toString());
+    $this->assertUrl($this->loggedInUser->toUrl('edit-form'));
   }
 
   /**
diff --git a/core/modules/system/tests/src/Functional/Module/ExperimentalModuleTest.php b/core/modules/system/tests/src/Functional/Module/ExperimentalModuleTest.php
index 3cf9f2d8dd74..c739c35d8851 100644
--- a/core/modules/system/tests/src/Functional/Module/ExperimentalModuleTest.php
+++ b/core/modules/system/tests/src/Functional/Module/ExperimentalModuleTest.php
@@ -134,7 +134,9 @@ public function testExperimentalConfirmForm() {
     $edit = [];
     $edit["modules[experimental_module_requirements_test][enable]"] = TRUE;
     $this->drupalPostForm('admin/modules', $edit, 'Install');
-    $this->assertUrl('admin/modules', [], 'If the module can not be installed we are not taken to the confirm form.');
+    // Verify that if the module can not be installed, we are not taken to the
+    // confirm form.
+    $this->assertUrl('admin/modules');
     $this->assertText('The Experimental Test Requirements module can not be installed.');
   }
 
diff --git a/core/modules/system/tests/src/Functional/Module/PrepareUninstallTest.php b/core/modules/system/tests/src/Functional/Module/PrepareUninstallTest.php
index 19fa712c059c..682e9e40ba26 100644
--- a/core/modules/system/tests/src/Functional/Module/PrepareUninstallTest.php
+++ b/core/modules/system/tests/src/Functional/Module/PrepareUninstallTest.php
@@ -89,7 +89,7 @@ public function testUninstall() {
 
     // Check that we are redirected to the uninstall page and data has been
     // removed.
-    $this->assertUrl('admin/modules/uninstall', []);
+    $this->assertUrl('admin/modules/uninstall');
     $this->assertText('All taxonomy terms have been deleted.');
 
     // Check that there is no more data to be deleted, Taxonomy is ready to be
@@ -137,7 +137,7 @@ public function testUninstall() {
     $this->drupalPostForm(NULL, [], t('Delete all content items'));
 
     // Check we are redirected to the uninstall page and data has been removed.
-    $this->assertUrl('admin/modules/uninstall', []);
+    $this->assertUrl('admin/modules/uninstall');
     $this->assertText('All content items have been deleted.');
 
     // Check there is no more data to be deleted, Node is ready to be
diff --git a/core/modules/system/tests/src/Functional/System/AdminTest.php b/core/modules/system/tests/src/Functional/System/AdminTest.php
index 2a4d4569844a..a0abdf5fac74 100644
--- a/core/modules/system/tests/src/Functional/System/AdminTest.php
+++ b/core/modules/system/tests/src/Functional/System/AdminTest.php
@@ -158,7 +158,9 @@ public function testCompactMode() {
 
     $this->drupalGet('admin/compact/on');
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertUrl($frontpage_url, [], 'The user is redirected to the front page after turning on compact mode.');
+    // Verify that the user is redirected to the front page after turning on
+    // compact mode.
+    $this->assertUrl($frontpage_url);
     $this->assertEquals('1', $session->getCookie('Drupal.visitor.admin_compact_mode'), 'Compact mode turns on.');
     $this->drupalGet('admin/compact/on');
     $this->assertEquals('1', $session->getCookie('Drupal.visitor.admin_compact_mode'), 'Compact mode remains on after a repeat call.');
@@ -167,7 +169,9 @@ public function testCompactMode() {
 
     $this->drupalGet('admin/compact/off');
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertUrl($frontpage_url, [], 'The user is redirected to the front page after turning off compact mode.');
+    // Verify that the user is redirected to the front page after turning off
+    // compact mode.
+    $this->assertUrl($frontpage_url);
     $this->assertNull($session->getCookie('Drupal.visitor.admin_compact_mode'), 'Compact mode turns off.');
     $this->drupalGet('admin/compact/off');
     $this->assertNull($session->getCookie('Drupal.visitor.admin_compact_mode'), 'Compact mode remains off after a repeat call.');
diff --git a/core/modules/system/tests/src/Functional/System/DateTimeTest.php b/core/modules/system/tests/src/Functional/System/DateTimeTest.php
index 33a651565210..039c54cdce77 100644
--- a/core/modules/system/tests/src/Functional/System/DateTimeTest.php
+++ b/core/modules/system/tests/src/Functional/System/DateTimeTest.php
@@ -104,7 +104,8 @@ public function testDateFormatConfiguration() {
       'date_format_pattern' => $date_format,
     ];
     $this->drupalPostForm('admin/config/regional/date-time/formats/add', $edit, t('Add format'));
-    $this->assertUrl(Url::fromRoute('entity.date_format.collection', [], ['absolute' => TRUE])->toString(), [], 'Correct page redirection.');
+    // Verify that the user is redirected to the correct page.
+    $this->assertUrl(Url::fromRoute('entity.date_format.collection'));
     $this->assertText(t('Custom date format added.'), 'Date format added confirmation message appears.');
     $this->assertText($name, 'Custom date format appears in the date format list.');
     $this->assertText(t('Delete'), 'Delete link for custom date format appears.');
@@ -113,7 +114,8 @@ public function testDateFormatConfiguration() {
     $this->drupalGet('admin/config/regional/date-time');
     $this->clickLink(t('Edit'));
     $this->drupalPostForm(NULL, NULL, t('Save format'));
-    $this->assertUrl('admin/config/regional/date-time', ['absolute' => TRUE], 'Correct page redirection.');
+    // Verify that the user is redirected to the correct page.
+    $this->assertUrl(Url::fromRoute('entity.date_format.collection'));
     $this->assertText(t('Custom date format updated.'), 'Custom date format successfully updated.');
 
     // Edit custom date format.
@@ -123,13 +125,15 @@ public function testDateFormatConfiguration() {
       'date_format_pattern' => 'Y m',
     ];
     $this->drupalPostForm($this->getUrl(), $edit, t('Save format'));
-    $this->assertUrl(Url::fromRoute('entity.date_format.collection', [], ['absolute' => TRUE])->toString(), [], 'Correct page redirection.');
+    // Verify that the user is redirected to the correct page.
+    $this->assertUrl(Url::fromRoute('entity.date_format.collection'));
     $this->assertText(t('Custom date format updated.'), 'Custom date format successfully updated.');
 
     // Delete custom date format.
     $this->clickLink(t('Delete'));
     $this->drupalPostForm('admin/config/regional/date-time/formats/manage/' . $date_format_id . '/delete', [], t('Delete'));
-    $this->assertUrl(Url::fromRoute('entity.date_format.collection', [], ['absolute' => TRUE])->toString(), [], 'Correct page redirection.');
+    // Verify that the user is redirected to the correct page.
+    $this->assertUrl(Url::fromRoute('entity.date_format.collection'));
     $this->assertRaw(t('The date format %format has been deleted.', ['%format' => $name]), 'Custom date format removed.');
 
     // Make sure the date does not exist in config.
@@ -146,7 +150,8 @@ public function testDateFormatConfiguration() {
       'date_format_pattern' => $date_format,
     ];
     $this->drupalPostForm('admin/config/regional/date-time/formats/add', $edit, t('Add format'));
-    $this->assertUrl(Url::fromRoute('entity.date_format.collection', [], ['absolute' => TRUE])->toString(), [], 'Correct page redirection.');
+    // Verify that the user is redirected to the correct page.
+    $this->assertUrl(Url::fromRoute('entity.date_format.collection'));
     $this->assertText(t('Custom date format added.'), 'Date format added confirmation message appears.');
     $this->assertText($name, 'Custom date format appears in the date format list.');
     $this->assertText(t('Delete'), 'Delete link for custom date format appears.');
@@ -172,7 +177,8 @@ public function testDateFormatConfiguration() {
       'date_format_pattern' => $date_format,
     ];
     $this->drupalPostForm('admin/config/regional/date-time/formats/add', $edit, t('Add format'));
-    $this->assertUrl(Url::fromRoute('entity.date_format.collection', [], ['absolute' => TRUE])->toString(), [], 'Correct page redirection.');
+    // Verify that the user is redirected to the correct page.
+    $this->assertUrl(Url::fromRoute('entity.date_format.collection'));
     $this->assertText(t('Custom date format added.'), 'Date format added confirmation message appears.');
     $this->assertText($name, 'Custom date format appears in the date format list.');
     $this->assertSession()->assertEscaped('<em>' . date("Y") . '</em>');
diff --git a/core/modules/toolbar/tests/src/Functional/ToolbarAdminMenuTest.php b/core/modules/toolbar/tests/src/Functional/ToolbarAdminMenuTest.php
index 6bbafdd67e0e..7e512eaa58ee 100644
--- a/core/modules/toolbar/tests/src/Functional/ToolbarAdminMenuTest.php
+++ b/core/modules/toolbar/tests/src/Functional/ToolbarAdminMenuTest.php
@@ -322,7 +322,8 @@ public function testLocaleTranslationSubtreesHashCacheClear() {
     ];
     $this->drupalPostForm('admin/config/regional/translate', $edit, t('Save translations'));
     $this->assertText(t('The strings have been saved.'), 'The strings have been saved.');
-    $this->assertUrl(Url::fromRoute('locale.translate_page', [], ['absolute' => TRUE])->toString(), [], 'Correct page redirection.');
+    // Verify that the user is redirected to the correct page.
+    $this->assertUrl(Url::fromRoute('locale.translate_page'));
     $this->drupalLogout();
 
     // Log in the adminUser. Check the admin menu subtrees hash now that one
diff --git a/core/modules/user/tests/src/Functional/UserBlocksTest.php b/core/modules/user/tests/src/Functional/UserBlocksTest.php
index 1dd8761bc61c..4c869cbf25be 100644
--- a/core/modules/user/tests/src/Functional/UserBlocksTest.php
+++ b/core/modules/user/tests/src/Functional/UserBlocksTest.php
@@ -80,7 +80,7 @@ public function testUserLoginBlock() {
     $this->assertNoText(t('User login'), 'Logged in.');
 
     // Check that we are still on the same page.
-    $this->assertUrl(Url::fromRoute('user.admin_permissions', [], ['absolute' => TRUE])->toString(), [], 'Still on the same page after login for access denied page');
+    $this->assertUrl(Url::fromRoute('user.admin_permissions'));
 
     // Now, log out and repeat with a non-403 page.
     $this->drupalLogout();
@@ -116,7 +116,7 @@ public function testUserLoginBlock() {
     $this->drupalLogout();
     $this->drupalPostForm('http://example.com/', $edit, t('Log in'), ['external' => FALSE]);
     // Check that we remain on the site after login.
-    $this->assertUrl($user->toUrl('canonical', ['absolute' => TRUE])->toString(), [], 'Redirected to user profile page after login from the frontpage');
+    $this->assertUrl($user->toUrl('canonical'));
 
     // Verify that form validation errors are displayed immediately for forms
     // in blocks and not on subsequent page requests.
diff --git a/core/modules/user/tests/src/Functional/UserLoginTest.php b/core/modules/user/tests/src/Functional/UserLoginTest.php
index dce5a732e286..3d4a1221cb5b 100644
--- a/core/modules/user/tests/src/Functional/UserLoginTest.php
+++ b/core/modules/user/tests/src/Functional/UserLoginTest.php
@@ -36,7 +36,8 @@ public function testLoginCacheTagsAndDestination() {
     $this->drupalGet('user/login', ['query' => ['destination' => 'foo']]);
     $edit = ['name' => $user->getAccountName(), 'pass' => $user->passRaw];
     $this->drupalPostForm(NULL, $edit, t('Log in'));
-    $this->assertUrl('foo', [], 'Redirected to the correct URL');
+    // Verify that the user is redirected to the correct URL.
+    $this->assertUrl('foo');
   }
 
   /**
diff --git a/core/modules/user/tests/src/Functional/UserPasswordResetTest.php b/core/modules/user/tests/src/Functional/UserPasswordResetTest.php
index 89e1e89ad51a..236d0317aa16 100644
--- a/core/modules/user/tests/src/Functional/UserPasswordResetTest.php
+++ b/core/modules/user/tests/src/Functional/UserPasswordResetTest.php
@@ -454,7 +454,7 @@ public function testResetImpersonation() {
     $this->drupalGet($attack_reset_url);
     $this->drupalPostForm(NULL, NULL, t('Log in'));
     $this->assertNoText($user2->getAccountName(), 'The invalid password reset page does not show the user name.');
-    $this->assertUrl('user/password', [], 'The user is redirected to the password reset request page.');
+    $this->assertUrl('user/password');
     $this->assertText('You have tried to use a one-time login link that has either been used or is no longer valid. Please request a new one using the form below.');
   }
 
diff --git a/core/modules/views_ui/tests/src/Functional/CachedDataUITest.php b/core/modules/views_ui/tests/src/Functional/CachedDataUITest.php
index e50005f49e5f..37fad2a9fde7 100644
--- a/core/modules/views_ui/tests/src/Functional/CachedDataUITest.php
+++ b/core/modules/views_ui/tests/src/Functional/CachedDataUITest.php
@@ -47,7 +47,7 @@ public function testCacheData() {
     $this->drupalPostForm(NULL, [], t('Cancel'));
     $this->assertEqual($temp_store->getMetadata('test_view'), NULL, 'Shared tempstore data has been removed.');
     // Test we are redirected to the view listing page.
-    $this->assertUrl('admin/structure/views', [], 'Redirected back to the view listing page.');
+    $this->assertUrl('admin/structure/views');
 
     // Log in with another user and make sure the view is locked and break.
     $this->drupalPostForm('admin/structure/views/nojs/display/test_view/default/title', [], t('Apply'));
diff --git a/core/modules/views_ui/tests/src/Functional/DefaultViewsTest.php b/core/modules/views_ui/tests/src/Functional/DefaultViewsTest.php
index 46bc66a9d2d5..dd9ca344a7a2 100644
--- a/core/modules/views_ui/tests/src/Functional/DefaultViewsTest.php
+++ b/core/modules/views_ui/tests/src/Functional/DefaultViewsTest.php
@@ -95,14 +95,14 @@ public function testDefaultViews() {
     ];
     $this->assertSession()->titleEquals('Duplicate of Glossary | Drupal');
     $this->drupalPostForm(NULL, $edit, t('Duplicate'));
-    $this->assertUrl('admin/structure/views/view/duplicate_of_glossary', [], 'The normal duplicating name schema is applied.');
+    $this->assertUrl('admin/structure/views/view/duplicate_of_glossary');
 
     // Duplicate a view and set a custom name.
     $this->drupalGet('admin/structure/views');
     $this->clickViewsOperationLink('Duplicate', '/glossary');
     $random_name = strtolower($this->randomMachineName());
     $this->drupalPostForm(NULL, ['id' => $random_name], t('Duplicate'));
-    $this->assertUrl("admin/structure/views/view/$random_name", [], 'The custom view name got saved.');
+    $this->assertUrl("admin/structure/views/view/$random_name");
 
     // Now disable the view, and make sure it stops appearing on the main view
     // listing page but instead goes back to displaying on the disabled views
diff --git a/core/modules/views_ui/tests/src/Functional/DisplayCRUDTest.php b/core/modules/views_ui/tests/src/Functional/DisplayCRUDTest.php
index eb5d23529715..f75be186e0c7 100644
--- a/core/modules/views_ui/tests/src/Functional/DisplayCRUDTest.php
+++ b/core/modules/views_ui/tests/src/Functional/DisplayCRUDTest.php
@@ -117,8 +117,9 @@ public function testDuplicateDisplay() {
 
     $this->drupalGet($path_prefix);
     $this->drupalPostForm(NULL, [], 'Duplicate Page');
+    // Verify that the user got redirected to the new display.
     $this->assertLinkByHref($path_prefix . '/page_2', 0, 'Make sure after duplicating the new display appears in the UI');
-    $this->assertUrl($path_prefix . '/page_2', [], 'The user got redirected to the new display.');
+    $this->assertUrl($path_prefix . '/page_2');
 
     // Set the title and override the css classes.
     $random_title = $this->randomMachineName();
@@ -129,7 +130,7 @@ public function testDuplicateDisplay() {
     // Duplicate as a different display type.
     $this->drupalPostForm(NULL, [], 'Duplicate as Block');
     $this->assertLinkByHref($path_prefix . '/block_1', 0, 'Make sure after duplicating the new display appears in the UI');
-    $this->assertUrl($path_prefix . '/block_1', [], 'The user got redirected to the new display.');
+    $this->assertUrl($path_prefix . '/block_1');
     $this->assertText(t('Block settings'));
     $this->assertNoText(t('Page settings'));
 
diff --git a/core/modules/views_ui/tests/src/Functional/DuplicateTest.php b/core/modules/views_ui/tests/src/Functional/DuplicateTest.php
index 93e73a0638a4..c6dcbf042bc8 100644
--- a/core/modules/views_ui/tests/src/Functional/DuplicateTest.php
+++ b/core/modules/views_ui/tests/src/Functional/DuplicateTest.php
@@ -39,7 +39,7 @@ public function testDuplicateView() {
     $this->drupalPostForm('admin/structure/views/view/' . $random_view['id'] . '/duplicate', $view, t('Duplicate'));
 
     // Assert that the page url is correct.
-    $this->assertUrl('admin/structure/views/view/' . $view['id'], [], 'Make sure the view saving was successful and the browser got redirected to the edit page.');
+    $this->assertUrl('admin/structure/views/view/' . $view['id']);
 
     // Assert that the page title is correctly displayed.
     $this->assertText($view['label']);
diff --git a/core/modules/views_ui/tests/src/Functional/ExposedFormUITest.php b/core/modules/views_ui/tests/src/Functional/ExposedFormUITest.php
index 131c54495f8f..2c238b8efe76 100644
--- a/core/modules/views_ui/tests/src/Functional/ExposedFormUITest.php
+++ b/core/modules/views_ui/tests/src/Functional/ExposedFormUITest.php
@@ -191,7 +191,7 @@ public function testGroupedFilterAdminUi() {
     $edit["options[group_info][group_items][3][value][article]"] = 'article';
     $edit["options[group_info][group_items][3][value][page]"] = 'page';
     $this->drupalPostForm(NULL, $edit, t('Apply'));
-    $this->assertUrl('admin/structure/views/view/test_exposed_admin_ui/edit/default', [], 'Correct validation of the node type filter.');
+    $this->assertUrl('admin/structure/views/view/test_exposed_admin_ui/edit/default');
     $this->assertNoGroupedFilterErrors();
 
     // Validate an "is empty" filter -- title without value is valid.
@@ -200,7 +200,7 @@ public function testGroupedFilterAdminUi() {
     $edit["options[group_info][group_items][1][title]"] = 'No body';
     $edit["options[group_info][group_items][1][operator]"] = 'empty';
     $this->drupalPostForm(NULL, $edit, t('Apply'));
-    $this->assertUrl('admin/structure/views/view/test_exposed_admin_ui/edit/default', [], 'The "empty" operator validates correctly.');
+    $this->assertUrl('admin/structure/views/view/test_exposed_admin_ui/edit/default');
     $this->assertNoGroupedFilterErrors();
 
     // Ensure the string "0" can be used as a value for numeric filters.
@@ -212,7 +212,7 @@ public function testGroupedFilterAdminUi() {
     $edit['options[group_info][group_items][1][operator]'] = '>';
     $edit['options[group_info][group_items][1][value][value]'] = '0';
     $this->drupalPostForm(NULL, $edit, t('Apply'));
-    $this->assertUrl('admin/structure/views/view/test_exposed_admin_ui/edit/default', [], 'A string "0" is a valid value.');
+    $this->assertUrl('admin/structure/views/view/test_exposed_admin_ui/edit/default');
     $this->assertNoGroupedFilterErrors();
 
     // Ensure "between" filters validate correctly.
@@ -222,7 +222,7 @@ public function testGroupedFilterAdminUi() {
     $edit['options[group_info][group_items][1][value][min]'] = '0';
     $edit['options[group_info][group_items][1][value][max]'] = '10';
     $this->drupalPostForm(NULL, $edit, t('Apply'));
-    $this->assertUrl('admin/structure/views/view/test_exposed_admin_ui/edit/default', [], 'The "between" filter validates correctly.');
+    $this->assertUrl('admin/structure/views/view/test_exposed_admin_ui/edit/default');
     $this->assertNoGroupedFilterErrors();
   }
 
diff --git a/core/modules/views_ui/tests/src/Functional/HandlerTest.php b/core/modules/views_ui/tests/src/Functional/HandlerTest.php
index d10c769fda75..6307502d6d0a 100644
--- a/core/modules/views_ui/tests/src/Functional/HandlerTest.php
+++ b/core/modules/views_ui/tests/src/Functional/HandlerTest.php
@@ -118,11 +118,13 @@ public function testUICRUD() {
         $edit_handler_url = "admin/structure/views/nojs/handler/test_view_empty/default/$type/$id";
       }
 
-      $this->assertUrl($edit_handler_url, [], 'The user got redirected to the handler edit form.');
+      // Verify that the user got redirected to the handler edit form.
+      $this->assertUrl($edit_handler_url);
       $random_label = $this->randomMachineName();
       $this->drupalPostForm(NULL, ['options[admin_label]' => $random_label], t('Apply'));
 
-      $this->assertUrl('admin/structure/views/view/test_view_empty/edit/default', [], 'The user got redirected to the views edit form.');
+      // Verify that the user got redirected to the views edit form.
+      $this->assertUrl('admin/structure/views/view/test_view_empty/edit/default');
 
       $this->assertLinkByHref($edit_handler_url, 0, 'The handler edit link appears in the UI.');
       $links = $this->xpath('//a[starts-with(normalize-space(text()), :label)]', [':label' => $random_label]);
@@ -155,7 +157,8 @@ public function testUICRUD() {
     $id = 'name';
     $edit_handler_url = "admin/structure/views/nojs/handler/test_view_empty/default/field/$id";
 
-    $this->assertUrl($edit_handler_url, [], 'The user got redirected to the handler edit form.');
+    // Verify that the user got redirected to the handler edit form.
+    $this->assertUrl($edit_handler_url);
     $this->assertFieldByName('options[relationship]', 'uid', 'Ensure the relationship select is filled with the UID relationship.');
     $this->drupalPostForm(NULL, [], t('Apply'));
 
diff --git a/core/modules/views_ui/tests/src/Functional/RedirectTest.php b/core/modules/views_ui/tests/src/Functional/RedirectTest.php
index b332b6a673d9..7f03eddd8468 100644
--- a/core/modules/views_ui/tests/src/Functional/RedirectTest.php
+++ b/core/modules/views_ui/tests/src/Functional/RedirectTest.php
@@ -30,8 +30,10 @@ public function testRedirect() {
     $random_destination = $this->randomMachineName();
     $edit_path = "admin/structure/views/view/$view_name/edit";
 
+    // Verify that the user gets redirected to the expected page defined in the
+    // destination.
     $this->drupalPostForm($edit_path, [], t('Save'), ['query' => ['destination' => $random_destination]]);
-    $this->assertUrl($random_destination, [], 'Make sure the user got redirected to the expected page defined in the destination.');
+    $this->assertUrl($random_destination);
 
     // Setup a view with a certain page display path. If you change the path
     // but have the old url in the destination the user should be redirected to
@@ -44,7 +46,9 @@ public function testRedirect() {
 
     $this->drupalPostForm($path_edit_path, ['path' => $new_path], t('Apply'));
     $this->drupalPostForm($edit_path, [], t('Save'), ['query' => ['destination' => 'test-redirect-view']]);
-    $this->assertUrl($new_path, [], 'Make sure the user got redirected to the expected page after changing the URL of a page display.');
+    // Verify that the user gets redirected to the expected page after changing
+    // the URL of a page display.
+    $this->assertUrl($new_path);
   }
 
 }
diff --git a/core/modules/views_ui/tests/src/Functional/ViewEditTest.php b/core/modules/views_ui/tests/src/Functional/ViewEditTest.php
index 029ac924ef9f..69a3dbe3f475 100644
--- a/core/modules/views_ui/tests/src/Functional/ViewEditTest.php
+++ b/core/modules/views_ui/tests/src/Functional/ViewEditTest.php
@@ -116,7 +116,8 @@ public function testOtherOptions() {
     $this->drupalPostForm(NULL, [], 'Save');
     $this->drupalPostForm(NULL, [], t('Cancel'));
     $this->assertNoFieldByXpath('//div[contains(@class, "error")]', FALSE, 'No error message is displayed.');
-    $this->assertUrl('admin/structure/views', [], 'Redirected back to the view listing page..');
+    // Verify page was redirected to the view listing.
+    $this->assertUrl('admin/structure/views');
   }
 
   /**
diff --git a/core/modules/views_ui/tests/src/Functional/WizardTest.php b/core/modules/views_ui/tests/src/Functional/WizardTest.php
index 855efeddc1df..50439bc60545 100644
--- a/core/modules/views_ui/tests/src/Functional/WizardTest.php
+++ b/core/modules/views_ui/tests/src/Functional/WizardTest.php
@@ -58,8 +58,10 @@ public function testWizardFieldLength() {
     $view['rest_export[create]'] = TRUE;
     $view['rest_export[path]'] = $this->randomMachineName(254);
 
+    // Make sure the view saving was successful and the browser got redirected
+    // to the edit page.
     $this->drupalPostForm('admin/structure/views/add', $view, t('Save and edit'));
-    $this->assertUrl('admin/structure/views/view/' . $view['id'], [], 'Make sure the view saving was successful and the browser got redirected to the edit page.');
+    $this->assertUrl('admin/structure/views/view/' . $view['id']);
     // Assert that the page title is correctly truncated.
     $this->assertText(views_ui_truncate($view['page[title]'], 32));
   }
diff --git a/core/tests/Drupal/FunctionalTests/AssertLegacyTrait.php b/core/tests/Drupal/FunctionalTests/AssertLegacyTrait.php
index 8de2b4104b1e..7810d4f3a3ce 100644
--- a/core/tests/Drupal/FunctionalTests/AssertLegacyTrait.php
+++ b/core/tests/Drupal/FunctionalTests/AssertLegacyTrait.php
@@ -499,6 +499,9 @@ protected function assertNoFieldById($id, $value = '') {
    */
   protected function assertUrl($path) {
     @trigger_error('AssertLegacyTrait::assertUrl() is deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use $this->assertSession()->addressEquals() instead. See https://www.drupal.org/node/3129738', E_USER_DEPRECATED);
+    if (func_num_args() > 1) {
+      @trigger_error('Calling AssertLegacyTrait::assertUrl() with more than one argument is deprecated in drupal:8.2.0 and the method is removed from drupal:10.0.0. Use $this->assertSession()->addressEquals() instead. See https://www.drupal.org/node/3129738', E_USER_DEPRECATED);
+    }
     $this->assertSession()->addressEquals($path);
   }
 
diff --git a/core/tests/Drupal/Tests/Core/Assert/AssertLegacyTraitTest.php b/core/tests/Drupal/Tests/Core/Assert/AssertLegacyTraitTest.php
index cd831e212ebd..4da00e7cc735 100644
--- a/core/tests/Drupal/Tests/Core/Assert/AssertLegacyTraitTest.php
+++ b/core/tests/Drupal/Tests/Core/Assert/AssertLegacyTraitTest.php
@@ -192,6 +192,18 @@ public function testAssertNoCacheTag() {
     $this->assertNoCacheTag('some-cache-tag');
   }
 
+  /**
+   * @covers ::assertUrl
+   * @expectedDeprecation Calling AssertLegacyTrait::assertUrl() with more than one argument is deprecated in drupal:8.2.0 and the method is removed from drupal:10.0.0. Use $this->assertSession()->addressEquals() instead. See https://www.drupal.org/node/3129738
+   */
+  public function testAssertUrl() {
+    $this->webAssert
+      ->addressEquals('bingo')
+      ->shouldBeCalled();
+
+    $this->assertUrl('bingo', 'Redundant message.');
+  }
+
   /**
    * @covers ::assertElementPresent
    * @expectedDeprecation AssertLegacyTrait::assertElementPresent() is deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use $this->assertSession()->elementExists() instead. See https://www.drupal.org/node/3129738
-- 
GitLab