diff --git a/core/modules/aggregator/src/Tests/AddFeedTest.php b/core/modules/aggregator/src/Tests/AddFeedTest.php index 8b125ea..5b15d02 100644 --- a/core/modules/aggregator/src/Tests/AddFeedTest.php +++ b/core/modules/aggregator/src/Tests/AddFeedTest.php @@ -20,7 +20,7 @@ function testAddFeed() { $feed = $this->createFeed(); // Check feed data. - $this->assertEqual($this->getUrl(), \Drupal::url('aggregator.feed_add', [], ['absolute' => TRUE]), 'Directed to correct url.'); + $this->assertUrl(\Drupal::url('aggregator.feed_add', [], ['absolute' => TRUE]), [], 'Directed to correct url.'); $this->assertTrue($this->uniqueFeed($feed->label(), $feed->getUrl()), 'The feed is unique.'); // Check feed source. diff --git a/core/modules/aggregator/src/Tests/UpdateFeedTest.php b/core/modules/aggregator/src/Tests/UpdateFeedTest.php index 6736b02..fa7a8c7 100644 --- a/core/modules/aggregator/src/Tests/UpdateFeedTest.php +++ b/core/modules/aggregator/src/Tests/UpdateFeedTest.php @@ -31,7 +31,7 @@ function testUpdateFeed() { $this->assertRaw(t('The feed %name has been updated.', array('%name' => $edit['title[0][value]'])), format_string('The feed %name has been updated.', array('%name' => $edit['title[0][value]']))); // Check feed data. - $this->assertEqual($this->getUrl(), $feed->urlInfo('canonical', ['absolute' => TRUE]))->toString(); + $this->assertUrl($feed->url('canonical', [], ['absolute' => TRUE])); $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/src/Tests/BlockContentTypeTest.php b/core/modules/block_content/src/Tests/BlockContentTypeTest.php index 9410ec3..e08942b 100644 --- a/core/modules/block_content/src/Tests/BlockContentTypeTest.php +++ b/core/modules/block_content/src/Tests/BlockContentTypeTest.php @@ -87,7 +87,7 @@ public function testBlockContentTypeEditing() { $this->drupalGet('block/add'); $this->assertRaw('Bar', 'New name was displayed.'); $this->clickLink('Bar'); - $this->assertEqual(\Drupal::url('block_content.add_form', array('block_content_type' => 'basic'), array('absolute' => TRUE)), $this->getUrl(), 'Original machine name was used in URL.'); + $this->assertUrl(\Drupal::url('block_content.add_form', ['block_content_type' => 'basic'], ['absolute' => TRUE]), [], 'Original machine name was used in URL.'); // Remove the body field. $this->drupalPostForm('admin/structure/block/block-content/manage/basic/fields/block_content.basic.body/delete', array(), t('Delete')); diff --git a/core/modules/comment/src/Tests/CommentTypeTest.php b/core/modules/comment/src/Tests/CommentTypeTest.php index ba32639..872d29b 100644 --- a/core/modules/comment/src/Tests/CommentTypeTest.php +++ b/core/modules/comment/src/Tests/CommentTypeTest.php @@ -108,7 +108,7 @@ public function testCommentTypeEditing() { $this->drupalGet('admin/structure/comment'); $this->assertRaw('Bar', 'New name was displayed.'); $this->clickLink('Manage fields'); - $this->assertEqual(\Drupal::url('field_ui.overview_comment', array('comment_type' => 'comment'), array('absolute' => TRUE)), $this->getUrl(), 'Original machine name was used in URL.'); + $this->assertUrl(\Drupal::url('field_ui.overview_comment', array('comment_type' => 'comment'), array('absolute' => TRUE)), [], 'Original machine name was used in URL.'); // Remove the body field. $this->drupalPostForm('admin/structure/comment/manage/comment/fields/comment.comment.comment_body/delete', array(), t('Delete')); diff --git a/core/modules/language/src/Tests/LanguageConfigurationTest.php b/core/modules/language/src/Tests/LanguageConfigurationTest.php index 582d567..c7e66d6 100644 --- a/core/modules/language/src/Tests/LanguageConfigurationTest.php +++ b/core/modules/language/src/Tests/LanguageConfigurationTest.php @@ -43,7 +43,7 @@ function testLanguageConfiguration() { ); $this->drupalPostForm('admin/config/regional/language/add', $edit, 'Add language'); $this->assertText('French'); - $this->assertEqual($this->getUrl(), \Drupal::url('language.admin_overview', array(), array('absolute' => TRUE)), 'Correct page redirection.'); + $this->assertUrl(\Drupal::url('language.admin_overview', [], ['absolute' => TRUE]), [], 'Correct page redirection.'); // Langcode for Languages is always 'en'. $language = $this->container->get('config.factory')->get('language.entity.fr')->get(); $this->assertEqual($language['langcode'], 'en'); @@ -66,7 +66,7 @@ function testLanguageConfiguration() { $this->drupalPostForm(NULL, $edit, t('Save configuration')); $this->rebuildContainer(); $this->assertOptionSelected('edit-site-default-language', 'fr', 'Default language updated.'); - $this->assertEqual($this->getUrl(), \Drupal::url('system.regional_settings', array(), array('absolute' => TRUE, 'langcode' => 'fr')), 'Correct page redirection.'); + $this->assertUrl(\Drupal::url('system.regional_settings', [], ['absolute' => TRUE, 'langcode' => 'fr']), [], 'Correct page redirection.'); // Check if a valid language prefix is added after changing the default // language. diff --git a/core/modules/language/src/Tests/LanguageCustomLanguageConfigurationTest.php b/core/modules/language/src/Tests/LanguageCustomLanguageConfigurationTest.php index 834e778..529ceab 100644 --- a/core/modules/language/src/Tests/LanguageCustomLanguageConfigurationTest.php +++ b/core/modules/language/src/Tests/LanguageCustomLanguageConfigurationTest.php @@ -44,7 +44,7 @@ public function testLanguageConfiguration() { $this->assertText(t('!name field is required.', array('!name' => t('Language name in English')))); $empty_language = new Language(); $this->assertFieldChecked('edit-direction-' . $empty_language->direction, 'Consistent usage of language direction.'); - $this->assertEqual($this->getUrl(), \Drupal::url('language.add', array(), array('absolute' => TRUE)), 'Correct page redirection.'); + $this->assertUrl(\Drupal::url('language.add', array(), array('absolute' => TRUE)), [], 'Correct page redirection.'); // Test validation of invalid values. $edit = array( @@ -56,7 +56,7 @@ public function testLanguageConfiguration() { $this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add custom language')); $this->assertRaw(t('%field may only contain characters a-z, underscores, or hyphens.', array('%field' => t('Language code')))); $this->assertRaw(t('%field cannot contain any markup.', array('%field' => t('Language name in English')))); - $this->assertEqual($this->getUrl(), \Drupal::url('language.add', array(), array('absolute' => TRUE)), 'Correct page redirection.'); + $this->assertUrl(\Drupal::url('language.add', array(), array('absolute' => TRUE)), [], 'Correct page redirection.'); // Test validation of existing language values. $edit = array( @@ -72,7 +72,7 @@ public function testLanguageConfiguration() { 'The language %language has been created and can now be used.', array('%language' => $edit['label']) )); - $this->assertEqual($this->getUrl(), \Drupal::url('language.admin_overview', array(), array('absolute' => TRUE)), 'Correct page redirection.'); + $this->assertUrl(\Drupal::url('language.admin_overview', array(), array('absolute' => TRUE)), [], 'Correct page redirection.'); // 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')); @@ -80,6 +80,6 @@ public function testLanguageConfiguration() { 'The language %language (%langcode) already exists.', array('%language' => $edit['label'], '%langcode' => $edit['langcode']) )); - $this->assertEqual($this->getUrl(), \Drupal::url('language.add', array(), array('absolute' => TRUE)), 'Correct page redirection.'); + $this->assertUrl(\Drupal::url('language.add', array(), array('absolute' => TRUE)), [], 'Correct page redirection.'); } } diff --git a/core/modules/language/src/Tests/LanguageListTest.php b/core/modules/language/src/Tests/LanguageListTest.php index a4e7442..c27f981 100644 --- a/core/modules/language/src/Tests/LanguageListTest.php +++ b/core/modules/language/src/Tests/LanguageListTest.php @@ -41,7 +41,7 @@ function testLanguageList() { ); $this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add language')); $this->assertText('French', 'Language added successfully.'); - $this->assertEqual($this->getUrl(), \Drupal::url('language.admin_overview', array(), array('absolute' => TRUE))); + $this->assertUrl(\Drupal::url('language.admin_overview', [], ['absolute' => TRUE])); // Add custom language. $langcode = 'xx'; @@ -53,7 +53,7 @@ function testLanguageList() { 'direction' => Language::DIRECTION_LTR, ); $this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add custom language')); - $this->assertEqual($this->getUrl(), \Drupal::url('language.admin_overview', array(), array('absolute' => TRUE))); + $this->assertUrl(\Drupal::url('language.admin_overview', [], ['absolute' => TRUE])); $this->assertRaw('"edit-languages-' . $langcode .'-weight"', 'Language code found.'); $this->assertText(t($name), 'Test language added.'); @@ -71,11 +71,11 @@ function testLanguageList() { $this->drupalPostForm(NULL, $edit, t('Save configuration')); $this->rebuildContainer(); $this->assertNoOptionSelected('edit-site-default-language', 'en', 'Default language updated.'); - $this->assertEqual($this->getUrl(), \Drupal::url('system.regional_settings', array(), array('absolute' => TRUE, 'language' => $language))); + $this->assertUrl(\Drupal::url('system.regional_settings', [], ['absolute' => TRUE, 'language' => $language])); // Ensure we can't delete the default language. $this->drupalGet('admin/config/regional/language/delete/' . $langcode); - $this->assertEqual($this->getUrl(), \Drupal::url('language.admin_overview', array(), array('absolute' => TRUE, 'language' => $language))); + $this->assertUrl(\Drupal::url('language.admin_overview', [], ['absolute' => TRUE, 'language' => $language])); $this->assertText(t('The default language cannot be deleted.'), 'Failed to delete the default language.'); // Ensure 'Edit' link works. @@ -88,7 +88,7 @@ function testLanguageList() { ); $this->drupalPostForm('admin/config/regional/language/edit/' . $langcode, $edit, t('Save language')); $this->assertRaw($name, 'The language has been updated.'); - $this->assertEqual($this->getUrl(), \Drupal::url('language.admin_overview', array(), array('absolute' => TRUE, 'language' => $language))); + $this->assertUrl(\Drupal::url('language.admin_overview', [], ['absolute' => TRUE, 'language' => $language])); // Change back the default language. $edit = array( @@ -104,7 +104,7 @@ function testLanguageList() { $this->drupalGet('admin/config/regional/language/delete/' . $langcode); // First test the 'cancel' link. $this->clickLink(t('Cancel')); - $this->assertEqual($this->getUrl(), \Drupal::url('language.admin_overview', array(), array('absolute' => TRUE, 'language' => $english))); + $this->assertUrl(\Drupal::url('language.admin_overview', [], ['absolute' => TRUE, '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. @@ -112,7 +112,7 @@ function testLanguageList() { // We need raw here because %language and %langcode will add HTML. $t_args = array('%language' => $name, '%langcode' => $langcode); $this->assertRaw(t('The %language (%langcode) language has been removed.', $t_args), 'The test language has been removed.'); - $this->assertEqual($this->getUrl(), \Drupal::url('language.admin_overview', array(), array('absolute' => TRUE, 'language' => $english))); + $this->assertUrl(\Drupal::url('language.admin_overview', [], ['absolute' => TRUE, 'language' => $english])); // Verify that language is no longer found. $this->drupalGet('admin/config/regional/language/delete/' . $langcode); $this->assertResponse(404, 'Language no longer found.'); @@ -124,7 +124,7 @@ function testLanguageList() { // We need raw here because %language and %langcode will add HTML. $t_args = array('%language' => 'French', '%langcode' => 'fr'); $this->assertRaw(t('The %language (%langcode) language has been removed.', $t_args), 'The French language has been removed.'); - $this->assertEqual($this->getUrl(), \Drupal::url('language.admin_overview', array(), array('absolute' => TRUE))); + $this->assertUrl(\Drupal::url('language.admin_overview', [], ['absolute' => TRUE])); // Verify that language is no longer found. $this->drupalGet('admin/config/regional/language/delete/fr'); $this->assertResponse(404, 'Language no longer found.'); @@ -142,7 +142,7 @@ function testLanguageList() { 'direction' => Language::DIRECTION_LTR, ); $this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add custom language')); - $this->assertEqual($this->getUrl(), \Drupal::url('language.admin_overview', array(), array('absolute' => TRUE))); + $this->assertUrl(\Drupal::url('language.admin_overview', [], ['absolute' => TRUE])); $this->assertText($name, 'Name found.'); // Check if we can change the default language. @@ -156,7 +156,7 @@ function testLanguageList() { $this->drupalPostForm(NULL, $edit, t('Save configuration')); $this->rebuildContainer(); $this->assertNoOptionSelected('edit-site-default-language', 'en', 'Default language updated.'); - $this->assertEqual($this->getUrl(), \Drupal::url('system.regional_settings', array(), array('absolute' => TRUE, 'language' => $language))); + $this->assertUrl(\Drupal::url('system.regional_settings', [], ['absolute' => TRUE, 'language' => $language])); $this->drupalPostForm('admin/config/regional/language/delete/en', array(), t('Delete')); // We need raw here because %language and %langcode will add HTML. diff --git a/core/modules/language/src/Tests/LanguageUILanguageNegotiationTest.php b/core/modules/language/src/Tests/LanguageUILanguageNegotiationTest.php index 8f32d13..d76b448 100644 --- a/core/modules/language/src/Tests/LanguageUILanguageNegotiationTest.php +++ b/core/modules/language/src/Tests/LanguageUILanguageNegotiationTest.php @@ -417,7 +417,10 @@ function testLanguageDomain() { // Test URL in another language: http://it.example.com/admin. // Base path gives problems on the testbot, so $correct_link is hard-coded. // @see UrlAlterFunctionalTest::assertUrlOutboundAlter (path.test). - $italian_url = \Drupal::url('system.admin', array(), array('language' => $languages['it'], 'script' => '')); + // @todo Using \Drupal::url() doesn't use the language prefixing. + // $italian_url = \Drupal::url('system.admin', [], ['language' => $languages['it'], 'script' => '']); + $italian_url = \Drupal::urlGenerator()->generateFromPath('admin', ['language' => $languages['it'], 'script' => '']); + $url_scheme = \Drupal::request()->isSecure() ? 'https://' : 'http://'; $correct_link = $url_scheme . $link; $this->assertEqual($italian_url, $correct_link, format_string('The url() function returns the right URL (@url) in accordance with the chosen language', array('@url' => $italian_url))); @@ -426,7 +429,8 @@ function testLanguageDomain() { $this->settingsSet('mixed_mode_sessions', TRUE); $this->rebuildContainer(); - $italian_url = \Drupal::url('system.admin', array(), array('https' => TRUE, 'language' => $languages['it'], 'script' => '')); + // $italian_url = \Drupal::url('system.admin', ['https' => TRUE, 'language' => $languages['it'], 'script' => '']); + $italian_url = \Drupal::urlGenerator()->generateFromPath('admin', ['https' => TRUE, 'language' => $languages['it'], 'script' => '']); $correct_link = 'https://' . $link; $this->assertTrue($italian_url == $correct_link, format_string('The url() function returns the right HTTPS URL (via options) (@url) in accordance with the chosen language', array('@url' => $italian_url))); $this->settingsSet('mixed_mode_sessions', FALSE); @@ -434,8 +438,10 @@ function testLanguageDomain() { // Test HTTPS via current URL scheme. $request = Request::create('', 'GET', array(), array(), array(), array('HTTPS' => 'on')); $this->container->get('request_stack')->push($request); - $generator = $this->container->get('url_generator'); - $italian_url = \Drupal::url('system.admin', array(), array('language' => $languages['it'], 'script' => '')); + + // $italian_url = \Drupal::url('system.admin', [], ['language' => $languages['it'], 'script' => '']); + $italian_url = \Drupal::urlGenerator()->generateFromPath('admin', ['language' => $languages['it'], 'script' => '']); + $correct_link = 'https://' . $link; $this->assertTrue($italian_url == $correct_link, format_string('The url() function returns the right URL (via current URL scheme) (@url) in accordance with the chosen language', array('@url' => $italian_url))); } diff --git a/core/modules/locale/src/Tests/LocaleImportFunctionalTest.php b/core/modules/locale/src/Tests/LocaleImportFunctionalTest.php index 2c9177c..1ca2ad8 100644 --- a/core/modules/locale/src/Tests/LocaleImportFunctionalTest.php +++ b/core/modules/locale/src/Tests/LocaleImportFunctionalTest.php @@ -80,7 +80,7 @@ public function testStandalonePoFile() { $this->assert($locale_plurals['fr']['plurals'] == 2, 'Plural number initialized.'); // Ensure we were redirected correctly. - $this->assertEqual($this->getUrl(), \Drupal::url('locale.translate_page', array(), array('absolute' => TRUE)), 'Correct page redirection.'); + $this->assertUrl(\Drupal::url('locale.translate_page', [], ['absolute' => TRUE]), [], 'Correct page redirection.'); // Try importing a .po file with invalid tags. $this->importPoFile($this->getBadPoFile(), array( @@ -130,7 +130,7 @@ public function testStandalonePoFile() { 'langcode' => 'fr', 'files[file]' => $name, ), t('Import')); - $this->assertEqual($this->getUrl(), \Drupal::url('locale.translate_import', array(), array('absolute' => TRUE)), 'Correct page redirection.'); + $this->assertUrl(\Drupal::url('locale.translate_import', [], ['absolute' => TRUE]), [], 'Correct page redirection.'); $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/locale/src/Tests/LocaleTranslationUiTest.php b/core/modules/locale/src/Tests/LocaleTranslationUiTest.php index f7a304a..e9919cd 100644 --- a/core/modules/locale/src/Tests/LocaleTranslationUiTest.php +++ b/core/modules/locale/src/Tests/LocaleTranslationUiTest.php @@ -106,7 +106,7 @@ public function testStringTranslation() { $this->drupalPostForm('admin/config/regional/translate', $edit, t('Save translations')); $this->assertText(t('The strings have been saved.'), 'The strings have been saved.'); $url_bits = explode('?', $this->getUrl()); - $this->assertEqual($url_bits[0], \Drupal::url('locale.translate_import', array(), array('absolute' => TRUE)), 'Correct page redirection.'); + $this->assertEqual($url_bits[0], \Drupal::url('locale.translate_page', array(), array('absolute' => TRUE)), 'Correct page redirection.'); $search = array( 'string' => $name, 'langcode' => $langcode, diff --git a/core/modules/node/src/Tests/NodeTypeTest.php b/core/modules/node/src/Tests/NodeTypeTest.php index c0fdb83..b0bb658 100644 --- a/core/modules/node/src/Tests/NodeTypeTest.php +++ b/core/modules/node/src/Tests/NodeTypeTest.php @@ -108,7 +108,7 @@ function testNodeTypeEditing() { $this->assertRaw('Bar', 'New name was displayed.'); $this->assertRaw('Lorem ipsum', 'New description was displayed.'); $this->clickLink('Bar'); - $this->assertEqual(\Drupal::url('node.add', ['node_type' => 'bar'], ['absolute' => TRUE]), $this->getUrl(), 'New machine name was used in URL.'); + $this->assertUrl(\Drupal::url('node.add', ['node_type' => 'bar'], ['absolute' => TRUE]), [], 'New machine name was used in URL.'); $this->assertRaw('Foo', 'Title field was found.'); $this->assertRaw('Body', 'Body field was found.'); diff --git a/core/modules/node/src/Tests/PageEditTest.php b/core/modules/node/src/Tests/PageEditTest.php index 3fb22c0..20f411c 100644 --- a/core/modules/node/src/Tests/PageEditTest.php +++ b/core/modules/node/src/Tests/PageEditTest.php @@ -43,9 +43,7 @@ function testPageEdit() { // Check that "edit" link points to correct page. $this->clickLink(t('Edit')); - $edit_url = $node->url('canonical', ['absolute' => TRUE]); - $actual_url = $this->getURL(); - $this->assertEqual($edit_url, $actual_url, 'On edit page.'); + $this->assertUrl($node->url('edit-form', ['absolute' => TRUE])); // Check that the title and body fields are displayed with the correct values. $active = '' . t('(active tab)') . ''; diff --git a/core/modules/search/src/Tests/SearchLanguageTest.php b/core/modules/search/src/Tests/SearchLanguageTest.php index 5dbd988..5573a52 100644 --- a/core/modules/search/src/Tests/SearchLanguageTest.php +++ b/core/modules/search/src/Tests/SearchLanguageTest.php @@ -98,7 +98,7 @@ function testLanguages() { // Ensure selecting no language does not make the query different. $this->drupalPostForm('search/node', array(), t('Advanced search')); - $this->assertEqual($this->getUrl(), url('search/node/', array('query' => array('keys' => ''), 'absolute' => TRUE)), 'Correct page redirection, no language filtering.'); + $this->assertUrl(\Drupal::url('search.view_node', [], ['query' => ['keys' => ''], 'absolute' => TRUE]), [], 'Correct page redirection, no language filtering.'); // Pick French and ensure it is selected. $edit = array('language[fr]' => TRUE); diff --git a/core/modules/simpletest/src/WebTestBase.php b/core/modules/simpletest/src/WebTestBase.php index 94dda8f..94cb9d8 100644 --- a/core/modules/simpletest/src/WebTestBase.php +++ b/core/modules/simpletest/src/WebTestBase.php @@ -2478,8 +2478,9 @@ protected function drupalSetSettings($settings) { */ protected function assertUrl($path, array $options = array(), $message = '', $group = 'Other') { if (!$message) { - $message = String::format('Current URL is @url.', array( + $message = String::format('Expected @url matches current URL (@current_url).', array( '@url' => var_export($this->container->get('url_generator')->generateFromPath($path, $options), TRUE), + '@current_url' => $this->getUrl(), )); } $options['absolute'] = TRUE; diff --git a/core/modules/system/src/Tests/Form/RedirectTest.php b/core/modules/system/src/Tests/Form/RedirectTest.php index cf8c5a0..6ea944c 100644 --- a/core/modules/system/src/Tests/Form/RedirectTest.php +++ b/core/modules/system/src/Tests/Form/RedirectTest.php @@ -97,7 +97,7 @@ public function testRedirectFromErrorPages() { $this->assertResponse(404); $this->drupalPostForm(NULL, array(), t('Submit')); $this->assertResponse(200); - $this->assertEqual($this->getUrl(), $expected, 'Redirected to correct url/query.'); + $this->assertUrl($expected, [], 'Redirected to correct url/query.'); // Visit the block admin page (403 page) and submit the form. Verify it // ends up at the right URL. @@ -105,6 +105,6 @@ public function testRedirectFromErrorPages() { $this->assertResponse(403); $this->drupalPostForm(NULL, array(), t('Submit')); $this->assertResponse(200); - $this->assertEqual($this->getUrl(), $expected, 'Redirected to correct url/query.'); + $this->assertUrl($expected, [], 'Redirected to correct url/query.'); } } diff --git a/core/modules/system/src/Tests/System/DateTimeTest.php b/core/modules/system/src/Tests/System/DateTimeTest.php index 5445373..2e2e4ed 100644 --- a/core/modules/system/src/Tests/System/DateTimeTest.php +++ b/core/modules/system/src/Tests/System/DateTimeTest.php @@ -87,7 +87,7 @@ function testDateFormatConfiguration() { 'date_format_pattern' => $date_format, ); $this->drupalPostForm('admin/config/regional/date-time/formats/add', $edit, t('Add format')); - $this->assertEqual($this->getUrl(), \Drupal::url('system.date_format_list', [], array('absolute' => TRUE)), 'Correct page redirection.'); + $this->assertUrl(\Drupal::url('system.date_format_list', [], ['absolute' => TRUE]), [], 'Correct page redirection.'); $this->assertText(t('Custom date format added.'), 'Date format added confirmation message appears.'); $this->assertText($date_format_id, 'Custom date format appears in the date format list.'); $this->assertText(t('Delete'), 'Delete link for custom date format appears.'); @@ -106,13 +106,13 @@ function testDateFormatConfiguration() { 'date_format_pattern' => 'Y m', ); $this->drupalPostForm($this->getUrl(), $edit, t('Save format')); - $this->assertEqual($this->getUrl(), \Drupal::url('system.date_format_list', [], array('absolute' => TRUE)), 'Correct page redirection.'); + $this->assertUrl(\Drupal::url('system.date_format_list', [], ['absolute' => TRUE]), [], 'Correct page redirection.'); $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', array(), t('Remove')); - $this->assertEqual($this->getUrl(), \Drupal::url('system.date_format_list', [], array('absolute' => TRUE)), 'Correct page redirection.'); + $this->assertUrl(\Drupal::url('system.date_format_list', [], ['absolute' => TRUE]), [], 'Correct page redirection.'); $this->assertRaw(t('Removed date format %format.', array('%format' => $name)), 'Custom date format removed.'); // Make sure the date does not exist in config. diff --git a/core/modules/toolbar/src/Tests/ToolbarAdminMenuTest.php b/core/modules/toolbar/src/Tests/ToolbarAdminMenuTest.php index fefb74b..0fcda74 100644 --- a/core/modules/toolbar/src/Tests/ToolbarAdminMenuTest.php +++ b/core/modules/toolbar/src/Tests/ToolbarAdminMenuTest.php @@ -404,7 +404,7 @@ 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->assertEqual($this->getUrl(), url('admin/config/regional/translate', array('absolute' => TRUE)), 'Correct page redirection.'); + $this->assertUrl(\Drupal::url('locale.translate_page', [], ['absolute' => TRUE]), [], 'Correct page redirection.'); $this->drupalLogout(); // Log in the admin_user. Check the admin menu subtrees hash now that one diff --git a/core/modules/user/src/Tests/UserBlocksTest.php b/core/modules/user/src/Tests/UserBlocksTest.php index 33c892a..90fcbfd 100644 --- a/core/modules/user/src/Tests/UserBlocksTest.php +++ b/core/modules/user/src/Tests/UserBlocksTest.php @@ -54,7 +54,7 @@ function testUserLoginBlock() { $this->assertNoText(t('User login'), 'Logged in.'); // Check that we are still on the same page. - $this->assertEqual(\Drupal::url('user.admin_permissions', [], array('absolute' => TRUE)), $this->getUrl(), 'Still on the same page after login for access denied page'); + $this->assertUrl(\Drupal::url('user.admin_permissions'), ['absolute' => TRUE], 'Still on the same page after login for access denied page'); // Now, log out and repeat with a non-403 page. $this->drupalLogout(); @@ -67,7 +67,7 @@ function testUserLoginBlock() { $this->drupalLogout(); $this->drupalPostForm('http://example.com/', $edit, t('Log in'), array('external' => FALSE)); // Check that we remain on the site after login. - $this->assertEqual(\Drupal::url('entity.user.canonical', ['user' => $user->id()], array('absolute' => TRUE)), $this->getUrl(), 'Redirected to user profile page after login from the frontpage'); + $this->assertUrl($user->url('canonical'), ['absolute' => TRUE], 'Redirected to user profile page after login from the frontpage'); } /** diff --git a/core/modules/user/src/Tests/UserLoginTest.php b/core/modules/user/src/Tests/UserLoginTest.php index e7161a5..cf0fc8a 100644 --- a/core/modules/user/src/Tests/UserLoginTest.php +++ b/core/modules/user/src/Tests/UserLoginTest.php @@ -24,8 +24,7 @@ function testLoginDestination() { $this->drupalGet('user', array('query' => array('destination' => 'foo'))); $edit = array('name' => $user->getUserName(), 'pass' => $user->pass_raw); $this->drupalPostForm(NULL, $edit, t('Log in')); - $expected = url('foo', array('absolute' => TRUE)); - $this->assertEqual($this->getUrl(), $expected, 'Redirected to the correct URL'); + $this->assertUrl('foo', [], 'Redirected to the correct URL'); } /**