Issue #3139412 by Bunty Badgujar, longwave, mondrake, xjm: Replace usages of deprecated AssertLegacyTrait::assertTitle()
parent
93545bd537
commit
88375258cd
|
@ -253,7 +253,7 @@ class BlockTest extends BlockTestBase {
|
|||
$theme_settings = $this->config('system.theme');
|
||||
foreach (['bartik', 'seven', 'stark'] as $theme) {
|
||||
$this->drupalGet('admin/structure/block/list/' . $theme);
|
||||
$this->assertTitle('Block layout | Drupal');
|
||||
$this->assertSession()->titleEquals('Block layout | Drupal');
|
||||
// Select the 'Powered by Drupal' block to be placed.
|
||||
$block = [];
|
||||
$block['id'] = strtolower($this->randomMachineName());
|
||||
|
|
|
@ -35,7 +35,7 @@ class BlockContentListTest extends BlockContentTestBase {
|
|||
$this->drupalGet('admin/structure/block/block-content');
|
||||
|
||||
// Test for the page title.
|
||||
$this->assertTitle('Custom block library | Drupal');
|
||||
$this->assertSession()->titleEquals('Custom block library | Drupal');
|
||||
|
||||
// Test for the table.
|
||||
$element = $this->xpath('//div[@class="layout-content"]//table');
|
||||
|
@ -85,7 +85,7 @@ class BlockContentListTest extends BlockContentTestBase {
|
|||
$this->assertLinkByHref('block/' . $block->id());
|
||||
$this->clickLink(t('Edit'));
|
||||
$this->assertSession()->statusCodeEquals(200);
|
||||
$this->assertTitle("Edit custom block $label | Drupal");
|
||||
$this->assertSession()->titleEquals("Edit custom block $label | Drupal");
|
||||
$edit = ['info[0][value]' => $new_label];
|
||||
$this->drupalPostForm(NULL, $edit, t('Save'));
|
||||
}
|
||||
|
@ -102,7 +102,7 @@ class BlockContentListTest extends BlockContentTestBase {
|
|||
$delete_text = t('Delete');
|
||||
$this->clickLink($delete_text);
|
||||
$this->assertSession()->statusCodeEquals(200);
|
||||
$this->assertTitle("Are you sure you want to delete the custom block $new_label? | Drupal");
|
||||
$this->assertSession()->titleEquals("Are you sure you want to delete the custom block $new_label? | Drupal");
|
||||
$this->drupalPostForm(NULL, [], $delete_text);
|
||||
|
||||
// Verify that the text of the label and machine name does not appear in
|
||||
|
|
|
@ -38,7 +38,7 @@ class BlockContentListViewsTest extends BlockContentTestBase {
|
|||
$this->drupalGet('admin/structure/block/block-content');
|
||||
|
||||
// Test for the page title.
|
||||
$this->assertTitle('Custom block library | Drupal');
|
||||
$this->assertSession()->titleEquals('Custom block library | Drupal');
|
||||
|
||||
// Test for the exposed filters.
|
||||
$this->assertFieldByName('info');
|
||||
|
@ -97,7 +97,7 @@ class BlockContentListViewsTest extends BlockContentTestBase {
|
|||
$this->assertLinkByHref('block/' . $block->id());
|
||||
$this->clickLink(t('Edit'));
|
||||
$this->assertSession()->statusCodeEquals(200);
|
||||
$this->assertTitle("Edit custom block $label | Drupal");
|
||||
$this->assertSession()->titleEquals("Edit custom block $label | Drupal");
|
||||
$edit = ['info[0][value]' => $new_label];
|
||||
$this->drupalPostForm(NULL, $edit, t('Save'));
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ class BlockContentListViewsTest extends BlockContentTestBase {
|
|||
$delete_text = t('Delete');
|
||||
$this->clickLink($delete_text);
|
||||
$this->assertSession()->statusCodeEquals(200);
|
||||
$this->assertTitle("Are you sure you want to delete the custom block $new_label? | Drupal");
|
||||
$this->assertSession()->titleEquals("Are you sure you want to delete the custom block $new_label? | Drupal");
|
||||
$this->drupalPostForm(NULL, [], $delete_text);
|
||||
|
||||
// Verify that the text of the label and machine name does not appear in
|
||||
|
|
|
@ -120,7 +120,7 @@ class BlockContentTypeTest extends BlockContentTestBase {
|
|||
'label' => 'Bar',
|
||||
];
|
||||
$this->drupalGet('admin/structure/block/block-content/manage/basic');
|
||||
$this->assertTitle('Edit basic custom block type | Drupal');
|
||||
$this->assertSession()->titleEquals('Edit basic custom block type | Drupal');
|
||||
$this->drupalPostForm(NULL, $edit, t('Save'));
|
||||
$front_page_path = Url::fromRoute('<front>')->toString();
|
||||
$this->assertBreadcrumb('admin/structure/block/block-content/manage/basic/fields', [
|
||||
|
|
|
@ -97,7 +97,7 @@ class CommentInterfaceTest extends CommentTestBase {
|
|||
$this->setCommentPreview(DRUPAL_OPTIONAL);
|
||||
|
||||
$this->drupalGet('comment/' . $comment->id() . '/edit');
|
||||
$this->assertTitle('Edit comment ' . $comment->getSubject() . ' | Drupal');
|
||||
$this->assertSession()->titleEquals('Edit comment ' . $comment->getSubject() . ' | Drupal');
|
||||
|
||||
// Test changing the comment author to "Anonymous".
|
||||
$comment = $this->postComment(NULL, $comment->comment_body->value, $comment->getSubject(), ['uid' => '']);
|
||||
|
|
|
@ -67,7 +67,7 @@ class CommentPreviewTest extends CommentTestBase {
|
|||
$this->drupalPostForm('node/' . $this->node->id(), $edit, t('Preview'));
|
||||
|
||||
// Check that the preview is displaying the title and body.
|
||||
$this->assertTitle('Preview comment | Drupal');
|
||||
$this->assertSession()->titleEquals('Preview comment | Drupal');
|
||||
$this->assertText($edit['subject[0][value]'], 'Subject displayed.');
|
||||
$this->assertText($edit['comment_body[0][value]'], 'Comment displayed.');
|
||||
|
||||
|
@ -101,7 +101,7 @@ class CommentPreviewTest extends CommentTestBase {
|
|||
$this->drupalPostForm('node/' . $this->node->id(), $edit, t('Preview'));
|
||||
|
||||
// Check that the preview is displaying the title and body.
|
||||
$this->assertTitle('Preview comment | Drupal');
|
||||
$this->assertSession()->titleEquals('Preview comment | Drupal');
|
||||
$this->assertText($edit['subject[0][value]'], 'Subject displayed.');
|
||||
$this->assertText($edit['comment_body[0][value]'], 'Comment displayed.');
|
||||
|
||||
|
@ -150,7 +150,7 @@ class CommentPreviewTest extends CommentTestBase {
|
|||
$this->drupalPostForm('comment/' . $comment->id() . '/edit', $edit, t('Preview'));
|
||||
|
||||
// Check that the preview is displaying the subject, comment, author and date correctly.
|
||||
$this->assertTitle('Preview comment | Drupal');
|
||||
$this->assertSession()->titleEquals('Preview comment | Drupal');
|
||||
$this->assertText($edit['subject[0][value]'], 'Subject displayed.');
|
||||
$this->assertText($edit['comment_body[0][value]'], 'Comment displayed.');
|
||||
$this->assertText($web_user->getAccountName(), 'Author displayed.');
|
||||
|
|
|
@ -162,7 +162,7 @@ class ConfigEntityListTest extends BrowserTestBase {
|
|||
$this->drupalGet('admin/structure/config_test');
|
||||
|
||||
// Test for the page title.
|
||||
$this->assertTitle('Test configuration | Drupal');
|
||||
$this->assertSession()->titleEquals('Test configuration | Drupal');
|
||||
|
||||
// Test for the table.
|
||||
$element = $this->xpath('//div[@class="layout-content"]//table');
|
||||
|
@ -213,7 +213,7 @@ class ConfigEntityListTest extends BrowserTestBase {
|
|||
$this->assertLinkByHref('admin/structure/config_test/manage/antelope');
|
||||
$this->clickLink('Edit', 1);
|
||||
$this->assertSession()->statusCodeEquals(200);
|
||||
$this->assertTitle('Edit Antelope | Drupal');
|
||||
$this->assertSession()->titleEquals('Edit Antelope | Drupal');
|
||||
$edit = ['label' => 'Albatross', 'id' => 'albatross'];
|
||||
$this->drupalPostForm(NULL, $edit, t('Save'));
|
||||
|
||||
|
@ -227,7 +227,7 @@ class ConfigEntityListTest extends BrowserTestBase {
|
|||
$this->assertLinkByHref('admin/structure/config_test/manage/albatross/delete');
|
||||
$this->clickLink('Delete', 1);
|
||||
$this->assertSession()->statusCodeEquals(200);
|
||||
$this->assertTitle('Are you sure you want to delete the test configuration Albatross? | Drupal');
|
||||
$this->assertSession()->titleEquals('Are you sure you want to delete the test configuration Albatross? | Drupal');
|
||||
$this->drupalPostForm(NULL, [], t('Delete'));
|
||||
|
||||
// Verify that the text of the label and machine name does not appear in
|
||||
|
@ -238,7 +238,7 @@ class ConfigEntityListTest extends BrowserTestBase {
|
|||
// Delete the original entity using the operations link.
|
||||
$this->clickLink('Delete');
|
||||
$this->assertSession()->statusCodeEquals(200);
|
||||
$this->assertTitle('Are you sure you want to delete the test configuration Default? | Drupal');
|
||||
$this->assertSession()->titleEquals('Are you sure you want to delete the test configuration Default? | Drupal');
|
||||
$this->drupalPostForm(NULL, [], t('Delete'));
|
||||
|
||||
// Verify that the text of the label and machine name does not appear in
|
||||
|
|
|
@ -35,7 +35,7 @@ class ConfigFormOverrideTest extends BrowserTestBase {
|
|||
// Test that everything on the form is the same, but that the override
|
||||
// worked for the actual site name.
|
||||
$this->drupalGet('admin/config/system/site-information');
|
||||
$this->assertTitle('Basic site settings | ' . $overridden_name);
|
||||
$this->assertSession()->titleEquals('Basic site settings | ' . $overridden_name);
|
||||
$elements = $this->xpath('//input[@name="site_name"]');
|
||||
$this->assertIdentical($elements[0]->getValue(), 'Drupal');
|
||||
|
||||
|
@ -44,7 +44,7 @@ class ConfigFormOverrideTest extends BrowserTestBase {
|
|||
'site_name' => 'Custom site name',
|
||||
];
|
||||
$this->drupalPostForm('admin/config/system/site-information', $edit, t('Save configuration'));
|
||||
$this->assertTitle('Basic site settings | ' . $overridden_name);
|
||||
$this->assertSession()->titleEquals('Basic site settings | ' . $overridden_name);
|
||||
$elements = $this->xpath('//input[@name="site_name"]');
|
||||
$this->assertIdentical($elements[0]->getValue(), $edit['site_name']);
|
||||
}
|
||||
|
|
|
@ -301,7 +301,7 @@ class ConfigImportUITest extends BrowserTestBase {
|
|||
// Load the diff UI and verify that the diff reflects the change.
|
||||
$this->drupalGet('admin/config/development/configuration/sync/diff/' . $config_name);
|
||||
$this->assertNoRaw('&nbsp;');
|
||||
$this->assertTitle("View changes of $config_name | Drupal");
|
||||
$this->assertSession()->titleEquals("View changes of $config_name | Drupal");
|
||||
|
||||
// The following assertions do not use $this::assertEscaped() because
|
||||
// \Drupal\Component\Diff\DiffFormatter adds markup that signifies what has
|
||||
|
|
|
@ -35,7 +35,7 @@ class ContentTranslationViewsUITest extends UITestBase {
|
|||
*/
|
||||
public function testViewsUI() {
|
||||
$this->drupalGet('admin/structure/views/view/test_view/edit');
|
||||
$this->assertTitle('Test view (Views test data) | Drupal');
|
||||
$this->assertSession()->titleEquals('Test view (Views test data) | Drupal');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ class FieldUIRouteTest extends BrowserTestBase {
|
|||
$this->assertText('No fields are present yet.');
|
||||
|
||||
$this->drupalGet('admin/config/people/accounts/fields');
|
||||
$this->assertTitle('Manage fields | Drupal');
|
||||
$this->assertSession()->titleEquals('Manage fields | Drupal');
|
||||
$this->assertLocalTasks();
|
||||
|
||||
// Test manage display tabs and titles.
|
||||
|
@ -51,13 +51,13 @@ class FieldUIRouteTest extends BrowserTestBase {
|
|||
$this->assertSession()->statusCodeEquals(403);
|
||||
|
||||
$this->drupalGet('admin/config/people/accounts/display');
|
||||
$this->assertTitle('Manage display | Drupal');
|
||||
$this->assertSession()->titleEquals('Manage display | Drupal');
|
||||
$this->assertLocalTasks();
|
||||
|
||||
$edit = ['display_modes_custom[compact]' => TRUE];
|
||||
$this->drupalPostForm(NULL, $edit, t('Save'));
|
||||
$this->drupalGet('admin/config/people/accounts/display/compact');
|
||||
$this->assertTitle('Manage display | Drupal');
|
||||
$this->assertSession()->titleEquals('Manage display | Drupal');
|
||||
$this->assertLocalTasks();
|
||||
|
||||
// Test manage form display tabs and titles.
|
||||
|
@ -65,14 +65,14 @@ class FieldUIRouteTest extends BrowserTestBase {
|
|||
$this->assertSession()->statusCodeEquals(403);
|
||||
|
||||
$this->drupalGet('admin/config/people/accounts/form-display');
|
||||
$this->assertTitle('Manage form display | Drupal');
|
||||
$this->assertSession()->titleEquals('Manage form display | Drupal');
|
||||
$this->assertLocalTasks();
|
||||
|
||||
$edit = ['display_modes_custom[register]' => TRUE];
|
||||
$this->drupalPostForm(NULL, $edit, t('Save'));
|
||||
$this->assertSession()->statusCodeEquals(200);
|
||||
$this->drupalGet('admin/config/people/accounts/form-display/register');
|
||||
$this->assertTitle('Manage form display | Drupal');
|
||||
$this->assertSession()->titleEquals('Manage form display | Drupal');
|
||||
$this->assertLocalTasks();
|
||||
$this->assertCount(1, $this->xpath('//ul/li[1]/a[contains(text(), :text)]', [':text' => 'Default']), 'Default secondary tab is in first position.');
|
||||
|
||||
|
|
|
@ -95,7 +95,7 @@ class FileListingTest extends FileFieldTestBase {
|
|||
|
||||
$this->drupalGet('admin/content/files/usage/' . $file->id());
|
||||
$this->assertSession()->statusCodeEquals(200);
|
||||
$this->assertTitle('File usage information for ' . $file->getFilename() . ' | Drupal');
|
||||
$this->assertSession()->titleEquals('File usage information for ' . $file->getFilename() . ' | Drupal');
|
||||
|
||||
foreach ($nodes as &$node) {
|
||||
$this->drupalGet('node/' . $node->id() . '/edit');
|
||||
|
|
|
@ -246,12 +246,12 @@ class ForumTest extends BrowserTestBase {
|
|||
// Test the root forum page title change.
|
||||
$this->drupalGet('forum');
|
||||
$this->assertCacheTag('config:taxonomy.vocabulary.' . $this->forum['vid']);
|
||||
$this->assertTitle('Forums | Drupal');
|
||||
$this->assertSession()->titleEquals('Forums | Drupal');
|
||||
$vocabulary = Vocabulary::load($this->forum['vid']);
|
||||
$vocabulary->set('name', 'Discussions');
|
||||
$vocabulary->save();
|
||||
$this->drupalGet('forum');
|
||||
$this->assertTitle('Discussions | Drupal');
|
||||
$this->assertSession()->titleEquals('Discussions | Drupal');
|
||||
|
||||
// Test anonymous action link.
|
||||
$this->drupalLogout();
|
||||
|
@ -620,7 +620,7 @@ class ForumTest extends BrowserTestBase {
|
|||
$this->drupalGet('admin/help/forum');
|
||||
$this->assertSession()->statusCodeEquals($response2);
|
||||
if ($response2 == 200) {
|
||||
$this->assertTitle('Forum | Drupal');
|
||||
$this->assertSession()->titleEquals('Forum | Drupal');
|
||||
$this->assertText(t('Forum'), 'Forum help node was displayed');
|
||||
}
|
||||
|
||||
|
@ -634,7 +634,7 @@ class ForumTest extends BrowserTestBase {
|
|||
// View forum node.
|
||||
$this->drupalGet('node/' . $node->id());
|
||||
$this->assertSession()->statusCodeEquals(200);
|
||||
$this->assertTitle($node->label() . ' | Drupal');
|
||||
$this->assertSession()->titleEquals($node->label() . ' | Drupal');
|
||||
$breadcrumb_build = [
|
||||
Link::createFromRoute(t('Home'), '<front>'),
|
||||
Link::createFromRoute(t('Forums'), 'forum.index'),
|
||||
|
@ -651,7 +651,7 @@ class ForumTest extends BrowserTestBase {
|
|||
$this->drupalGet('node/' . $node->id() . '/edit');
|
||||
$this->assertSession()->statusCodeEquals($response);
|
||||
if ($response == 200) {
|
||||
$this->assertTitle('Edit Forum topic ' . $node->label() . ' | Drupal');
|
||||
$this->assertSession()->titleEquals('Edit Forum topic ' . $node->label() . ' | Drupal');
|
||||
}
|
||||
|
||||
if ($response == 200) {
|
||||
|
@ -695,7 +695,7 @@ class ForumTest extends BrowserTestBase {
|
|||
// View forum page.
|
||||
$this->drupalGet('forum/' . $forum['tid']);
|
||||
$this->assertSession()->statusCodeEquals(200);
|
||||
$this->assertTitle($forum['name'] . ' | Drupal');
|
||||
$this->assertSession()->titleEquals($forum['name'] . ' | Drupal');
|
||||
|
||||
$breadcrumb_build = [
|
||||
Link::createFromRoute(t('Home'), '<front>'),
|
||||
|
|
|
@ -127,7 +127,7 @@ class HelpTest extends BrowserTestBase {
|
|||
$this->drupalGet('admin/help/' . $module);
|
||||
$this->assertSession()->statusCodeEquals($response);
|
||||
if ($response == 200) {
|
||||
$this->assertTitle("$name | Drupal");
|
||||
$this->assertSession()->titleEquals("$name | Drupal");
|
||||
$this->assertEquals($name, $this->cssSelect('h1.page-title')[0]->getText(), "$module heading was displayed");
|
||||
$info = \Drupal::service('extension.list.module')->getExtensionInfo($module);
|
||||
$admin_tasks = system_get_module_admin_tasks($module, $info);
|
||||
|
|
|
@ -216,7 +216,7 @@ class ImageAdminStylesTest extends ImageFieldTestBase {
|
|||
|
||||
// Check that the URL was updated.
|
||||
$this->drupalGet($style_path);
|
||||
$this->assertTitle("Edit style $style_label | Drupal");
|
||||
$this->assertSession()->titleEquals("Edit style $style_label | Drupal");
|
||||
|
||||
// Check that the available image effects are properly sorted.
|
||||
$option = $this->xpath('//select[@id=:id]//option', [':id' => 'edit-new--2']);
|
||||
|
|
|
@ -93,7 +93,7 @@ class LanguageListTest extends BrowserTestBase {
|
|||
// Ensure 'Edit' link works.
|
||||
$this->drupalGet('admin/config/regional/language');
|
||||
$this->clickLink(t('Edit'));
|
||||
$this->assertTitle('Edit language | Drupal');
|
||||
$this->assertSession()->titleEquals('Edit language | Drupal');
|
||||
// Edit a language.
|
||||
$name = $this->randomMachineName(16);
|
||||
$edit = [
|
||||
|
|
|
@ -709,7 +709,7 @@ class MenuUiTest extends BrowserTestBase {
|
|||
// Verify menu link link.
|
||||
$this->clickLink($title);
|
||||
$title = $parent_node->label();
|
||||
$this->assertTitle("$title | Drupal");
|
||||
$this->assertSession()->titleEquals("$title | Drupal");
|
||||
}
|
||||
|
||||
// Verify menu link.
|
||||
|
@ -719,7 +719,7 @@ class MenuUiTest extends BrowserTestBase {
|
|||
// Verify menu link link.
|
||||
$this->clickLink($title);
|
||||
$title = $item_node->label();
|
||||
$this->assertTitle("$title | Drupal");
|
||||
$this->assertSession()->titleEquals("$title | Drupal");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -83,7 +83,7 @@ class NodeTitleTest extends NodeTestBase {
|
|||
$node = $this->drupalCreateNode($settings);
|
||||
// Test that 0 appears as <title>.
|
||||
$this->drupalGet('node/' . $node->id());
|
||||
$this->assertTitle('0 | Drupal');
|
||||
$this->assertSession()->titleEquals('0 | Drupal');
|
||||
// Test that 0 appears in the template <h1>.
|
||||
$xpath = '//h1';
|
||||
$this->assertSame('0', $this->xpath($xpath)[0]->getText(), 'Node title is displayed as 0.');
|
||||
|
|
|
@ -440,7 +440,7 @@ class PagePreviewTest extends NodeTestBase {
|
|||
$this->drupalPostForm('node/add/page', $edit, t('Preview'));
|
||||
|
||||
// Check that the preview is displaying the title, body and term.
|
||||
$this->assertTitle($edit[$title_key] . ' | Drupal');
|
||||
$this->assertSession()->titleEquals($edit[$title_key] . ' | Drupal');
|
||||
$this->assertText($edit[$title_key], 'Title displayed.');
|
||||
$this->assertText($edit[$body_key], 'Body displayed.');
|
||||
$this->assertText($edit[$term_key], 'Term displayed.');
|
||||
|
|
|
@ -254,7 +254,7 @@ class SearchConfigSettingsFormTest extends BrowserTestBase {
|
|||
$edit = [];
|
||||
$edit['search_type'] = 'search_extra_type_search';
|
||||
$this->drupalPostForm(NULL, $edit, t('Add search page'));
|
||||
$this->assertTitle('Add new search page | Drupal');
|
||||
$this->assertSession()->titleEquals('Add new search page | Drupal');
|
||||
|
||||
$first = [];
|
||||
$first['label'] = $this->randomString();
|
||||
|
|
|
@ -68,7 +68,7 @@ class SearchPageTextTest extends BrowserTestBase {
|
|||
$this->drupalGet('search/node');
|
||||
$this->assertText(t('Enter your keywords'));
|
||||
$this->assertText(t('Search'));
|
||||
$this->assertTitle('Search | Drupal');
|
||||
$this->assertSession()->titleEquals('Search | Drupal');
|
||||
|
||||
$edit = [];
|
||||
$search_terms = 'bike shed ' . $this->randomMachineName();
|
||||
|
@ -77,7 +77,7 @@ class SearchPageTextTest extends BrowserTestBase {
|
|||
$this->assertText('search yielded no results');
|
||||
$this->assertText(t('Search'));
|
||||
$title_source = 'Search for @keywords | Drupal';
|
||||
$this->assertTitle('Search for ' . Unicode::truncate($search_terms, 60, TRUE, TRUE) . ' | Drupal');
|
||||
$this->assertSession()->titleEquals('Search for ' . Unicode::truncate($search_terms, 60, TRUE, TRUE) . ' | Drupal');
|
||||
$this->assertNoText('Node', 'Erroneous tab and breadcrumb text is not present');
|
||||
$this->assertNoText(t('Node'), 'Erroneous translated tab and breadcrumb text is not present');
|
||||
$this->assertText(t('Content'), 'Tab and breadcrumb text is present');
|
||||
|
@ -91,7 +91,7 @@ class SearchPageTextTest extends BrowserTestBase {
|
|||
$search_terms = 'Every word is like an unnecessary stain on silence and nothingness.';
|
||||
$edit['keys'] = $search_terms;
|
||||
$this->drupalPostForm('search/node', $edit, t('Search'));
|
||||
$this->assertTitle('Search for Every word is like an unnecessary stain on silence and… | Drupal');
|
||||
$this->assertSession()->titleEquals('Search for Every word is like an unnecessary stain on silence and… | Drupal');
|
||||
|
||||
// Search for a string with a lot of special characters.
|
||||
$search_terms = 'Hear nothing > "see nothing" `feel' . " '1982.";
|
||||
|
@ -103,7 +103,7 @@ class SearchPageTextTest extends BrowserTestBase {
|
|||
$edit['keys'] = $this->searchingUser->getAccountName();
|
||||
$this->drupalPostForm('search/user', $edit, t('Search'));
|
||||
$this->assertText(t('Search'));
|
||||
$this->assertTitle('Search for ' . Unicode::truncate($this->searchingUser->getAccountName(), 60, TRUE, TRUE) . ' | Drupal');
|
||||
$this->assertSession()->titleEquals('Search for ' . Unicode::truncate($this->searchingUser->getAccountName(), 60, TRUE, TRUE) . ' | Drupal');
|
||||
|
||||
$this->clickLink('Search help');
|
||||
$this->assertText('Search help', 'Correct title is on search help page');
|
||||
|
|
|
@ -60,7 +60,7 @@ class ShortcutSetsTest extends ShortcutTestBase {
|
|||
$this->drupalGet('admin/config/user-interface/shortcut/manage/' . $set->id() . '/customize');
|
||||
|
||||
// Test for the page title.
|
||||
$this->assertTitle('List links | Drupal');
|
||||
$this->assertSession()->titleEquals('List links | Drupal');
|
||||
|
||||
// Test for the table.
|
||||
$element = $this->xpath('//div[@class="layout-content"]//table');
|
||||
|
|
|
@ -35,7 +35,7 @@ class RenderWebTest extends BrowserTestBase {
|
|||
$this->drupalGet('common-test/type-link-active-class');
|
||||
$this->assertStringStartsWith("<!DOCTYPE html>\n<html", $this->getSession()->getPage()->getContent());
|
||||
$this->assertIdentical('text/html; charset=UTF-8', $this->drupalGetHeader('Content-Type'));
|
||||
$this->assertTitle('Test active link class | Drupal');
|
||||
$this->assertSession()->titleEquals('Test active link class | Drupal');
|
||||
$this->assertCacheContext('url.query_args:' . MainContentViewSubscriber::WRAPPER_FORMAT);
|
||||
|
||||
$this->drupalGet('common-test/type-link-active-class', ['query' => [MainContentViewSubscriber::WRAPPER_FORMAT => 'json']]);
|
||||
|
|
|
@ -29,7 +29,7 @@ class ConfirmFormTest extends BrowserTestBase {
|
|||
// Test the building of the form.
|
||||
$this->drupalGet('form-test/confirm-form');
|
||||
$site_name = $this->config('system.site')->get('name');
|
||||
$this->assertTitle("ConfirmFormTestForm::getQuestion(). | $site_name");
|
||||
$this->assertSession()->titleEquals("ConfirmFormTestForm::getQuestion(). | $site_name");
|
||||
$this->assertText(t('ConfirmFormTestForm::getDescription().'), 'The description was used.');
|
||||
$this->assertFieldByXPath('//input[@id="edit-submit"]', t('ConfirmFormTestForm::getConfirmText().'), 'The confirm text was used.');
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ trait AssertBreadcrumbTrait {
|
|||
|
||||
// Additionally assert page title, if given.
|
||||
if (isset($page_title)) {
|
||||
$this->assertTitle("$page_title | Drupal");
|
||||
$this->assertSession()->titleEquals("$page_title | Drupal");
|
||||
}
|
||||
|
||||
// Additionally assert active trail in a menu tree output, if given.
|
||||
|
|
|
@ -60,7 +60,7 @@ class UninstallTest extends BrowserTestBase {
|
|||
$node->save();
|
||||
|
||||
$this->drupalGet('admin/modules/uninstall');
|
||||
$this->assertTitle('Uninstall | Drupal');
|
||||
$this->assertSession()->titleEquals('Uninstall | Drupal');
|
||||
|
||||
foreach (\Drupal::service('extension.list.module')->getAllInstalledInfo() as $module => $info) {
|
||||
$field_name = "uninstall[$module]";
|
||||
|
@ -136,7 +136,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->assertTitle('Uninstall | Drupal');
|
||||
$this->assertSession()->titleEquals('Uninstall | Drupal');
|
||||
|
||||
// Make sure the correct error is shown when no modules are selected.
|
||||
$edit = [];
|
||||
|
|
|
@ -59,7 +59,7 @@ class FrontPageTest extends BrowserTestBase {
|
|||
];
|
||||
$this->drupalCreateNode($settings);
|
||||
$this->drupalGet('');
|
||||
$this->assertTitle('Home | Drupal');
|
||||
$this->assertSession()->titleEquals('Home | Drupal');
|
||||
|
||||
$this->assertText(t('On front page.'), 'Path is the front page.');
|
||||
$this->drupalGet('node');
|
||||
|
|
|
@ -107,14 +107,14 @@ class PageTitleTest extends BrowserTestBase {
|
|||
// Test the '#title' render array attribute.
|
||||
$this->drupalGet('test-render-title');
|
||||
|
||||
$this->assertTitle('Foo | Drupal');
|
||||
$this->assertSession()->titleEquals('Foo | Drupal');
|
||||
$result = $this->xpath('//h1[@class="page-title"]');
|
||||
$this->assertEqual('Foo', $result[0]->getText());
|
||||
|
||||
// Test forms
|
||||
$this->drupalGet('form-test/object-builder');
|
||||
|
||||
$this->assertTitle('Test dynamic title | Drupal');
|
||||
$this->assertSession()->titleEquals('Test dynamic title | Drupal');
|
||||
$result = $this->xpath('//h1[@class="page-title"]');
|
||||
$this->assertEqual('Test dynamic title', $result[0]->getText());
|
||||
|
||||
|
@ -139,24 +139,24 @@ class PageTitleTest extends BrowserTestBase {
|
|||
// Ensure that the title got translated.
|
||||
$this->drupalGet('test-page-static-title');
|
||||
|
||||
$this->assertTitle('Static title translated | Drupal');
|
||||
$this->assertSession()->titleEquals('Static title translated | Drupal');
|
||||
$result = $this->xpath('//h1[@class="page-title"]');
|
||||
$this->assertEqual('Static title translated', $result[0]->getText());
|
||||
|
||||
// Test the dynamic '_title_callback' route option.
|
||||
$this->drupalGet('test-page-dynamic-title');
|
||||
|
||||
$this->assertTitle('Dynamic title | Drupal');
|
||||
$this->assertSession()->titleEquals('Dynamic title | Drupal');
|
||||
$result = $this->xpath('//h1[@class="page-title"]');
|
||||
$this->assertEqual('Dynamic title', $result[0]->getText());
|
||||
|
||||
// Ensure that titles are cacheable and are escaped normally if the
|
||||
// controller does not escape them.
|
||||
$this->drupalGet('test-page-cached-controller');
|
||||
$this->assertTitle('Cached title | Drupal');
|
||||
$this->assertSession()->titleEquals('Cached title | Drupal');
|
||||
$this->assertRaw(Html::escape('<span>Cached title</span>') . '</h1>');
|
||||
$this->drupalGet('test-page-cached-controller');
|
||||
$this->assertTitle('Cached title | Drupal');
|
||||
$this->assertSession()->titleEquals('Cached title | Drupal');
|
||||
$this->assertRaw(Html::escape('<span>Cached title</span>') . '</h1>');
|
||||
}
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ class SystemAuthorizeTest extends BrowserTestBase {
|
|||
public function testFileTransferHooks() {
|
||||
$page_title = $this->randomMachineName(16);
|
||||
$this->drupalGetAuthorizePHP($page_title);
|
||||
$this->assertTitle("$page_title | Drupal");
|
||||
$this->assertSession()->titleEquals("$page_title | Drupal");
|
||||
$this->assertNoText('It appears you have reached this page in error.');
|
||||
$this->assertText('To continue, provide your server connection details');
|
||||
// Make sure we see the new connection method added by system_test.
|
||||
|
|
|
@ -81,7 +81,7 @@ class VocabularyUiTest extends TaxonomyTestBase {
|
|||
$this->drupalPostForm('admin/structure/taxonomy/add', $edit, t('Save'));
|
||||
|
||||
$site_name = $this->config('system.site')->get('name');
|
||||
$this->assertTitle("Don't Panic | $site_name");
|
||||
$this->assertSession()->titleEquals("Don't Panic | $site_name");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -212,7 +212,7 @@ class TrackerTest extends BrowserTestBase {
|
|||
$this->assertNoLink($unpublished->label());
|
||||
// Verify that title and tab title have been set correctly.
|
||||
$this->assertText('Activity', 'The user activity tab has the name "Activity".');
|
||||
$this->assertTitle($this->user->getAccountName() . ' | Drupal');
|
||||
$this->assertSession()->titleEquals($this->user->getAccountName() . ' | Drupal');
|
||||
|
||||
// Verify that unpublished comments are removed from the tracker.
|
||||
$admin_user = $this->drupalCreateUser(['post comments', 'administer comments', 'access user profiles']);
|
||||
|
|
|
@ -81,7 +81,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->assertTitle('Update manager | Drupal');
|
||||
$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.
|
||||
$this->assertRaw(t('Installed %project_name successfully', ['%project_name' => 'update_test_new_module']));
|
||||
|
|
|
@ -120,16 +120,16 @@ class UserAccountLinksTest extends BrowserTestBase {
|
|||
$title_suffix = ' | Drupal';
|
||||
|
||||
$this->drupalGet('user');
|
||||
$this->assertTitle('Log in' . $title_suffix);
|
||||
$this->assertSession()->titleEquals('Log in' . $title_suffix);
|
||||
|
||||
$this->drupalGet('user/login');
|
||||
$this->assertTitle('Log in' . $title_suffix);
|
||||
$this->assertSession()->titleEquals('Log in' . $title_suffix);
|
||||
|
||||
$this->drupalGet('user/register');
|
||||
$this->assertTitle('Create new account' . $title_suffix);
|
||||
$this->assertSession()->titleEquals('Create new account' . $title_suffix);
|
||||
|
||||
$this->drupalGet('user/password');
|
||||
$this->assertTitle('Reset your password' . $title_suffix);
|
||||
$this->assertSession()->titleEquals('Reset your password' . $title_suffix);
|
||||
|
||||
// Check the page title for registered users is "My Account" in menus.
|
||||
$this->drupalLogin($this->drupalCreateUser());
|
||||
|
|
|
@ -105,12 +105,12 @@ class UserPasswordResetTest extends BrowserTestBase {
|
|||
// Check the one-time login page.
|
||||
$this->assertText($this->account->getAccountName(), 'One-time login page contains the correct username.');
|
||||
$this->assertText(t('This login can be used only once.'), 'Found warning about one-time login.');
|
||||
$this->assertTitle('Reset password | Drupal');
|
||||
$this->assertSession()->titleEquals('Reset password | Drupal');
|
||||
|
||||
// Check successful login.
|
||||
$this->drupalPostForm(NULL, NULL, t('Log in'));
|
||||
$this->assertLink(t('Log out'));
|
||||
$this->assertTitle($this->account->getAccountName() . ' | Drupal');
|
||||
$this->assertSession()->titleEquals($this->account->getAccountName() . ' | Drupal');
|
||||
|
||||
// Change the forgotten password.
|
||||
$password = user_password();
|
||||
|
@ -189,7 +189,7 @@ class UserPasswordResetTest extends BrowserTestBase {
|
|||
$reset_url = $this->getResetURL();
|
||||
$this->drupalGet($reset_url . '/login');
|
||||
$this->assertLink(t('Log out'));
|
||||
$this->assertTitle($this->account->getAccountName() . ' | Drupal');
|
||||
$this->assertSession()->titleEquals($this->account->getAccountName() . ' | Drupal');
|
||||
|
||||
// Ensure blocked and deleted accounts can't access the user.reset.login
|
||||
// route.
|
||||
|
@ -359,7 +359,7 @@ class UserPasswordResetTest extends BrowserTestBase {
|
|||
$reset_url = $this->getResetURL();
|
||||
$this->drupalGet($reset_url . '/login');
|
||||
$this->assertLink(t('Log out'));
|
||||
$this->assertTitle($this->account->getAccountName() . ' | Drupal');
|
||||
$this->assertSession()->titleEquals($this->account->getAccountName() . ' | Drupal');
|
||||
$this->drupalLogout();
|
||||
|
||||
// The next request should *not* trigger flood control, since a successful
|
||||
|
|
|
@ -55,7 +55,7 @@ class UserRegistrationTest extends BrowserTestBase {
|
|||
$this->assertTrue($new_user->isActive(), 'New account is active after registration.');
|
||||
$resetURL = user_pass_reset_url($new_user);
|
||||
$this->drupalGet($resetURL);
|
||||
$this->assertTitle('Set password | Drupal');
|
||||
$this->assertSession()->titleEquals('Set password | Drupal');
|
||||
|
||||
// Allow registration by site visitors, but require administrator approval.
|
||||
$config->set('register', UserInterface::REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL)->save();
|
||||
|
|
|
@ -41,7 +41,7 @@ class AreaTitleWebTest extends ViewTestBase {
|
|||
// Confirm that the view has the normal title before making the view return
|
||||
// no result.
|
||||
$this->drupalGet('test-area-title');
|
||||
$this->assertTitle('test_title_header | Drupal');
|
||||
$this->assertSession()->titleEquals('test_title_header | Drupal');
|
||||
|
||||
// Change the view to return no result.
|
||||
/** @var \Drupal\views\Entity\View $view */
|
||||
|
@ -60,7 +60,7 @@ class AreaTitleWebTest extends ViewTestBase {
|
|||
$view->save();
|
||||
|
||||
$this->drupalGet('test-area-title');
|
||||
$this->assertTitle('test_title_empty | Drupal');
|
||||
$this->assertSession()->titleEquals('test_title_empty | Drupal');
|
||||
|
||||
// Change the view to return a result instead.
|
||||
/** @var \Drupal\views\Entity\View $view */
|
||||
|
@ -79,7 +79,7 @@ class AreaTitleWebTest extends ViewTestBase {
|
|||
$view->save();
|
||||
|
||||
$this->drupalGet('test-area-title');
|
||||
$this->assertTitle('test_title_header | Drupal');
|
||||
$this->assertSession()->titleEquals('test_title_header | Drupal');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -99,7 +99,7 @@ class DisplayPageWebTest extends ViewTestBase {
|
|||
':a_class' => 'is-active',
|
||||
]);
|
||||
$this->assertEqual($element[0]->getText(), t('Test default tab'));
|
||||
$this->assertTitle('Test default page | Drupal');
|
||||
$this->assertSession()->titleEquals('Test default page | Drupal');
|
||||
|
||||
$this->drupalGet('test_page_display_menu/default');
|
||||
$this->assertSession()->statusCodeEquals(404);
|
||||
|
@ -111,7 +111,7 @@ class DisplayPageWebTest extends ViewTestBase {
|
|||
':a_class' => 'is-active',
|
||||
]);
|
||||
$this->assertEqual($element[0]->getText(), t('Test local tab'));
|
||||
$this->assertTitle('Test local page | Drupal');
|
||||
$this->assertSession()->titleEquals('Test local page | Drupal');
|
||||
|
||||
// Check an ordinary menu link.
|
||||
$admin_user = $this->drupalCreateUser(['administer menu']);
|
||||
|
|
|
@ -93,7 +93,7 @@ class DefaultViewsTest extends UITestBase {
|
|||
$edit = [
|
||||
'id' => 'duplicate_of_glossary',
|
||||
];
|
||||
$this->assertTitle('Duplicate of Glossary | Drupal');
|
||||
$this->assertSession()->titleEquals('Duplicate of Glossary | Drupal');
|
||||
$this->drupalPostForm(NULL, $edit, t('Duplicate'));
|
||||
$this->assertUrl('admin/structure/views/view/duplicate_of_glossary', [], 'The normal duplicating name schema is applied.');
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ class TranslatedViewTest extends UITestBase {
|
|||
|
||||
// Check the original string.
|
||||
$this->drupalGet($edit_url);
|
||||
$this->assertTitle('Files (File) | Drupal');
|
||||
$this->assertSession()->titleEquals('Files (File) | Drupal');
|
||||
|
||||
// Translate the label of the view.
|
||||
$this->drupalGet($translation_url);
|
||||
|
@ -81,7 +81,7 @@ class TranslatedViewTest extends UITestBase {
|
|||
|
||||
// Check if the label is translated.
|
||||
$this->drupalGet($edit_url, ['language' => \Drupal::languageManager()->getLanguage('fr')]);
|
||||
$this->assertTitle('Files (File) | Drupal');
|
||||
$this->assertSession()->titleEquals('Files (File) | Drupal');
|
||||
$this->assertNoText('Fichiers');
|
||||
}
|
||||
|
||||
|
|
|
@ -249,6 +249,17 @@ class BrowserTestBaseTest extends BrowserTestBase {
|
|||
$this->assertResponse(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests legacy assertTitle().
|
||||
*
|
||||
* @group legacy
|
||||
* @expectedDeprecation AssertLegacyTrait::assertTitle() is deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use $this->assertSession()->titleEquals() instead. See https://www.drupal.org/node/3129738
|
||||
*/
|
||||
public function testAssertTitle() {
|
||||
$this->drupalGet('test-encoded');
|
||||
$this->assertTitle("Page with encoded HTML | Drupal");
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests legacy assertHeader().
|
||||
*
|
||||
|
|
|
@ -51,7 +51,7 @@ class DistributionProfileTest extends InstallerTestBase {
|
|||
// Verify that the distribution name appears.
|
||||
$this->assertRaw($this->info['distribution']['name']);
|
||||
// Verify that the distribution name is used in the site title.
|
||||
$this->assertTitle('Choose language | ' . $this->info['distribution']['name']);
|
||||
$this->assertSession()->titleEquals('Choose language | ' . $this->info['distribution']['name']);
|
||||
// Verify that the requested theme is used.
|
||||
$this->assertRaw($this->info['distribution']['install']['theme']);
|
||||
// Verify that the "Choose profile" step does not appear.
|
||||
|
|
|
@ -35,7 +35,7 @@ class InstallerExistingConfigNoConfigTest extends InstallerExistingConfigTestBas
|
|||
* Tests that profiles with an empty config/sync directory do not work.
|
||||
*/
|
||||
public function testConfigSync() {
|
||||
$this->assertTitle('Configuration validation | Drupal');
|
||||
$this->assertSession()->titleEquals('Configuration validation | Drupal');
|
||||
$this->assertText('The configuration synchronization failed validation.');
|
||||
$this->assertText('This import is empty and if applied would delete all of your configuration, so has been rejected.');
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ class InstallerExistingConfigNoSystemSiteTest extends InstallerExistingConfigTes
|
|||
*/
|
||||
public function testConfigSync() {
|
||||
$this->htmlOutput(NULL);
|
||||
$this->assertTitle('Configuration validation | Drupal');
|
||||
$this->assertSession()->titleEquals('Configuration validation | Drupal');
|
||||
$this->assertText('The configuration synchronization failed validation.');
|
||||
$this->assertText('This import does not contain system.site configuration, so has been rejected.');
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ EOF;
|
|||
* Confirms the installation has failed and the expected error is displayed.
|
||||
*/
|
||||
public function testConfigSync() {
|
||||
$this->assertTitle('Requirements problem | Drupal');
|
||||
$this->assertSession()->titleEquals('Requirements problem | Drupal');
|
||||
$this->assertText($this->profile);
|
||||
$this->assertText('The selected profile has a hook_install() implementation and therefore can not be installed from configuration.');
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ class InstallerExistingConfigSyncDriectoryProfileMismatchTest extends InstallerE
|
|||
*/
|
||||
public function testConfigSync() {
|
||||
$this->htmlOutput(NULL);
|
||||
$this->assertTitle('Configuration validation | Drupal');
|
||||
$this->assertSession()->titleEquals('Configuration validation | Drupal');
|
||||
$this->assertText('The configuration synchronization failed validation.');
|
||||
$this->assertText('The selected installation profile minimal does not match the profile stored in configuration testing_config_install_multilingual.');
|
||||
|
||||
|
|
|
@ -108,7 +108,7 @@ class InstallerTest extends InstallerTestBase {
|
|||
parent::visitInstaller();
|
||||
|
||||
// Assert the title is correct and has the title suffix.
|
||||
$this->assertTitle('Choose language | Drupal');
|
||||
$this->assertSession()->titleEquals('Choose language | Drupal');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -185,7 +185,6 @@ trait DeprecationListenerTrait {
|
|||
'AssertLegacyTrait::assertNoField() is deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use $this->assertSession()->fieldNotExists() or $this->assertSession()->buttonNotExists() instead. See https://www.drupal.org/node/3129738',
|
||||
'AssertLegacyTrait::assertRaw() is deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use $this->assertSession()->responseContains() instead. See https://www.drupal.org/node/3129738',
|
||||
'AssertLegacyTrait::assertNoRaw() is deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use $this->assertSession()->responseNotContains() instead. See https://www.drupal.org/node/3129738',
|
||||
'AssertLegacyTrait::assertTitle() is deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use $this->assertSession()->titleEquals() instead. See https://www.drupal.org/node/3129738',
|
||||
'AssertLegacyTrait::assertLink() is deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use $this->assertSession()->linkExists() instead. See https://www.drupal.org/node/3129738',
|
||||
'AssertLegacyTrait::assertNoLink() is deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use $this->assertSession()->linkNotExists() instead. See https://www.drupal.org/node/3129738',
|
||||
'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',
|
||||
|
|
Loading…
Reference in New Issue