Issue #3139419 by mondrake, aleevas: Replace usages of AssertLegacyTrait::assertUrl, that is deprecated

merge-requests/25/head
catch 2020-09-02 14:52:13 +01:00
parent edd570f7c2
commit c09dc39b8f
93 changed files with 203 additions and 204 deletions

View File

@ -30,7 +30,7 @@ class AddFeedTest extends AggregatorTestBase {
$feed->refreshItems();
// Check feed data.
$this->assertUrl(Url::fromRoute('aggregator.feed_add'));
$this->assertSession()->addressEquals(Url::fromRoute('aggregator.feed_add'));
$this->assertTrue($this->uniqueFeed($feed->label(), $feed->getUrl()), 'The feed is unique.');
// Check feed source.

View File

@ -38,7 +38,7 @@ class UpdateFeedTest extends AggregatorTestBase {
$this->assertSession()->elementExists('xpath', '//div[@data-drupal-messages]//a[contains(@href, "aggregator/sources/")]');
// Check feed data.
$this->assertUrl($feed->toUrl('canonical'));
$this->assertSession()->addressEquals($feed->toUrl('canonical'));
$this->assertTrue($this->uniqueFeed($edit['title[0][value]'], $edit['url[0][value]']), 'The feed is unique.');
// Check feed source.

View File

@ -48,7 +48,7 @@ class BlockFormInBlockTest extends BrowserTestBase {
// Make sure that we're currently still on /test-page after submitting the
// form.
$this->drupalPostForm(NULL, $form_values, t('Submit'));
$this->assertUrl('test-page');
$this->assertSession()->addressEquals('test-page');
$this->assertText(t('Your email address is @email', ['@email' => 'test@example.com']));
// Go to a different page and see if the block is enabled there as well.
@ -60,7 +60,7 @@ class BlockFormInBlockTest extends BrowserTestBase {
// we submitted the form from after submitting the form from
// /test-render-title.
$this->drupalPostForm(NULL, $form_values, t('Submit'));
$this->assertUrl('test-render-title');
$this->assertSession()->addressEquals('test-render-title');
$this->assertText(t('Your email address is @email', ['@email' => 'test@example.com']));
}

View File

@ -240,7 +240,7 @@ class BlockTest extends BlockTestBase {
$this->assertRaw(t('Are you sure you want to remove the block @name?', ['@name' => $block->label()]));
$this->drupalPostForm(NULL, [], t('Remove'));
$this->assertRaw(t('The block %name has been removed.', ['%name' => $block->label()]));
$this->assertUrl('admin');
$this->assertSession()->addressEquals('admin');
$this->assertNoRaw($block->id());
}
@ -261,7 +261,7 @@ class BlockTest extends BlockTestBase {
$block['region'] = 'content';
$this->drupalPostForm('admin/structure/block/add/system_powered_by_block', $block, t('Save block'));
$this->assertText(t('The block configuration has been saved.'));
$this->assertUrl('admin/structure/block/list/' . $theme . '?block-placement=' . Html::getClass($block['id']));
$this->assertSession()->addressEquals('admin/structure/block/list/' . $theme . '?block-placement=' . Html::getClass($block['id']));
// Set the default theme and ensure the block is placed.
$theme_settings->set('default', $theme)->save();

View File

@ -98,7 +98,7 @@ class DisplayBlockTest extends ViewTestBase {
// Duplicate the block before changing the category.
$this->drupalPostForm('admin/structure/views/view/' . $edit['id'] . '/edit/block_1', [], t('Duplicate @display_title', ['@display_title' => 'Block']));
$this->assertUrl('admin/structure/views/view/' . $edit['id'] . '/edit/block_2');
$this->assertSession()->addressEquals('admin/structure/views/view/' . $edit['id'] . '/edit/block_2');
// Change the block category to a random string.
$this->drupalGet('admin/structure/views/view/' . $edit['id'] . '/edit/block_1');
@ -110,7 +110,7 @@ class DisplayBlockTest extends ViewTestBase {
// Duplicate the block after changing the category.
$this->drupalPostForm(NULL, [], t('Duplicate @display_title', ['@display_title' => 'Block']));
$this->assertUrl('admin/structure/views/view/' . $edit['id'] . '/edit/block_3');
$this->assertSession()->addressEquals('admin/structure/views/view/' . $edit['id'] . '/edit/block_3');
$this->drupalPostForm(NULL, [], t('Save'));

View File

@ -135,7 +135,7 @@ class BlockContentTypeTest extends BlockContentTestBase {
$this->assertRaw('Bar', 'New name was displayed.');
$this->clickLink('Bar');
// Verify that the original machine name was used in the URL.
$this->assertUrl(Url::fromRoute('block_content.add_form', ['block_content_type' => 'basic']));
$this->assertSession()->addressEquals(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'));
@ -227,9 +227,9 @@ class BlockContentTypeTest extends BlockContentTestBase {
$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]));
$this->assertSession()->addressEquals(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], ['query' => ['block-placement' => Html::getClass($edit['info[0][value]'])]]));
$this->assertSession()->addressEquals(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.');
@ -246,7 +246,7 @@ class BlockContentTypeTest extends BlockContentTestBase {
$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'));
$this->assertSession()->addressEquals(Url::fromRoute('entity.block_content.collection'));
}
else {
$this->fail('Could not load created block.');

View File

@ -49,7 +49,7 @@ class BlockContentRedirectTest extends BlockContentTestBase {
// Edit the created block and save.
$this->clickLink('Edit');
$this->drupalPostForm(NULL, [], 'Save');
$this->assertUrl('admin/content/redirect_destination');
$this->assertSession()->addressEquals('admin/content/redirect_destination');
}
}

View File

@ -125,7 +125,7 @@ class CommentInterfaceTest extends CommentTestBase {
// \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']));
$this->assertSession()->addressEquals(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.');

View File

@ -115,7 +115,7 @@ class CommentTypeTest extends CommentTestBase {
$this->assertRaw('Bar', 'New name was displayed.');
$this->clickLink('Manage fields');
// Verify that the original machine name was used in the URL.
$this->assertUrl(Url::fromRoute('entity.comment.field_ui_fields', ['comment_type' => 'comment']));
$this->assertSession()->addressEquals(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.

View File

@ -54,7 +54,7 @@ class WizardTest extends WizardTestBase {
$this->drupalPostForm('admin/structure/views/add', $view, t('Save and edit'));
// Verify that the view saving was successful and the browser got redirected
// to the edit page.
$this->assertUrl('admin/structure/views/view/' . $view['id']);
$this->assertSession()->addressEquals('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 +75,7 @@ class WizardTest extends WizardTestBase {
$this->drupalPostForm(NULL, $view, t('Save and edit'));
// Verify that the view saving was successful and the browser got redirected
// to the edit page.
$this->assertUrl('admin/structure/views/view/' . $view['id']);
$this->assertSession()->addressEquals('admin/structure/views/view/' . $view['id']);
$user = $this->drupalCreateUser(['access comments']);
$this->drupalLogin($user);

View File

@ -244,7 +244,7 @@ class ConfigEntityTest extends BrowserTestBase {
'label' => $label1,
];
$this->drupalPostForm('admin/structure/config_test/add', $edit, 'Save');
$this->assertUrl('admin/structure/config_test');
$this->assertSession()->addressEquals('admin/structure/config_test');
$this->assertSession()->statusCodeEquals(200);
$this->assertRaw($message_insert);
$this->assertNoRaw($message_update);
@ -255,7 +255,7 @@ class ConfigEntityTest extends BrowserTestBase {
'label' => $label2,
];
$this->drupalPostForm("admin/structure/config_test/manage/$id", $edit, 'Save');
$this->assertUrl('admin/structure/config_test');
$this->assertSession()->addressEquals('admin/structure/config_test');
$this->assertSession()->statusCodeEquals(200);
$this->assertNoRaw($message_insert);
$this->assertRaw($message_update);
@ -265,9 +265,9 @@ class ConfigEntityTest extends BrowserTestBase {
// Delete the configuration entity.
$this->drupalGet("admin/structure/config_test/manage/$id");
$this->clickLink(t('Delete'));
$this->assertUrl("admin/structure/config_test/manage/$id/delete");
$this->assertSession()->addressEquals("admin/structure/config_test/manage/$id/delete");
$this->drupalPostForm(NULL, [], 'Delete');
$this->assertUrl('admin/structure/config_test');
$this->assertSession()->addressEquals('admin/structure/config_test');
$this->assertSession()->statusCodeEquals(200);
$this->assertNoRaw($message_update);
$this->assertRaw($message_delete);
@ -280,7 +280,7 @@ class ConfigEntityTest extends BrowserTestBase {
'label' => $label1,
];
$this->drupalPostForm('admin/structure/config_test/add', $edit, 'Save');
$this->assertUrl('admin/structure/config_test');
$this->assertSession()->addressEquals('admin/structure/config_test');
$this->assertSession()->statusCodeEquals(200);
$this->assertText($label1);
$this->assertLinkByHref("admin/structure/config_test/manage/$id");
@ -291,7 +291,7 @@ class ConfigEntityTest extends BrowserTestBase {
'label' => $label3,
];
$this->drupalPostForm("admin/structure/config_test/manage/$id", $edit, 'Save');
$this->assertUrl('admin/structure/config_test');
$this->assertSession()->addressEquals('admin/structure/config_test');
$this->assertSession()->statusCodeEquals(200);
$this->assertNoText($label1);
$this->assertNoText($label2);

View File

@ -154,7 +154,7 @@ class ConfigTranslationUiTest extends BrowserTestBase {
$this->clickLink(t('Edit'));
// Also check that saving the form leads back to the translation overview.
$this->drupalPostForm(NULL, [], t('Save configuration'));
$this->assertUrl($translation_base_url);
$this->assertSession()->addressEquals($translation_base_url);
// Check 'Add' link of French to visit add page.
$this->assertLinkByHref("$translation_base_url/fr/add");

View File

@ -357,7 +357,7 @@ class ContactSitewideTest extends BrowserTestBase {
];
$this->drupalPostForm(NULL, $edit, t('Send message'));
$this->assertText('Thanks for your submission.');
$this->assertUrl('user/' . $admin_user->id());
$this->assertSession()->addressEquals('user/' . $admin_user->id());
// Test Empty message.
/** @var \Drupal\contact\ContactFormInterface $form */
@ -378,7 +378,7 @@ class ContactSitewideTest extends BrowserTestBase {
$this->drupalPostForm(NULL, $edit, t('Send message'));
$result = $this->xpath('//div[@role=:role]', [':role' => 'contentinfo']);
$this->assertCount(0, $result, 'Messages not found.');
$this->assertUrl('user/' . $admin_user->id());
$this->assertSession()->addressEquals('user/' . $admin_user->id());
// Test preview and visibility of the message field and label. Submit the
// contact form and verify the content.

View File

@ -110,7 +110,7 @@ class ModerationFormTest extends ModerationStateTestBase {
'view_mode_id' => 'full',
]);
$this->assertSession()->statusCodeEquals(200);
$this->assertUrl($preview_url);
$this->assertSession()->addressEquals($preview_url);
$this->assertSession()->fieldNotExists('edit-new-state');
// The latest version page should not show, because there is still no

View File

@ -95,7 +95,7 @@ class ModerationStateNodeTest extends ModerationStateTestBase {
// After saving, we should be at the canonical URL and viewing the first
// revision.
$this->assertUrl(Url::fromRoute('entity.node.canonical', ['node' => $node->id()]));
$this->assertSession()->addressEquals(Url::fromRoute('entity.node.canonical', ['node' => $node->id()]));
$this->assertText('First version of the content.');
// Create a new draft; after saving, we should still be on the canonical
@ -104,7 +104,7 @@ class ModerationStateNodeTest extends ModerationStateTestBase {
'body[0][value]' => 'Second version of the content.',
'moderation_state[0][state]' => 'draft',
], t('Save'));
$this->assertUrl(Url::fromRoute('entity.node.canonical', ['node' => $node->id()]));
$this->assertSession()->addressEquals(Url::fromRoute('entity.node.canonical', ['node' => $node->id()]));
$this->assertText('Second version of the content.');
// Make a new published revision; after saving, we should be at the
@ -113,7 +113,7 @@ class ModerationStateNodeTest extends ModerationStateTestBase {
'body[0][value]' => 'Third version of the content.',
'moderation_state[0][state]' => 'published',
], t('Save'));
$this->assertUrl(Url::fromRoute('entity.node.canonical', ['node' => $node->id()]));
$this->assertSession()->addressEquals(Url::fromRoute('entity.node.canonical', ['node' => $node->id()]));
$this->assertText('Third version of the content.');
// Make a new pending revision; after saving, we should be on the "Latest
@ -122,7 +122,7 @@ class ModerationStateNodeTest extends ModerationStateTestBase {
'body[0][value]' => 'Fourth version of the content.',
'moderation_state[0][state]' => 'draft',
], t('Save'));
$this->assertUrl(Url::fromRoute('entity.node.latest_version', ['node' => $node->id()]));
$this->assertSession()->addressEquals(Url::fromRoute('entity.node.latest_version', ['node' => $node->id()]));
$this->assertText('Fourth version of the content.');
}

View File

@ -329,7 +329,7 @@ class ContentTranslationWorkflowsTest extends ContentTranslationTestBase {
$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);
$this->assertSession()->addressEquals($add_translation_url);
// Check that the translation form does not contain shared elements for
// translators.
if ($expected_status['edit'] == 403) {
@ -354,12 +354,12 @@ class ContentTranslationWorkflowsTest extends ContentTranslationTestBase {
// 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);
$this->assertSession()->addressEquals($expected_edit_path);
}
else {
$this->clickLink('Edit');
// While a translator should be pointed to the translation form.
$this->assertUrl($edit_translation_url);
$this->assertSession()->addressEquals($edit_translation_url);
// Check that the translation form does not contain shared elements.
$this->assertNoSharedElements();
}
@ -396,13 +396,13 @@ class ContentTranslationWorkflowsTest extends ContentTranslationTestBase {
// 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);
$this->assertSession()->addressEquals($expected_delete_path);
}
else {
$this->clickLink('Delete');
// While a translator should be pointed to the translation deletion
// form.
$this->assertUrl($delete_translation_url);
$this->assertSession()->addressEquals($delete_translation_url);
}
}
else {

View File

@ -240,7 +240,7 @@ class ManageFieldsFunctionalTest extends BrowserTestBase {
$this->assertFieldSettings($this->contentType, $this->fieldName, $string);
// Assert redirection back to the "manage fields" page.
$this->assertUrl('admin/structure/types/manage/' . $this->contentType . '/fields');
$this->assertSession()->addressEquals('admin/structure/types/manage/' . $this->contentType . '/fields');
}
/**
@ -670,7 +670,7 @@ class ManageFieldsFunctionalTest extends BrowserTestBase {
$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);
$this->assertSession()->addressEquals($url);
}
/**
@ -682,7 +682,7 @@ class ManageFieldsFunctionalTest extends BrowserTestBase {
];
$this->drupalPostForm('admin/structure/types/manage/article/fields/node.article.body/storage', [], 'Save field settings', $options);
// The external redirect should not fire.
$this->assertUrl('admin/structure/types/manage/article/fields/node.article.body/storage?destinations%5B0%5D=http%3A//example.com');
$this->assertSession()->addressEquals('admin/structure/types/manage/article/fields/node.article.body/storage?destinations%5B0%5D=http%3A//example.com');
$this->assertSession()->statusCodeEquals(200);
$this->assertRaw('Attempt to update field <em class="placeholder">Body</em> failed: <em class="placeholder">The internal path component &#039;http://example.com&#039; is external. You are not allowed to specify an external URL together with internal:/.</em>.');
}

View File

@ -93,7 +93,7 @@ class FilePrivateTest extends FileFieldTestBase {
$this->getSession()->getPage()->find('css', 'input[name="' . $field_name . '[0][fids]"]')->setValue($node_file->id());
$this->getSession()->getPage()->pressButton(t('Save'));
// Make sure the form submit failed - we stayed on the edit form.
$this->assertUrl('node/' . $new_node->id() . '/edit');
$this->assertSession()->addressEquals('node/' . $new_node->id() . '/edit');
// Check that we got the expected constraint form error.
$constraint = new ReferenceAccessConstraint();
$this->assertRaw(new FormattableMarkup($constraint->message, ['%type' => 'file', '%id' => $node_file->id()]));
@ -108,7 +108,7 @@ class FilePrivateTest extends FileFieldTestBase {
$this->getSession()->getPage()->pressButton(t('Save'));
$new_node = $this->drupalGetNodeByTitle($edit['title[0][value]']);
$this->assertTrue(empty($new_node), 'Node was not created.');
$this->assertUrl('node/add/' . $type_name);
$this->assertSession()->addressEquals('node/add/' . $type_name);
$this->assertRaw(new FormattableMarkup($constraint->message, ['%type' => 'file', '%id' => $node_file->id()]));
// Now make file_test_file_download() return everything.

View File

@ -217,7 +217,7 @@ class FilterAdminTest extends BrowserTestBase {
$edit = [];
$edit['filters[filter_html][settings][allowed_html]'] = "<a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>\r\n<quote>";
$this->drupalPostForm('admin/config/content/formats/manage/' . $restricted, $edit, t('Save configuration'));
$this->assertUrl('admin/config/content/formats/manage/' . $restricted);
$this->assertSession()->addressEquals('admin/config/content/formats/manage/' . $restricted);
$this->drupalGet('admin/config/content/formats/manage/' . $restricted);
$this->assertFieldByName('filters[filter_html][settings][allowed_html]', "<a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <quote>", 'Allowed HTML tag added.');
@ -232,7 +232,7 @@ class FilterAdminTest extends BrowserTestBase {
$edit['filters[' . $second_filter . '][weight]'] = 1;
$edit['filters[' . $first_filter . '][weight]'] = 2;
$this->drupalPostForm(NULL, $edit, t('Save configuration'));
$this->assertUrl('admin/config/content/formats/manage/' . $restricted);
$this->assertSession()->addressEquals('admin/config/content/formats/manage/' . $restricted);
$this->drupalGet('admin/config/content/formats/manage/' . $restricted);
$this->assertFieldByName('filters[' . $second_filter . '][weight]', 1, 'Order saved successfully.');
$this->assertFieldByName('filters[' . $first_filter . '][weight]', 2, 'Order saved successfully.');
@ -260,7 +260,7 @@ class FilterAdminTest extends BrowserTestBase {
$edit['filters[' . $second_filter . '][status]'] = TRUE;
$edit['filters[' . $first_filter . '][status]'] = TRUE;
$this->drupalPostForm('admin/config/content/formats/add', $edit, t('Save configuration'));
$this->assertUrl('admin/config/content/formats');
$this->assertSession()->addressEquals('admin/config/content/formats');
$this->assertRaw(t('Added text format %format.', ['%format' => $edit['name']]), 'New filter created.');
filter_formats_reset();
@ -273,7 +273,7 @@ class FilterAdminTest extends BrowserTestBase {
// Disable new filter.
$this->drupalPostForm('admin/config/content/formats/manage/' . $format->id() . '/disable', [], t('Disable'));
$this->assertUrl('admin/config/content/formats');
$this->assertSession()->addressEquals('admin/config/content/formats');
$this->assertRaw(t('Disabled text format %format.', ['%format' => $edit['name']]), 'Format successfully disabled.');
// Allow authenticated users on full HTML.
@ -282,7 +282,7 @@ class FilterAdminTest extends BrowserTestBase {
$edit['roles[' . RoleInterface::ANONYMOUS_ID . ']'] = 0;
$edit['roles[' . RoleInterface::AUTHENTICATED_ID . ']'] = 1;
$this->drupalPostForm('admin/config/content/formats/manage/' . $full, $edit, t('Save configuration'));
$this->assertUrl('admin/config/content/formats/manage/' . $full);
$this->assertSession()->addressEquals('admin/config/content/formats/manage/' . $full);
$this->assertRaw(t('The text format %format has been updated.', ['%format' => $format->label()]), 'Full HTML format successfully updated.');
// Switch user.
@ -336,7 +336,7 @@ class FilterAdminTest extends BrowserTestBase {
$edit = [];
$edit['filters[filter_html][settings][allowed_html]'] = '<a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>';
$this->drupalPostForm('admin/config/content/formats/manage/' . $basic, $edit, t('Save configuration'));
$this->assertUrl('admin/config/content/formats/manage/' . $basic);
$this->assertSession()->addressEquals('admin/config/content/formats/manage/' . $basic);
$this->drupalGet('admin/config/content/formats/manage/' . $basic);
$this->assertFieldByName('filters[filter_html][settings][allowed_html]', $edit['filters[filter_html][settings][allowed_html]'], 'Changes reverted.');
@ -344,7 +344,7 @@ class FilterAdminTest extends BrowserTestBase {
$edit = [];
$edit['roles[' . RoleInterface::AUTHENTICATED_ID . ']'] = FALSE;
$this->drupalPostForm('admin/config/content/formats/manage/' . $full, $edit, t('Save configuration'));
$this->assertUrl('admin/config/content/formats/manage/' . $full);
$this->assertSession()->addressEquals('admin/config/content/formats/manage/' . $full);
$this->assertRaw(t('The text format %format has been updated.', ['%format' => $format->label()]), 'Full HTML format successfully reverted.');
$this->drupalGet('admin/config/content/formats/manage/' . $full);
$this->assertFieldByName('roles[' . RoleInterface::AUTHENTICATED_ID . ']', $edit['roles[' . RoleInterface::AUTHENTICATED_ID . ']'], 'Changes reverted.');
@ -354,7 +354,7 @@ class FilterAdminTest extends BrowserTestBase {
$edit['filters[' . $second_filter . '][weight]'] = 2;
$edit['filters[' . $first_filter . '][weight]'] = 1;
$this->drupalPostForm('admin/config/content/formats/manage/' . $basic, $edit, t('Save configuration'));
$this->assertUrl('admin/config/content/formats/manage/' . $basic);
$this->assertSession()->addressEquals('admin/config/content/formats/manage/' . $basic);
$this->drupalGet('admin/config/content/formats/manage/' . $basic);
$this->assertFieldByName('filters[' . $second_filter . '][weight]', $edit['filters[' . $second_filter . '][weight]'], 'Changes reverted.');
$this->assertFieldByName('filters[' . $first_filter . '][weight]', $edit['filters[' . $first_filter . '][weight]'], 'Changes reverted.');

View File

@ -291,7 +291,7 @@ class FilterFormatAccessTest extends BrowserTestBase {
// Now select a new text format and make sure the node can be saved.
$edit[$body_format_key] = filter_fallback_format();
$this->drupalPostForm('node/' . $node->id() . '/edit', $edit, t('Save'));
$this->assertUrl('node/' . $node->id());
$this->assertSession()->addressEquals('node/' . $node->id());
$this->assertText($new_title, 'New title found.');
$this->assertNoText($old_title, 'Old title not found.');
@ -300,7 +300,7 @@ class FilterFormatAccessTest extends BrowserTestBase {
$this->drupalLogin($this->adminUser);
$edit = [$body_format_key => $this->allowedFormat->id()];
$this->drupalPostForm('node/' . $node->id() . '/edit', $edit, t('Save'));
$this->assertUrl('node/' . $node->id());
$this->assertSession()->addressEquals('node/' . $node->id());
foreach (filter_formats() as $format) {
if (!$format->isFallbackFormat()) {
$format->disable()->save();
@ -324,7 +324,7 @@ class FilterFormatAccessTest extends BrowserTestBase {
$this->assertNoText($new_title, 'New title not found.');
$edit[$body_format_key] = filter_fallback_format();
$this->drupalPostForm('node/' . $node->id() . '/edit', $edit, t('Save'));
$this->assertUrl('node/' . $node->id());
$this->assertSession()->addressEquals('node/' . $node->id());
$this->assertText($new_title, 'New title found.');
$this->assertNoText($old_title, 'Old title not found.');
}

View File

@ -54,7 +54,7 @@ class ForumIndexTest extends BrowserTestBase {
// Create the forum topic, preselecting the forum ID via a URL parameter.
$this->drupalGet("forum/$tid");
$this->clickLink(t('Add new @node_type', ['@node_type' => 'Forum topic']));
$this->assertUrl("node/add/forum?forum_id=$tid");
$this->assertSession()->addressEquals("node/add/forum?forum_id=$tid");
$this->drupalPostForm(NULL, $edit, t('Save'));
// Check that the node exists in the database.

View File

@ -59,7 +59,7 @@ class LanguageBrowserDetectionTest extends BrowserTestBase {
$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'));
$this->assertSession()->addressEquals(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 @@ class LanguageBrowserDetectionTest extends BrowserTestBase {
'new_mapping[drupal_langcode]' => 'en',
];
$this->drupalPostForm('admin/config/regional/language/detection/browser', $edit, t('Save configuration'));
$this->assertUrl(Url::fromRoute('language.negotiation_browser'));
$this->assertSession()->addressEquals(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 @@ class LanguageBrowserDetectionTest extends BrowserTestBase {
'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'));
$this->assertSession()->addressEquals(Url::fromRoute('language.negotiation_browser'));
$this->assertFieldById('edit-mappings-xx-browser-langcode', 'xx');
$this->assertFieldById('edit-mappings-xx-drupal-langcode', 'zh-hans');
}

View File

@ -56,7 +56,7 @@ class LanguageConfigurationTest extends BrowserTestBase {
];
$this->drupalPostForm(NULL, $edit, 'Add language');
$this->assertText('French');
$this->assertUrl(Url::fromRoute('entity.configurable_language.collection'));
$this->assertSession()->addressEquals(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 @@ class LanguageConfigurationTest extends BrowserTestBase {
$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', [], ['langcode' => 'fr']));
$this->assertSession()->addressEquals(Url::fromRoute('entity.configurable_language.collection', [], ['langcode' => 'fr']));
// Check if a valid language prefix is added after changing the default
// language.

View File

@ -48,7 +48,7 @@ class LanguageCustomLanguageConfigurationTest extends BrowserTestBase {
$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'));
$this->assertSession()->addressEquals(Url::fromRoute('language.add'));
// Test validation of invalid values.
$edit = [
@ -65,7 +65,7 @@ class LanguageCustomLanguageConfigurationTest extends BrowserTestBase {
]));
$this->assertRaw(t('%field cannot contain any markup.', ['%field' => t('Language name')]));
$this->assertUrl(Url::fromRoute('language.add'));
$this->assertSession()->addressEquals(Url::fromRoute('language.add'));
// Test adding a custom language with a numeric region code.
$edit = [
@ -80,7 +80,7 @@ class LanguageCustomLanguageConfigurationTest extends BrowserTestBase {
'The language %language has been created and can now be used.',
['%language' => $edit['label']]
));
$this->assertUrl(Url::fromRoute('entity.configurable_language.collection'));
$this->assertSession()->addressEquals(Url::fromRoute('entity.configurable_language.collection'));
// Test validation of existing language values.
$edit = [
@ -96,7 +96,7 @@ class LanguageCustomLanguageConfigurationTest extends BrowserTestBase {
'The language %language has been created and can now be used.',
['%language' => $edit['label']]
));
$this->assertUrl(Url::fromRoute('entity.configurable_language.collection'));
$this->assertSession()->addressEquals(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 @@ class LanguageCustomLanguageConfigurationTest extends BrowserTestBase {
'The language %language (%langcode) already exists.',
['%language' => $edit['label'], '%langcode' => $edit['langcode']]
));
$this->assertUrl(Url::fromRoute('language.add'));
$this->assertSession()->addressEquals(Url::fromRoute('language.add'));
}
}

View File

@ -49,7 +49,7 @@ class LanguageListTest extends BrowserTestBase {
];
$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'));
$this->assertSession()->addressEquals(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 @@ class LanguageListTest extends BrowserTestBase {
'direction' => Language::DIRECTION_LTR,
];
$this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add custom language'));
$this->assertUrl(Url::fromRoute('entity.configurable_language.collection'));
$this->assertSession()->addressEquals(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 @@ class LanguageListTest extends BrowserTestBase {
$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', [], ['language' => $language]));
$this->assertSession()->addressEquals(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 @@ class LanguageListTest extends BrowserTestBase {
];
$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', [], ['language' => $language]));
$this->assertSession()->addressEquals(Url::fromRoute('entity.configurable_language.collection', [], ['language' => $language]));
// Change back the default language.
$edit = [
@ -120,7 +120,7 @@ class LanguageListTest extends BrowserTestBase {
$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', [], ['language' => $english]));
$this->assertSession()->addressEquals(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 @@ class LanguageListTest extends BrowserTestBase {
// 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', [], ['language' => $english]));
$this->assertSession()->addressEquals(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 @@ class LanguageListTest extends BrowserTestBase {
// 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'));
$this->assertSession()->addressEquals(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 @@ class LanguageListTest extends BrowserTestBase {
'direction' => Language::DIRECTION_LTR,
];
$this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add custom language'));
$this->assertUrl(Url::fromRoute('entity.configurable_language.collection'));
$this->assertSession()->addressEquals(Url::fromRoute('entity.configurable_language.collection'));
$this->assertText($name, 'Name found.');
// Check if we can change the default language.
@ -172,7 +172,7 @@ class LanguageListTest extends BrowserTestBase {
$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', [], ['language' => $language]));
$this->assertSession()->addressEquals(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.

View File

@ -50,7 +50,7 @@ class LanguageLocaleListTest extends BrowserTestBase {
];
$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'));
$this->assertSession()->addressEquals(Url::fromRoute('entity.configurable_language.collection'));
$this->rebuildContainer();
// Translate Spanish language to French (Espagnol).

View File

@ -450,15 +450,15 @@ class LanguageSwitchingTest extends BrowserTestBase {
// Click on the French link.
$this->clickLink(t('French'));
// There should be a query parameter to set the session language.
$this->assertUrl('user/2?language=fr');
$this->assertSession()->addressEquals('user/2?language=fr');
// Click on the 'Home' Link.
$this->clickLink(t('Home'));
// There should be no query parameter.
$this->assertUrl('user/2');
$this->assertSession()->addressEquals('user/2');
// Click on the French link.
$this->clickLink(t('French'));
// There should be no query parameter.
$this->assertUrl('user/2');
$this->assertSession()->addressEquals('user/2');
}
/**

View File

@ -96,7 +96,7 @@ class LocaleImportFunctionalTest extends BrowserTestBase {
$this->assertEqual(2, $locale_plurals, 'Plural number initialized.');
// Ensure we were redirected correctly.
$this->assertUrl(Url::fromRoute('locale.translate_page'));
$this->assertSession()->addressEquals(Url::fromRoute('locale.translate_page'));
// Try importing a .po file with invalid tags.
$this->importPoFile($this->getBadPoFile(), [
@ -146,7 +146,7 @@ class LocaleImportFunctionalTest extends BrowserTestBase {
'langcode' => 'fr',
'files[file]' => $name,
], t('Import'));
$this->assertUrl(Url::fromRoute('locale.translate_import'));
$this->assertSession()->addressEquals(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

View File

@ -289,18 +289,18 @@ class MenuUiTest extends BrowserTestBase {
$this->clickLink(t('Add link'));
$link_title = $this->randomString();
$this->drupalPostForm(NULL, ['link[0][uri]' => '/', 'title[0][value]' => $link_title], t('Save'));
$this->assertUrl(Url::fromRoute('entity.menu.edit_form', ['menu' => $menu_name]));
$this->assertSession()->addressEquals(Url::fromRoute('entity.menu.edit_form', ['menu' => $menu_name]));
// Test the 'Edit' operation.
$this->clickLink(t('Edit'));
$this->assertFieldByName('title[0][value]', $link_title);
$link_title = $this->randomString();
$this->drupalPostForm(NULL, ['title[0][value]' => $link_title], t('Save'));
$this->assertUrl(Url::fromRoute('entity.menu.edit_form', ['menu' => $menu_name]));
$this->assertSession()->addressEquals(Url::fromRoute('entity.menu.edit_form', ['menu' => $menu_name]));
// Test the 'Delete' operation.
$this->clickLink(t('Delete'));
$this->assertRaw(t('Are you sure you want to delete the custom menu link %item?', ['%item' => $link_title]));
$this->drupalPostForm(NULL, [], t('Delete'));
$this->assertUrl(Url::fromRoute('entity.menu.edit_form', ['menu' => $menu_name]));
$this->assertSession()->addressEquals(Url::fromRoute('entity.menu.edit_form', ['menu' => $menu_name]));
// Add nodes to use as links for menu links.
$node1 = $this->drupalCreateNode(['type' => 'article']);

View File

@ -52,7 +52,7 @@ class NodeCreationTest extends NodeTestBase {
$node_type_storage->load('article')->delete();
$this->drupalGet('node/add');
$this->assertSession()->statusCodeEquals(200);
$this->assertUrl('node/add/page');
$this->assertSession()->addressEquals('node/add/page');
// Create a node.
$edit = [];
$edit['title[0][value]'] = $this->randomMachineName(8);
@ -146,7 +146,7 @@ class NodeCreationTest extends NodeTestBase {
$this->drupalPostForm('node/add/page', $edit, t('Save'));
// Check that the user was redirected to the home page.
$this->assertUrl('');
$this->assertSession()->addressEquals('');
$this->assertText(t('Test page text'));
// Confirm that the node was created.

View File

@ -81,7 +81,7 @@ class NodeEditFormTest extends NodeTestBase {
// Check that "edit" link points to correct page.
$this->clickLink(t('Edit'));
$this->assertUrl($node->toUrl('edit-form'));
$this->assertSession()->addressEquals($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.

View File

@ -73,7 +73,7 @@ class NodeRevisionsUiBypassAccessTest extends NodeTestBase {
$edit = ['revision' => FALSE];
$this->drupalPostForm('node/' . $node->id() . '/edit', $edit, 'Save');
$this->assertUrl($node->toUrl());
$this->assertSession()->addressEquals($node->toUrl());
// Verify revisions exist since the content type has revisions enabled.
$this->assertSession()->linkExists('Revisions');
@ -85,7 +85,7 @@ class NodeRevisionsUiBypassAccessTest extends NodeTestBase {
$edit = [];
$this->drupalPostForm('node/' . $node->id() . '/edit', $edit, 'Save');
$this->assertUrl($node->toUrl());
$this->assertSession()->addressEquals($node->toUrl());
$this->assertSession()->linkExists('Revisions');
// Unset page revision setting 'create new revision'. This will mean new
@ -104,7 +104,7 @@ class NodeRevisionsUiBypassAccessTest extends NodeTestBase {
$edit = [];
$this->drupalPostForm('node/' . $node->id() . '/edit', $edit, 'Save');
$this->assertUrl($node->toUrl());
$this->assertSession()->addressEquals($node->toUrl());
// Verify that no link to revisions is displayed since the type
// has the 'create new revision' setting unset.
$this->assertSession()->linkNotExists('Revisions');
@ -117,7 +117,7 @@ class NodeRevisionsUiBypassAccessTest extends NodeTestBase {
$edit = ['revision' => TRUE];
$this->drupalPostForm('node/' . $node->id() . '/edit', $edit, 'Save');
$this->assertUrl($node->toUrl());
$this->assertSession()->addressEquals($node->toUrl());
// Verify that the link is displayed since a new revision is created and
// the 'create new revision' checkbox on the node is checked.
$this->assertSession()->linkExists('Revisions');

View File

@ -330,20 +330,20 @@ class PagePreviewTest extends NodeTestBase {
$this->drupalPostForm($node->toUrl('edit-form'), [], t('Preview'), ['query' => ['destination' => $destination]]);
$parameters = ['node_preview' => $node->uuid(), 'view_mode_id' => 'full'];
$options = ['absolute' => TRUE, 'query' => ['destination' => $destination]];
$this->assertUrl(Url::fromRoute('entity.node.preview', $parameters, $options));
$this->assertSession()->addressEquals(Url::fromRoute('entity.node.preview', $parameters, $options));
$this->drupalPostForm(NULL, ['view_mode' => 'teaser'], t('Switch'));
$this->clickLink(t('Back to content editing'));
$this->drupalPostForm(NULL, [], t('Save'));
$this->assertUrl($destination);
$this->assertSession()->addressEquals($destination);
// 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));
$this->assertSession()->addressEquals(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'));
$this->assertUrl($node->toUrl());
$this->assertSession()->addressEquals($node->toUrl());
$this->assertSession()->statusCodeEquals(200);
/** @var \Drupal\Core\File\FileSystemInterface $file_system */
@ -495,7 +495,7 @@ class PagePreviewTest extends NodeTestBase {
$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']));
$this->assertSession()->addressEquals(Url::fromRoute('entity.node.preview', ['node_preview' => $node->uuid(), 'view_mode_id' => 'full']));
$this->assertText($edit2[$title_key]);
}

View File

@ -229,7 +229,7 @@ class PathAliasTest extends PathTestBase {
$edit['alias[0][value]'] = $node5_alias . '/';
$this->drupalPostForm('admin/config/search/path/add', $edit, t('Save'));
$this->assertUrl('admin/config/search/path/add');
$this->assertSession()->addressEquals('admin/config/search/path/add');
$this->assertText('The source path has to start with a slash.');
$this->assertText('The alias path has to start with a slash.');
}

View File

@ -114,7 +114,7 @@ class SearchLanguageTest extends BrowserTestBase {
// 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' => '']]));
$this->assertSession()->addressEquals(Url::fromRoute('search.view_node_search', [], ['query' => ['keys' => '']]));
// Pick French and ensure it is selected.
$edit = ['language[fr]' => TRUE];

View File

@ -44,7 +44,7 @@ class ProcessingTest extends BrowserTestBase {
$this->assertBatchMessages($this->_resultMessages('batch_1'), 'Batch for step 2 performed successfully.');
$this->assertEqual(batch_test_stack(), $this->_resultStack('batch_1'), 'Execution order was correct.');
$this->assertText('Test page text.', 'Custom redirection after batch execution displays the correct page.');
$this->assertUrl(Url::fromRoute('test_page_test.test_page'));
$this->assertSession()->addressEquals(Url::fromRoute('test_page_test.test_page'));
}
/**

View File

@ -57,7 +57,7 @@ class EntityAddUITest extends BrowserTestBase {
'description' => 'My test description',
])->save();
$this->drupalGet('/entity_test_with_bundle/add');
$this->assertUrl('/entity_test_with_bundle/add/test');
$this->assertSession()->addressEquals('/entity_test_with_bundle/add/test');
// Two bundles exist, confirm both are shown.
EntityTestBundle::create([
@ -135,7 +135,7 @@ class EntityAddUITest extends BrowserTestBase {
// One bundle exists, confirm redirection to the add-form.
$this->drupalGet('/entity_test_mul/add');
$this->assertUrl('/entity_test_mul/add/test');
$this->assertSession()->addressEquals('/entity_test_mul/add/test');
// Two bundles exist, confirm both are shown.
entity_test_create_bundle('test2', 'Test2 label', 'entity_test_mul');

View File

@ -35,22 +35,22 @@ class ConfirmFormTest extends BrowserTestBase {
// Test cancelling the form.
$this->clickLink(t('ConfirmFormTestForm::getCancelText().'));
$this->assertUrl('form-test/autocomplete');
$this->assertSession()->addressEquals('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('');
$this->assertSession()->addressEquals('');
// 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');
$this->assertSession()->addressEquals('admin/config');
// Test cancelling the form with a complex destination.
$this->drupalGet('form-test/confirm-form-array-path');
$this->clickLink(t('ConfirmFormArrayPathTestForm::getCancelText().'));
// Verify that the form's complex cancel link was followed.
$this->assertUrl('form-test/confirm-form?destination=admin/config');
$this->assertSession()->addressEquals('form-test/confirm-form?destination=admin/config');
}
/**

View File

@ -38,14 +38,14 @@ class RedirectTest extends BrowserTestBase {
'destination' => $this->randomMachineName(),
];
$this->drupalPostForm($path, $edit, t('Submit'));
$this->assertUrl($edit['destination']);
$this->assertSession()->addressEquals($edit['destination']);
// Test without redirection.
$edit = [
'redirection' => FALSE,
];
$this->drupalPostForm($path, $edit, t('Submit'));
$this->assertUrl($path);
$this->assertSession()->addressEquals($path);
// Test redirection with query parameters.
$edit = [
@ -53,7 +53,7 @@ class RedirectTest extends BrowserTestBase {
'destination' => $this->randomMachineName(),
];
$this->drupalPostForm($path, $edit, t('Submit'), $options);
$this->assertUrl($edit['destination']);
$this->assertSession()->addressEquals($edit['destination']);
// Test without redirection but with query parameters.
$edit = [
@ -62,7 +62,7 @@ class RedirectTest extends BrowserTestBase {
$this->drupalPostForm($path, $edit, t('Submit'), $options);
// When redirect is set to FALSE, there should be no redirection, and the
// query parameters should be passed along.
$this->assertUrl($path . '?foo=bar');
$this->assertSession()->addressEquals($path . '?foo=bar');
// Test redirection back to the original path.
$edit = [
@ -70,7 +70,7 @@ class RedirectTest extends BrowserTestBase {
'destination' => '',
];
$this->drupalPostForm($path, $edit, t('Submit'));
$this->assertUrl($path);
$this->assertSession()->addressEquals($path);
// Test redirection back to the original path with query parameters.
$edit = [
@ -80,7 +80,7 @@ class RedirectTest extends BrowserTestBase {
$this->drupalPostForm($path, $edit, t('Submit'), $options);
// When using an empty redirection string, there should be no redirection,
// and the query parameters should be passed along.
$this->assertUrl($path . '?foo=bar');
$this->assertSession()->addressEquals($path . '?foo=bar');
}
/**
@ -101,7 +101,7 @@ class RedirectTest extends BrowserTestBase {
$this->assertSession()->statusCodeEquals(404);
$this->drupalPostForm(NULL, [], t('Submit'));
$this->assertSession()->statusCodeEquals(200);
$this->assertUrl($expected);
$this->assertSession()->addressEquals($expected);
// Visit the block admin page (403 page) and submit the form. Verify it
// ends up at the right URL.
@ -109,7 +109,7 @@ class RedirectTest extends BrowserTestBase {
$this->assertSession()->statusCodeEquals(403);
$this->drupalPostForm(NULL, [], t('Submit'));
$this->assertSession()->statusCodeEquals(200);
$this->assertUrl($expected);
$this->assertSession()->addressEquals($expected);
}
}

View File

@ -230,11 +230,11 @@ class MenuRouterTest extends BrowserTestBase {
$this->drupalGet('user/login');
// Check that we got to 'user'.
$this->assertUrl($this->loggedInUser->toUrl('canonical'));
$this->assertSession()->addressEquals($this->loggedInUser->toUrl('canonical'));
// user/register should redirect to user/UID/edit.
$this->drupalGet('user/register');
$this->assertUrl($this->loggedInUser->toUrl('edit-form'));
$this->assertSession()->addressEquals($this->loggedInUser->toUrl('edit-form'));
}
/**

View File

@ -136,7 +136,7 @@ class ExperimentalModuleTest extends BrowserTestBase {
$this->drupalPostForm('admin/modules', $edit, 'Install');
// Verify that if the module can not be installed, we are not taken to the
// confirm form.
$this->assertUrl('admin/modules');
$this->assertSession()->addressEquals('admin/modules');
$this->assertText('The Experimental Test Requirements module can not be installed.');
}

View File

@ -89,7 +89,7 @@ class PrepareUninstallTest extends BrowserTestBase {
// Check that we are redirected to the uninstall page and data has been
// removed.
$this->assertUrl('admin/modules/uninstall');
$this->assertSession()->addressEquals('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 @@ class PrepareUninstallTest extends BrowserTestBase {
$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->assertSession()->addressEquals('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

View File

@ -135,7 +135,7 @@ class UninstallTest extends BrowserTestBase {
// Make sure confirmation page is accessible only during uninstall process.
$this->drupalGet('admin/modules/uninstall/confirm');
$this->assertUrl('admin/modules/uninstall');
$this->assertSession()->addressEquals('admin/modules/uninstall');
$this->assertSession()->titleEquals('Uninstall | Drupal');
// Make sure the correct error is shown when no modules are selected.

View File

@ -322,19 +322,19 @@ class RouterTest extends BrowserTestBase {
$request = $this->container->get('request_stack')->getCurrentRequest();
$url = $request->getUriForPath('//router_test/test1');
$this->drupalGet($url);
$this->assertUrl($request->getUriForPath('/router_test/test1'));
$this->assertSession()->addressEquals($request->getUriForPath('/router_test/test1'));
// It should not matter how many leading slashes are used and query strings
// should be preserved.
$url = $request->getUriForPath('/////////////////////////////////////////////////router_test/test1') . '?qs=test';
$this->drupalGet($url);
$this->assertUrl($request->getUriForPath('/router_test/test1') . '?qs=test');
$this->assertSession()->addressEquals($request->getUriForPath('/router_test/test1') . '?qs=test');
// Ensure that external URLs in destination query params are not redirected
// to.
$url = $request->getUriForPath('/////////////////////////////////////////////////router_test/test1') . '?qs=test&destination=http://www.example.com%5c@drupal8alt.test';
$this->drupalGet($url);
$this->assertUrl($request->getUriForPath('/router_test/test1') . '?qs=test');
$this->assertSession()->addressEquals($request->getUriForPath('/router_test/test1') . '?qs=test');
}
}

View File

@ -160,7 +160,7 @@ class AdminTest extends BrowserTestBase {
$this->assertSession()->statusCodeEquals(200);
// Verify that the user is redirected to the front page after turning on
// compact mode.
$this->assertUrl($frontpage_url);
$this->assertSession()->addressEquals($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.');
@ -171,7 +171,7 @@ class AdminTest extends BrowserTestBase {
$this->assertSession()->statusCodeEquals(200);
// Verify that the user is redirected to the front page after turning off
// compact mode.
$this->assertUrl($frontpage_url);
$this->assertSession()->addressEquals($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.');

View File

@ -122,7 +122,7 @@ class CronRunTest extends BrowserTestBase {
$this->drupalPostForm(NULL, [], 'Save configuration');
$this->assertText('The configuration options have been saved.');
$this->assertUrl('admin/config/system/cron');
$this->assertSession()->addressEquals('admin/config/system/cron');
// Check that cron does not run when saving the configuration form.
$this->assertEqual($cron_last, \Drupal::state()->get('system.cron_last'), 'Cron does not run when saving the configuration form.');

View File

@ -105,7 +105,7 @@ class DateTimeTest extends BrowserTestBase {
];
$this->drupalPostForm('admin/config/regional/date-time/formats/add', $edit, t('Add format'));
// Verify that the user is redirected to the correct page.
$this->assertUrl(Url::fromRoute('entity.date_format.collection'));
$this->assertSession()->addressEquals(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.');
@ -115,7 +115,7 @@ class DateTimeTest extends BrowserTestBase {
$this->clickLink(t('Edit'));
$this->drupalPostForm(NULL, NULL, t('Save format'));
// Verify that the user is redirected to the correct page.
$this->assertUrl(Url::fromRoute('entity.date_format.collection'));
$this->assertSession()->addressEquals(Url::fromRoute('entity.date_format.collection'));
$this->assertText(t('Custom date format updated.'), 'Custom date format successfully updated.');
// Edit custom date format.
@ -126,14 +126,14 @@ class DateTimeTest extends BrowserTestBase {
];
$this->drupalPostForm($this->getUrl(), $edit, t('Save format'));
// Verify that the user is redirected to the correct page.
$this->assertUrl(Url::fromRoute('entity.date_format.collection'));
$this->assertSession()->addressEquals(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'));
// Verify that the user is redirected to the correct page.
$this->assertUrl(Url::fromRoute('entity.date_format.collection'));
$this->assertSession()->addressEquals(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.
@ -151,7 +151,7 @@ class DateTimeTest extends BrowserTestBase {
];
$this->drupalPostForm('admin/config/regional/date-time/formats/add', $edit, t('Add format'));
// Verify that the user is redirected to the correct page.
$this->assertUrl(Url::fromRoute('entity.date_format.collection'));
$this->assertSession()->addressEquals(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.');
@ -178,7 +178,7 @@ class DateTimeTest extends BrowserTestBase {
];
$this->drupalPostForm('admin/config/regional/date-time/formats/add', $edit, t('Add format'));
// Verify that the user is redirected to the correct page.
$this->assertUrl(Url::fromRoute('entity.date_format.collection'));
$this->assertSession()->addressEquals(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>');

View File

@ -25,7 +25,7 @@ class RebuildScriptTest extends BrowserTestBase {
$cache->set('rebuild_test', TRUE);
$this->drupalGet(Url::fromUri('base:core/rebuild.php'));
$this->assertUrl(new Url('<front>'));
$this->assertSession()->addressEquals(new Url('<front>'));
$this->assertInstanceOf(\stdClass::class, $cache->get('rebuild_test'));
$settings['settings']['rebuild_access'] = (object) [
@ -38,7 +38,7 @@ class RebuildScriptTest extends BrowserTestBase {
$cache->set('rebuild_test', TRUE);
$this->drupalGet(Url::fromUri('base:core/rebuild.php'));
$this->assertUrl(new Url('<front>'));
$this->assertSession()->addressEquals(new Url('<front>'));
$this->assertFalse($cache->get('rebuild_test'));
}

View File

@ -454,7 +454,7 @@ class TermTest extends TaxonomyTestBase {
// Submit confirmation form.
$this->drupalPostForm(NULL, [], t('Reset to alphabetical'));
// Ensure form redirected back to overview.
$this->assertUrl('admin/structure/taxonomy/manage/' . $this->vocabulary->id() . '/overview');
$this->assertSession()->addressEquals('admin/structure/taxonomy/manage/' . $this->vocabulary->id() . '/overview');
$taxonomy_storage->resetCache();
$terms = $taxonomy_storage->loadTree($this->vocabulary->id(), 0, NULL, TRUE);

View File

@ -323,7 +323,7 @@ class ToolbarAdminMenuTest extends BrowserTestBase {
$this->drupalPostForm('admin/config/regional/translate', $edit, t('Save translations'));
$this->assertText(t('The strings have been saved.'), 'The strings have been saved.');
// Verify that the user is redirected to the correct page.
$this->assertUrl(Url::fromRoute('locale.translate_page'));
$this->assertSession()->addressEquals(Url::fromRoute('locale.translate_page'));
$this->drupalLogout();
// Log in the adminUser. Check the admin menu subtrees hash now that one

View File

@ -828,15 +828,15 @@ class UpdateCoreTest extends UpdateTestBase {
$this->drupalGet('admin/modules');
$this->clickLink(t('Install new module'));
$this->assertUrl('admin/modules/install');
$this->assertSession()->addressEquals('admin/modules/install');
$this->drupalGet('admin/appearance');
$this->clickLink(t('Install new theme'));
$this->assertUrl('admin/theme/install');
$this->assertSession()->addressEquals('admin/theme/install');
$this->drupalGet('admin/reports/updates');
$this->clickLink(t('Install new module or theme'));
$this->assertUrl('admin/reports/updates/install');
$this->assertSession()->addressEquals('admin/reports/updates/install');
}
/**

View File

@ -60,7 +60,7 @@ class UpdateUploadTest extends UpdateTestBase {
$this->drupalPostForm('admin/modules/install', $edit, t('Install'));
$extensions = \Drupal::service('plugin.manager.archiver')->getExtensions();
$this->assertSession()->pageTextContains(t('Only files with the following extensions are allowed: @archive_extensions.', ['@archive_extensions' => $extensions]));
$this->assertUrl('admin/modules/install');
$this->assertSession()->addressEquals('admin/modules/install');
// Check to ensure an existing module can't be reinstalled. Also checks that
// the archive was extracted since we can't know if the module is already
@ -71,7 +71,7 @@ class UpdateUploadTest extends UpdateTestBase {
];
$this->drupalPostForm('admin/modules/install', $edit, t('Install'));
$this->assertText(t('@module_name is already installed.', ['@module_name' => 'AAA Update test']), 'Existing module was extracted and not reinstalled.');
$this->assertUrl('admin/modules/install');
$this->assertSession()->addressEquals('admin/modules/install');
// Ensure that a new module can be extracted and installed.
$updaters = drupal_get_updaters();
@ -84,7 +84,7 @@ class UpdateUploadTest extends UpdateTestBase {
];
$this->drupalPostForm('admin/modules/install', $edit, t('Install'));
// Check that submitting the form takes the user to authorize.php.
$this->assertUrl('core/authorize.php');
$this->assertSession()->addressEquals('core/authorize.php');
$this->assertSession()->titleEquals('Update manager | Drupal');
// Check for a success message on the page, and check that the installed
// module now exists in the expected place in the filesystem.
@ -101,7 +101,7 @@ class UpdateUploadTest extends UpdateTestBase {
// Ensure we can reach the "Install another module" link.
$this->clickLink(t('Install another module'));
$this->assertSession()->statusCodeEquals(200);
$this->assertUrl('admin/modules/install');
$this->assertSession()->addressEquals('admin/modules/install');
// Check that the module has the correct version before trying to update
// it. Since the module is installed in sites/simpletest, which only the

View File

@ -80,7 +80,7 @@ class UserBlocksTest extends BrowserTestBase {
$this->assertNoText('User login', 'Logged in.');
// Check that we are still on the same page.
$this->assertUrl(Url::fromRoute('user.admin_permissions'));
$this->assertSession()->addressEquals(Url::fromRoute('user.admin_permissions'));
// Now, log out and repeat with a non-403 page.
$this->drupalLogout();
@ -116,7 +116,7 @@ class UserBlocksTest extends BrowserTestBase {
$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'));
$this->assertSession()->addressEquals($user->toUrl('canonical'));
// Verify that form validation errors are displayed immediately for forms
// in blocks and not on subsequent page requests.

View File

@ -36,8 +36,7 @@ class UserLoginTest extends BrowserTestBase {
$this->drupalGet('user/login', ['query' => ['destination' => 'foo']]);
$edit = ['name' => $user->getAccountName(), 'pass' => $user->passRaw];
$this->drupalPostForm(NULL, $edit, t('Log in'));
// Verify that the user is redirected to the correct URL.
$this->assertUrl('foo');
$this->assertSession()->addressEquals('foo');
}
/**

View File

@ -94,7 +94,7 @@ class UserPasswordResetTest extends BrowserTestBase {
$resetURL = $this->getResetURL();
$this->drupalGet($resetURL);
// Ensure that the current url does not contain the hash and timestamp.
$this->assertUrl(Url::fromRoute('user.reset.form', ['uid' => $this->account->id()]));
$this->assertSession()->addressEquals(Url::fromRoute('user.reset.form', ['uid' => $this->account->id()]));
$this->assertSession()->responseHeaderDoesNotExist('X-Drupal-Cache');
@ -454,7 +454,7 @@ class UserPasswordResetTest extends BrowserTestBase {
$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');
$this->assertSession()->addressEquals('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.');
}

View File

@ -161,7 +161,7 @@ class BulkFormTest extends BrowserTestBase {
$this->drupalPostForm(NULL, [], t('Delete'));
$this->assertText(t('Deleted 5 content items.'));
// Check if we got redirected to the original page.
$this->assertUrl('test_bulk_form');
$this->assertSession()->addressEquals('test_bulk_form');
// Test that the bulk form works when a node gets deleted by another user
// before the loaded bulk form can be used.
@ -176,7 +176,7 @@ class BulkFormTest extends BrowserTestBase {
];
$this->drupalPostForm(NULL, $edit, t('Apply to selected items'));
// Make sure we just return to the bulk view with no warnings.
$this->assertUrl('test_bulk_form');
$this->assertSession()->addressEquals('test_bulk_form');
$errors = $this->xpath('//div[contains(@class, "messages--status")]');
$this->assertEmpty($errors, 'No action message shown.');

View File

@ -75,7 +75,7 @@ class BasicTest extends WizardTestBase {
// Since the view has a page, we expect to be automatically redirected to
// it.
$this->assertUrl($view2['page[path]']);
$this->assertSession()->addressEquals($view2['page[path]']);
$this->assertText($view2['page[title]']);
$this->assertText($node1->label());
$this->assertText($node2->label());
@ -125,7 +125,7 @@ class BasicTest extends WizardTestBase {
$this->assertSession()->statusCodeEquals(200);
// Make sure the view only displays the node we expect.
$this->assertUrl($view3['page[path]']);
$this->assertSession()->addressEquals($view3['page[path]']);
$this->assertText($view3['page[title]']);
$this->assertText($node1->label());
$this->assertNoText($node2->label());

View File

@ -60,7 +60,7 @@ class ItemsPerPageTest extends WizardTestBase {
// Make sure the page display shows the nodes we expect, and that they
// appear in the expected order.
$this->assertUrl($view['page[path]']);
$this->assertSession()->addressEquals($view['page[path]']);
$this->assertText($view['page[title]']);
$content = $this->getSession()->getPage()->getContent();
$this->assertText($node5->label());

View File

@ -45,7 +45,7 @@ class SortingTest extends WizardTestBase {
$this->assertSession()->statusCodeEquals(200);
// Make sure the view shows the nodes in the expected order.
$this->assertUrl($view1['page[path]']);
$this->assertSession()->addressEquals($view1['page[path]']);
$this->assertText($view1['page[title]']);
$content = $this->getSession()->getPage()->getContent();
$this->assertText($node1->label());
@ -70,7 +70,7 @@ class SortingTest extends WizardTestBase {
$this->assertSession()->statusCodeEquals(200);
// Make sure the view shows the nodes in the expected order.
$this->assertUrl($view2['page[path]']);
$this->assertSession()->addressEquals($view2['page[path]']);
$this->assertText($view2['page[title]']);
$content = $this->getSession()->getPage()->getContent();
$this->assertText($node3->label());

View File

@ -47,7 +47,7 @@ class CachedDataUITest extends UITestBase {
$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');
$this->assertSession()->addressEquals('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'));

View File

@ -48,7 +48,7 @@ class DefaultViewsTest extends UITestBase {
// page.
$this->drupalGet('admin/structure/views');
$this->clickViewsOperationLink('Enable', '/glossary/');
$this->assertUrl('admin/structure/views');
$this->assertSession()->addressEquals('admin/structure/views');
$this->assertLinkByHref($edit_href);
// It should not be possible to revert the view yet.
@ -95,14 +95,14 @@ class DefaultViewsTest extends UITestBase {
];
$this->assertSession()->titleEquals('Duplicate of Glossary | Drupal');
$this->drupalPostForm(NULL, $edit, t('Duplicate'));
$this->assertUrl('admin/structure/views/view/duplicate_of_glossary');
$this->assertSession()->addressEquals('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");
$this->assertSession()->addressEquals("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
@ -110,13 +110,13 @@ class DefaultViewsTest extends UITestBase {
// @todo Test this behavior with templates instead.
$this->drupalGet('admin/structure/views');
$this->clickViewsOperationLink('Disable', '/glossary/');
// $this->assertUrl('admin/structure/views');
// $this->assertSession()->addressEquals('admin/structure/views');
// $this->assertNoLinkByHref($edit_href);
// The easiest way to verify it appears on the disabled views listing page
// is to try to click the "enable" link from there again.
$this->drupalGet('admin/structure/views');
$this->clickViewsOperationLink('Enable', '/glossary/');
$this->assertUrl('admin/structure/views');
$this->assertSession()->addressEquals('admin/structure/views');
$this->assertLinkByHref($edit_href);
// Clear permissions for anonymous users to check access for default views.
@ -136,7 +136,7 @@ class DefaultViewsTest extends UITestBase {
// Submit the confirmation form.
$this->drupalPostForm(NULL, [], t('Delete'));
// Ensure the view is no longer listed.
$this->assertUrl('admin/structure/views');
$this->assertSession()->addressEquals('admin/structure/views');
$this->assertNoLinkByHref($edit_href);
// Ensure the view is no longer available.
$this->drupalGet($edit_href);

View File

@ -119,7 +119,7 @@ class DisplayCRUDTest extends UITestBase {
$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');
$this->assertSession()->addressEquals($path_prefix . '/page_2');
// Set the title and override the css classes.
$random_title = $this->randomMachineName();
@ -130,7 +130,7 @@ class DisplayCRUDTest extends UITestBase {
// 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');
$this->assertSession()->addressEquals($path_prefix . '/block_1');
$this->assertText(t('Block settings'));
$this->assertNoText('Page settings');

View File

@ -70,7 +70,7 @@ class DisplayPathTest extends UITestBase {
$display_link_text = t('View @display', ['@display' => 'Page']);
$this->assertSession()->linkExists($display_link_text, 0, 'view page link found on the page.');
$this->clickLink($display_link_text);
$this->assertUrl($random_path);
$this->assertSession()->addressEquals($random_path);
}
/**
@ -102,11 +102,11 @@ class DisplayPathTest extends UITestBase {
$url = 'admin/structure/views/nojs/display/test_view/page_1/path';
$this->drupalPostForm($url, ['path' => '%/magrathea'], t('Apply'));
$this->assertUrl($url);
$this->assertSession()->addressEquals($url);
$this->assertText('"%" may not be used for the first segment of a path.');
$this->drupalPostForm($url, ['path' => 'user/%1/example'], t('Apply'));
$this->assertUrl($url);
$this->assertSession()->addressEquals($url);
$this->assertText("Numeric placeholders may not be used. Please use plain placeholders (%).");
}
@ -152,11 +152,11 @@ class DisplayPathTest extends UITestBase {
$this->drupalPostForm('admin/structure/views/nojs/display/test_view/page_1/menu', ['menu[type]' => 'default tab', 'menu[title]' => 'Test tab title'], t('Apply'));
$this->assertSession()->statusCodeEquals(200);
$this->assertUrl('admin/structure/views/nojs/display/test_view/page_1/tab_options');
$this->assertSession()->addressEquals('admin/structure/views/nojs/display/test_view/page_1/tab_options');
$this->drupalPostForm(NULL, ['tab_options[type]' => 'tab', 'tab_options[title]' => $this->randomString()], t('Apply'));
$this->assertSession()->statusCodeEquals(200);
$this->assertUrl('admin/structure/views/view/test_view/edit/page_1');
$this->assertSession()->addressEquals('admin/structure/views/view/test_view/edit/page_1');
$this->drupalGet('admin/structure/views/view/test_view');
$this->assertSession()->linkExists('Tab: Test tab title');

View File

@ -177,7 +177,7 @@ class DisplayTest extends UITestBase {
// Test the default link_url value for new display
$this->drupalPostForm(NULL, [], t('Add Block'));
$this->assertUrl('admin/structure/views/view/test_display/edit/block_2');
$this->assertSession()->addressEquals('admin/structure/views/view/test_display/edit/block_2');
$this->clickLink(t('Custom URL'));
$this->assertFieldByName('link_url', 'a-custom-url');
}

View File

@ -39,7 +39,7 @@ class DuplicateTest extends UITestBase {
$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']);
$this->assertSession()->addressEquals('admin/structure/views/view/' . $view['id']);
// Assert that the page title is correctly displayed.
$this->assertText($view['label']);

View File

@ -177,7 +177,7 @@ class ExposedFormUITest extends UITestBase {
$edit["options[group_info][group_items][1][title]"] = 'Is Article';
$edit["options[group_info][group_items][1][value][article]"] = 'article';
$this->drupalPostForm(NULL, $edit, t('Apply'));
$this->assertUrl('admin/structure/views/view/test_exposed_admin_ui/edit/default');
$this->assertSession()->addressEquals('admin/structure/views/view/test_exposed_admin_ui/edit/default');
$this->assertNoGroupedFilterErrors();
// Validate multiple entries for grouped filters.
@ -191,7 +191,7 @@ class ExposedFormUITest extends UITestBase {
$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');
$this->assertSession()->addressEquals('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 @@ class ExposedFormUITest extends UITestBase {
$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');
$this->assertSession()->addressEquals('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 @@ class ExposedFormUITest extends UITestBase {
$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');
$this->assertSession()->addressEquals('admin/structure/views/view/test_exposed_admin_ui/edit/default');
$this->assertNoGroupedFilterErrors();
// Ensure "between" filters validate correctly.
@ -222,7 +222,7 @@ class ExposedFormUITest extends UITestBase {
$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');
$this->assertSession()->addressEquals('admin/structure/views/view/test_exposed_admin_ui/edit/default');
$this->assertNoGroupedFilterErrors();
}

View File

@ -119,12 +119,12 @@ class HandlerTest extends UITestBase {
}
// Verify that the user got redirected to the handler edit form.
$this->assertUrl($edit_handler_url);
$this->assertSession()->addressEquals($edit_handler_url);
$random_label = $this->randomMachineName();
$this->drupalPostForm(NULL, ['options[admin_label]' => $random_label], t('Apply'));
// Verify that the user got redirected to the views edit form.
$this->assertUrl('admin/structure/views/view/test_view_empty/edit/default');
$this->assertSession()->addressEquals('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]);
@ -158,7 +158,7 @@ class HandlerTest extends UITestBase {
$edit_handler_url = "admin/structure/views/nojs/handler/test_view_empty/default/field/$id";
// Verify that the user got redirected to the handler edit form.
$this->assertUrl($edit_handler_url);
$this->assertSession()->addressEquals($edit_handler_url);
$this->assertFieldByName('options[relationship]', 'uid', 'Ensure the relationship select is filled with the UID relationship.');
$this->drupalPostForm(NULL, [], t('Apply'));

View File

@ -33,7 +33,7 @@ class RedirectTest extends UITestBase {
// 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);
$this->assertSession()->addressEquals($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
@ -48,7 +48,7 @@ class RedirectTest extends UITestBase {
$this->drupalPostForm($edit_path, [], t('Save'), ['query' => ['destination' => 'test-redirect-view']]);
// Verify that the user gets redirected to the expected page after changing
// the URL of a page display.
$this->assertUrl($new_path);
$this->assertSession()->addressEquals($new_path);
}
}

View File

@ -73,7 +73,7 @@ class RowUITest extends UITestBase {
$this->drupalGet($row_plugin_url);
$this->assertFieldByName('row[type]', 'entity:node');
$this->drupalPostForm(NULL, ['row[type]' => 'entity:node'], t('Apply'));
$this->assertUrl($row_options_url);
$this->assertSession()->addressEquals($row_options_url);
$this->assertFieldByName('row_options[view_mode]', 'teaser');
// Change the teaser label to have markup so we can test escaping.

View File

@ -34,11 +34,11 @@ class ViewEditTest extends UITestBase {
$view = $this->container->get('entity_type.manager')->getStorage('view')->load('test_view');
$this->assertInstanceOf(View::class, $view);
$this->clickLink(t('Delete view'));
$this->assertUrl('admin/structure/views/view/test_view/delete');
$this->assertSession()->addressEquals('admin/structure/views/view/test_view/delete');
$this->drupalPostForm(NULL, [], t('Delete'));
$this->assertRaw(t('The view %name has been deleted.', ['%name' => $view->label()]));
$this->assertUrl('admin/structure/views');
$this->assertSession()->addressEquals('admin/structure/views');
$view = $this->container->get('entity_type.manager')->getStorage('view')->load('test_view');
$this->assertNotInstanceOf(View::class, $view);
}
@ -117,7 +117,7 @@ class ViewEditTest extends UITestBase {
$this->drupalPostForm(NULL, [], t('Cancel'));
$this->assertNoFieldByXpath('//div[contains(@class, "error")]', FALSE, 'No error message is displayed.');
// Verify page was redirected to the view listing.
$this->assertUrl('admin/structure/views');
$this->assertSession()->addressEquals('admin/structure/views');
}
/**

View File

@ -61,7 +61,7 @@ class WizardTest extends WizardTestBase {
// 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']);
$this->assertSession()->addressEquals('admin/structure/views/view/' . $view['id']);
// Assert that the page title is correctly truncated.
$this->assertText(views_ui_truncate($view['page[title]'], 32));
}

View File

@ -102,7 +102,7 @@ class AjaxFormCacheTest extends WebDriverTestBase {
$url->setOption('query', [
'foo' => 'bar',
]);
$this->assertUrl($url);
$this->assertSession()->addressEquals($url);
}
}

View File

@ -114,7 +114,7 @@ class DistributionProfileExistingSettingsTest extends InstallerTestBase {
* Confirms that the installation succeeded.
*/
public function testInstalled() {
$this->assertUrl('user/1');
$this->assertSession()->addressEquals('user/1');
$this->assertSession()->statusCodeEquals(200);
// Confirm that we are logged-in after installation.
$this->assertText($this->rootUser->getAccountName());

View File

@ -71,7 +71,7 @@ class DistributionProfileTest extends InstallerTestBase {
* Confirms that the installation succeeded.
*/
public function testInstalled() {
$this->assertUrl('myrootuser');
$this->assertSession()->addressEquals('myrootuser');
$this->assertSession()->statusCodeEquals(200);
// Confirm that we are logged-in after installation.
$this->assertText($this->rootUser->getAccountName());

View File

@ -111,7 +111,7 @@ class DistributionProfileTranslationQueryTest extends InstallerTestBase {
* Confirms that the installation succeeded.
*/
public function testInstalled() {
$this->assertUrl('user/1');
$this->assertSession()->addressEquals('user/1');
$this->assertSession()->statusCodeEquals(200);
// Confirm that we are logged-in after installation.

View File

@ -102,7 +102,7 @@ class DistributionProfileTranslationTest extends InstallerTestBase {
* Confirms that the installation succeeded.
*/
public function testInstalled() {
$this->assertUrl('user/1');
$this->assertSession()->addressEquals('user/1');
$this->assertSession()->statusCodeEquals(200);
// Confirm that we are logged-in after installation.

View File

@ -39,7 +39,7 @@ class InstallerConfigDirectorySetNoDirectoryTest extends InstallerTestBase {
* Verifies that installation succeeded.
*/
public function testInstaller() {
$this->assertUrl('user/1');
$this->assertSession()->addressEquals('user/1');
$this->assertSession()->statusCodeEquals(200);
$this->assertDirectoryExists($this->syncDirectory);
}

View File

@ -28,7 +28,7 @@ class InstallerEmptySettingsTest extends InstallerTestBase {
* Verifies that installation succeeded.
*/
public function testInstaller() {
$this->assertUrl('user/1');
$this->assertSession()->addressEquals('user/1');
$this->assertSession()->statusCodeEquals(200);
}

View File

@ -38,7 +38,7 @@ class InstallerExistingConfigDirectoryTest extends InstallerTestBase {
* Verifies that installation succeeded.
*/
public function testInstaller() {
$this->assertUrl('user/1');
$this->assertSession()->addressEquals('user/1');
$this->assertSession()->statusCodeEquals(200);
$this->assertEqual($this->expectedFilePerms, fileperms($this->siteDirectory . '/config_read_only'));
$this->assertEqual([], glob($this->siteDirectory . '/config_read_only/*'), 'The sync directory is empty after install because it is read-only.');

View File

@ -59,7 +59,7 @@ class InstallerExistingDatabaseSettingsTest extends InstallerTestBase {
* Verifies that installation succeeded.
*/
public function testInstaller() {
$this->assertUrl('user/1');
$this->assertSession()->addressEquals('user/1');
$this->assertSession()->statusCodeEquals(200);
}

View File

@ -64,7 +64,7 @@ class InstallerExistingSettingsNoProfileTest extends InstallerTestBase {
* Verifies that installation succeeded.
*/
public function testInstaller() {
$this->assertUrl('user/1');
$this->assertSession()->addressEquals('user/1');
$this->assertSession()->statusCodeEquals(200);
$this->assertEqual('testing', \Drupal::installProfile());
}

View File

@ -77,7 +77,7 @@ class InstallerExistingSettingsTest extends InstallerTestBase {
* Verifies that installation succeeded.
*/
public function testInstaller() {
$this->assertUrl('user/1');
$this->assertSession()->addressEquals('user/1');
$this->assertSession()->statusCodeEquals(200);
$this->assertEqual('testing', \Drupal::installProfile());
}

View File

@ -45,7 +45,7 @@ class InstallerLanguageDirectionTest extends InstallerTestBase {
* Confirms that the installation succeeded.
*/
public function testInstalled() {
$this->assertUrl('user/1');
$this->assertSession()->addressEquals('user/1');
$this->assertSession()->statusCodeEquals(200);
}

View File

@ -42,7 +42,7 @@ class InstallerLanguagePageTest extends InstallerTestBase {
* Confirms that the installation succeeded.
*/
public function testInstalled() {
$this->assertUrl('user/1');
$this->assertSession()->addressEquals('user/1');
$this->assertSession()->statusCodeEquals(200);
}

View File

@ -51,7 +51,7 @@ class InstallerNonDefaultDatabaseDriverTest extends InstallerTestBase {
* Confirms that the installation succeeded.
*/
public function testInstalled() {
$this->assertUrl('user/1');
$this->assertSession()->addressEquals('user/1');
$this->assertSession()->statusCodeEquals(200);
// Assert that in the settings.php the database connection array has the

View File

@ -61,7 +61,7 @@ class InstallerNonEnglishProfileWithoutLocaleModuleTest extends InstallerTestBas
*/
public function testNonEnglishProfileWithoutLocaleModule() {
$this->assertSession()->statusCodeEquals(200);
$this->assertUrl('user/1');
$this->assertSession()->addressEquals('user/1');
// Confirm that we are logged-in after installation.
$this->assertText($this->rootUser->getAccountName());

View File

@ -21,7 +21,7 @@ class InstallerTest extends InstallerTestBase {
* Ensures that the user page is available after installation.
*/
public function testInstaller() {
$this->assertUrl('user/1');
$this->assertSession()->addressEquals('user/1');
$this->assertSession()->statusCodeEquals(200);
// Confirm that we are logged-in after installation.
$this->assertText($this->rootUser->getAccountName());

View File

@ -58,7 +58,7 @@ class InstallerTranslationQueryTest extends InstallerTestBase {
* Verifies the expected behaviors of the installation result.
*/
public function testInstaller() {
$this->assertUrl('user/1');
$this->assertSession()->addressEquals('user/1');
$this->assertSession()->statusCodeEquals(200);
// Verify German was configured but not English.

View File

@ -81,7 +81,7 @@ class InstallerTranslationTest extends InstallerTestBase {
* Verifies the expected behaviors of the installation result.
*/
public function testInstaller() {
$this->assertUrl('user/1');
$this->assertSession()->addressEquals('user/1');
$this->assertSession()->statusCodeEquals(200);
// Verify German was configured but not English.

View File

@ -75,7 +75,7 @@ class MultipleDistributionsProfileTest extends InstallerTestBase {
* Confirms that the installation succeeded.
*/
public function testInstalled() {
$this->assertUrl('user/1');
$this->assertSession()->addressEquals('user/1');
$this->assertSession()->statusCodeEquals(200);
// Confirm that we are logged-in after installation.
$this->assertText($this->rootUser->getAccountName());

View File

@ -56,7 +56,7 @@ class SingleVisibleProfileTest extends InstallerTestBase {
* Confirms that the installation succeeded.
*/
public function testInstalled() {
$this->assertUrl('user/1');
$this->assertSession()->addressEquals('user/1');
$this->assertSession()->statusCodeEquals(200);
// Confirm that we are logged-in after installation.
$this->assertText($this->rootUser->getAccountName());

View File

@ -203,6 +203,7 @@ class AssertLegacyTraitTest extends UnitTestCase {
/**
* @covers ::assertUrl
* @expectedDeprecation 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
* @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() {

View File

@ -135,7 +135,6 @@ trait DeprecationListenerTrait {
'AssertLegacyTrait::assertLinkByHref() is deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use $this->assertSession()->linkByHrefExists() instead. See https://www.drupal.org/node/3129738',
'AssertLegacyTrait::assertNoLinkByHref() is deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use $this->assertSession()->linkByHrefNotExists() instead. See https://www.drupal.org/node/3129738',
'AssertLegacyTrait::assertNoFieldById() is deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use $this->assertSession()->fieldNotExists() or $this->assertSession()->buttonNotExists() or $this->assertSession()->fieldValueNotEquals() instead. See https://www.drupal.org/node/3129738',
'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',
'AssertLegacyTrait::assertFieldByXPath() is deprecated in drupal:8.3.0 and is removed from drupal:10.0.0. Use $this->xpath() instead and check the values directly in the test. See https://www.drupal.org/node/3129738',
'AssertLegacyTrait::assertNoFieldByXPath() is deprecated in drupal:8.3.0 and is removed from drupal:10.0.0. Use $this->xpath() instead and assert that the result is empty. See https://www.drupal.org/node/3129738',
'AssertLegacyTrait::assertFieldsByValue() is deprecated in drupal:8.3.0 and is removed from drupal:10.0.0. Use iteration over the fields yourself instead and directly check the values in the test. See https://www.drupal.org/node/3129738',