Commit d7442be7 authored by catch's avatar catch
Browse files

Issue #3191935 by mondrake, tedbow, paulocs, ankithashetty, longwave, xjm,...

Issue #3191935 by mondrake, tedbow, paulocs, ankithashetty, longwave, xjm, catch, alexpott: Replace usages of AssertLegacyTrait::assertNoText, which is deprecated
parent 4a2894ee
......@@ -71,7 +71,7 @@ public function testActionConfiguration() {
// Make sure that the action updated properly.
$this->assertSession()->pageTextContains('The action has been successfully saved.');
// The old action label does NOT appear on the configuration page.
$this->assertNoText($action_label);
$this->assertSession()->pageTextNotContains($action_label);
// The action label appears on the configuration page after we've updated
// the complex action.
$this->assertSession()->pageTextContains($new_action_label);
......@@ -93,7 +93,7 @@ public function testActionConfiguration() {
$this->drupalGet('admin/config/system/actions');
$this->assertSession()->statusCodeEquals(200);
// The action label does not appear on the overview page.
$this->assertNoText($new_action_label);
$this->assertSession()->pageTextNotContains($new_action_label);
$action = Action::load($action_id);
$this->assertNull($action, 'Make sure the action is gone after being deleted.');
......
......@@ -80,7 +80,7 @@ public function testBlockLinks() {
$block->save();
// Check that the block is no longer displayed.
$this->drupalGet('test-page');
$this->assertNoText($block->label());
$this->assertSession()->pageTextNotContains($block->label());
}
/**
......
......@@ -28,16 +28,16 @@ public function testFeedUpdateFields() {
// scheduled.
$this->assertSession()->pageTextContains('never');
$this->assertSession()->pageTextContains('imminently');
$this->assertNoText('ago');
$this->assertNoText('left');
$this->assertSession()->pageTextNotContains('ago');
$this->assertSession()->pageTextNotContains('left');
$this->updateFeedItems($scheduled_feed);
$this->drupalGet('admin/config/services/aggregator');
// After the update, an interval should be displayed on both last updated
// and next update.
$this->assertNoText('never');
$this->assertNoText('imminently');
$this->assertSession()->pageTextNotContains('never');
$this->assertSession()->pageTextNotContains('imminently');
$this->assertSession()->pageTextContains('ago');
$this->assertSession()->pageTextContains('left');
......@@ -50,9 +50,9 @@ public function testFeedUpdateFields() {
$this->drupalGet('admin/config/services/aggregator');
// The non scheduled feed shows that it has not been updated yet.
$this->assertSession()->pageTextContains('never');
$this->assertNoText('imminently');
$this->assertNoText('ago');
$this->assertNoText('left');
$this->assertSession()->pageTextNotContains('imminently');
$this->assertSession()->pageTextNotContains('ago');
$this->assertSession()->pageTextNotContains('left');
$this->updateFeedItems($non_scheduled_feed);
$this->drupalGet('admin/config/services/aggregator');
......@@ -60,9 +60,9 @@ public function testFeedUpdateFields() {
// After the feed update, we still need to see "never" as next update label.
// Last update will show an interval.
$this->assertSession()->pageTextContains('never');
$this->assertNoText('imminently');
$this->assertSession()->pageTextNotContains('imminently');
$this->assertSession()->pageTextContains('ago');
$this->assertNoText('left');
$this->assertSession()->pageTextNotContains('left');
}
/**
......
......@@ -57,7 +57,7 @@ public function testBasicAuth() {
// Ensure that invalid authentication details give access denied.
$this->basicAuthGet($url, $account->getAccountName(), $this->randomMachineName());
$this->assertNoText($account->getAccountName());
$this->assertSession()->pageTextNotContains($account->getAccountName());
$this->assertSession()->statusCodeEquals(403);
$this->mink->resetSessions();
......@@ -179,7 +179,7 @@ public function testUnauthorizedErrorMessage() {
// unauthorized message is displayed.
$this->drupalGet($url);
$this->assertSession()->statusCodeEquals(401);
$this->assertNoText('Exception');
$this->assertSession()->pageTextNotContains('Exception');
$this->assertSession()->pageTextContains('Please log in to access this page.');
// Case when empty credentials are passed, a user friendly access denied
......
......@@ -97,7 +97,7 @@ public function testCachePerRole() {
// Clear the cache and verify that the stale data is no longer there.
Cache::invalidateTags(['block_view']);
$this->drupalGet('');
$this->assertNoText($old_content);
$this->assertSession()->pageTextNotContains($old_content);
// Fresh block content is displayed after clearing the cache.
$this->assertSession()->pageTextContains($current_content);
......@@ -108,7 +108,7 @@ public function testCachePerRole() {
$this->drupalLogout();
$this->drupalGet('');
// Anonymous user does not see content cached per-role for normal user.
$this->assertNoText($old_content);
$this->assertSession()->pageTextNotContains($old_content);
// User with the same roles sees per-role cached content.
$this->drupalLogin($this->normalUserAlt);
......@@ -118,7 +118,7 @@ public function testCachePerRole() {
// Admin user does not see content cached per-role for normal user.
$this->drupalLogin($this->adminUser);
$this->drupalGet('');
$this->assertNoText($old_content);
$this->assertSession()->pageTextNotContains($old_content);
// Block is served from the per-role cache.
$this->drupalLogin($this->normalUser);
......@@ -227,7 +227,7 @@ public function testCachePerPage() {
$this->assertSession()->statusCodeEquals(200);
// Verify that block content cached for the test page does not show up
// for the user page.
$this->assertNoText($old_content);
$this->assertSession()->pageTextNotContains($old_content);
$this->drupalGet('test-page');
$this->assertSession()->statusCodeEquals(200);
// Verify that the block content is cached for the test page.
......
......@@ -19,7 +19,7 @@ class BlockInstallTest extends BrowserTestBase {
public function testCacheTagInvalidationUponInstallation() {
// Warm the page cache.
$this->drupalGet('');
$this->assertNoText('Powered by Drupal');
$this->assertSession()->pageTextNotContains('Powered by Drupal');
$this->assertSession()->responseHeaderNotContains('X-Drupal-Cache-Tags', 'config:block_list');
// Install the block module, and place the "Powered by Drupal" block.
......
......@@ -84,7 +84,7 @@ public function testLanguageBlockVisibility() {
// Check that a page doesn't has a block for the current language anymore.
$this->drupalGet('fr');
$this->assertNoText('Powered by Drupal');
$this->assertSession()->pageTextNotContains('Powered by Drupal');
}
/**
......@@ -162,7 +162,7 @@ public function testMultipleLanguageTypes() {
// Interface negotiation depends on request arguments.
$this->drupalGet('node', ['query' => ['language' => 'en']]);
$this->assertNoText('Powered by Drupal');
$this->assertSession()->pageTextNotContains('Powered by Drupal');
$this->drupalGet('node', ['query' => ['language' => 'fr']]);
$this->assertSession()->pageTextContains('Powered by Drupal');
......@@ -174,9 +174,9 @@ public function testMultipleLanguageTypes() {
// Content language does not depend on session/request arguments.
// It will fall back on English (site default) and not display the block.
$this->drupalGet('en');
$this->assertNoText('Powered by Drupal');
$this->assertSession()->pageTextNotContains('Powered by Drupal');
$this->drupalGet('fr');
$this->assertNoText('Powered by Drupal');
$this->assertSession()->pageTextNotContains('Powered by Drupal');
// Change visibility to now depend on content language for this block.
$edit = [
......@@ -188,13 +188,13 @@ public function testMultipleLanguageTypes() {
// Content language negotiation does not depend on request arguments.
// It will fall back on English (site default) and not display the block.
$this->drupalGet('node', ['query' => ['language' => 'en']]);
$this->assertNoText('Powered by Drupal');
$this->assertSession()->pageTextNotContains('Powered by Drupal');
$this->drupalGet('node', ['query' => ['language' => 'fr']]);
$this->assertNoText('Powered by Drupal');
$this->assertSession()->pageTextNotContains('Powered by Drupal');
// Content language negotiation depends on path prefix.
$this->drupalGet('en');
$this->assertNoText('Powered by Drupal');
$this->assertSession()->pageTextNotContains('Powered by Drupal');
$this->drupalGet('fr');
$this->assertSession()->pageTextContains('Powered by Drupal');
}
......
......@@ -56,15 +56,15 @@ public function testBlockVisibility() {
// Confirm that the block is not displayed according to block visibility
// rules.
$this->drupalGet('user');
$this->assertNoText($title);
$this->assertSession()->pageTextNotContains($title);
// Confirm that the block is not displayed to anonymous users.
$this->drupalLogout();
$this->drupalGet('');
$this->assertNoText($title);
$this->assertSession()->pageTextNotContains($title);
// Confirm that an empty block is not displayed.
$this->assertNoText('Powered by Drupal');
$this->assertSession()->pageTextNotContains('Powered by Drupal');
$this->assertNoRaw('sidebar-first');
}
......@@ -129,17 +129,17 @@ public function testBlockVisibilityListedEmpty() {
// Confirm that block was not displayed according to block visibility
// rules.
$this->drupalGet('user');
$this->assertNoText($title);
$this->assertSession()->pageTextNotContains($title);
// Confirm that block was not displayed according to block visibility
// rules regardless of path case.
$this->drupalGet('USER');
$this->assertNoText($title);
$this->assertSession()->pageTextNotContains($title);
// Confirm that the block is not displayed to anonymous users.
$this->drupalLogout();
$this->drupalGet('');
$this->assertNoText($title);
$this->assertSession()->pageTextNotContains($title);
}
/**
......@@ -235,7 +235,7 @@ public function testBlock() {
// Confirm that the block instance title and markup are not displayed.
$this->drupalGet('node');
$this->assertNoText($block['settings[label]']);
$this->assertSession()->pageTextNotContains($block['settings[label]']);
// Check for <div id="block-my-block-instance-name"> if the machine name
// is my_block_instance_name.
$xpath = $this->assertSession()->buildXPathQuery('//div[@id=:id]/*', [':id' => 'block-' . str_replace('_', '-', strtolower($block['id']))]);
......@@ -324,7 +324,7 @@ public function testHideBlockTitle() {
// Confirm that the block is not displayed by default.
$this->drupalGet('user');
$this->assertNoText($title);
$this->assertSession()->pageTextNotContains($title);
$edit = [
'settings[label_display]' => TRUE,
......@@ -532,7 +532,7 @@ public function testBlockAccess() {
$this->drupalPlaceBlock('test_access', ['region' => 'help']);
$this->drupalGet('<front>');
$this->assertNoText('Hello test world');
$this->assertSession()->pageTextNotContains('Hello test world');
\Drupal::state()->set('test_block_access', TRUE);
$this->drupalGet('<front>');
......
......@@ -216,7 +216,7 @@ public function testContextAwareUnsatisfiedBlocks() {
public function testContextAwareBlocks() {
$expected_text = '<div id="test_context_aware--username">' . \Drupal::currentUser()->getAccountName() . '</div>';
$this->drupalGet('');
$this->assertNoText('Test context-aware block');
$this->assertSession()->pageTextNotContains('Test context-aware block');
$this->assertNoRaw($expected_text);
$block_url = 'admin/structure/block/add/test_context_aware/classy';
......@@ -260,7 +260,7 @@ public function testContextAwareBlocks() {
$this->submitForm($edit, 'Save block');
$this->drupalGet('');
$this->assertSession()->pageTextContains('No context mapping selected.');
$this->assertNoText('User context found.');
$this->assertSession()->pageTextNotContains('User context found.');
// Tests that conditions with missing context are not displayed.
$this->drupalGet('admin/structure/block/manage/testcontextawareblock');
......
......@@ -285,7 +285,7 @@ public function testBlockDelete() {
// Show the delete confirm form.
$this->drupalGet('block/3/delete');
$this->assertNoText('This will also remove');
$this->assertSession()->pageTextNotContains('This will also remove');
}
/**
......
......@@ -98,7 +98,7 @@ public function testRevisions() {
// Confirm that revision body text is not present on default version of
// block.
$this->drupalGet('block/' . $loaded->id());
$this->assertNoText($loaded->body->value);
$this->assertSession()->pageTextNotContains($loaded->body->value);
// Verify that the non-default revision id is greater than the default
// revision id.
......
......@@ -178,7 +178,7 @@ public function testBlockContentTypeDeletion() {
$this->assertRaw(
t('%label is used by 1 custom block on your site. You can not remove this block type until you have removed all of the %label blocks.', ['%label' => $type->label()])
);
$this->assertNoText('This action cannot be undone.');
$this->assertSession()->pageTextNotContains('This action cannot be undone.');
// Delete the block.
$block->delete();
......
......@@ -310,7 +310,7 @@ public function testBookNavigationBlock() {
// Link to book root.
$this->assertSession()->pageTextContains($this->book->label());
// No links to individual book pages.
$this->assertNoText($nodes[0]->label());
$this->assertSession()->pageTextNotContains($nodes[0]->label());
// Ensure that an unpublished node does not appear in the navigation for a
// user without access. By unpublishing a parent page, child pages should
......@@ -419,7 +419,7 @@ public function testNavigationBlockOnAccessModuleInstalled() {
// Test the 'book pages' block_mode setting.
$this->drupalGet('<front>');
$this->assertNoText($block->label());
$this->assertSession()->pageTextNotContains($block->label());
}
/**
......
......@@ -116,7 +116,7 @@ public function testApprovalAdminInterface() {
$this->assertSession()->pageTextContains(Html::escape($this->node->label()));
$this->node->setUnpublished()->save();
$this->drupalGet('admin/content/comment');
$this->assertNoText(Html::escape($this->node->label()));
$this->assertSession()->pageTextNotContains(Html::escape($this->node->label()));
}
/**
......
......@@ -60,7 +60,7 @@ public function testRecentCommentBlock() {
$this->drupalLogout();
user_role_revoke_permissions(RoleInterface::ANONYMOUS_ID, ['access comments']);
$this->drupalGet('');
$this->assertNoText('Recent comments');
$this->assertSession()->pageTextNotContains('Recent comments');
user_role_grant_permissions(RoleInterface::ANONYMOUS_ID, ['access comments']);
// Test that a user with the 'access comments' permission can see the
......@@ -70,7 +70,7 @@ public function testRecentCommentBlock() {
$this->assertSession()->pageTextContains('Recent comments');
// Test the only the 10 latest comments are shown and in the proper order.
$this->assertNoText($comments[10]->getSubject());
$this->assertSession()->pageTextNotContains($comments[10]->getSubject());
for ($i = 0; $i < 10; $i++) {
$this->assertSession()->pageTextContains($comments[$i]->getSubject());
if ($i > 1) {
......
......@@ -81,7 +81,7 @@ public function testBookCommentPrint() {
$this->assertSession()->pageTextContains($comment_subject);
$this->assertSession()->pageTextContains($comment_body);
$this->assertNoText('Add new comment');
$this->assertSession()->pageTextNotContains('Add new comment');
// Verify that the comment form subject field is not found.
$this->assertSession()->fieldNotExists('subject[0][value]');
}
......
......@@ -183,7 +183,7 @@ public function testCommentFieldCreate() {
$this->drupalGet('admin/config/people/accounts/fields/user.user.field_user_comment/storage');
$this->submitForm($edit, 'Save field settings');
// We shouldn't get an error message.
$this->assertNoText('An illegal choice has been detected. Please contact the site administrator.');
$this->assertSession()->pageTextNotContains('An illegal choice has been detected. Please contact the site administrator.');
}
/**
......
......@@ -198,7 +198,7 @@ public function testCommentInterface() {
$this->node = $this->drupalCreateNode(['type' => 'article', 'promote' => 1, 'comment' => [['status' => CommentItemInterface::OPEN]]]);
$this->assertNotNull($this->node, 'Article node created.');
$this->drupalGet('comment/reply/node/' . $this->node->id() . '/comment');
$this->assertNoText('This discussion is closed');
$this->assertSession()->pageTextNotContains('This discussion is closed');
// Ensure that the comment body field exists.
$this->assertSession()->fieldExists('edit-comment-body-0-value');
......
......@@ -341,7 +341,7 @@ public function testCommentFunctionality() {
]);
$this->drupalLogin($limited_user);
$this->drupalGet('admin/content/comment');
$this->assertNoText($this->entity->label());
$this->assertSession()->pageTextNotContains($this->entity->label());
$this->drupalLogout();
......@@ -396,7 +396,7 @@ public function testCommentFunctionality() {
$this->drupalGet('comment/reply/entity_test/' . $this->entity->id() . '/comment/' . $comment1->id());
$this->assertSession()->statusCodeEquals(403);
$this->assertNoText($comment1->getSubject());
$this->assertSession()->pageTextNotContains($comment1->getSubject());
// Test comment field widget changes.
$limited_user = $this->drupalCreateUser([
......
......@@ -344,7 +344,7 @@ public function testTwoPagers() {
$this->drupalLogin($account);
$this->drupalGet('admin/structure/types/manage/article/display');
// No summary for standard pager.
$this->assertNoText('Pager ID: 0');
$this->assertSession()->pageTextNotContains('Pager ID: 0');
$this->assertSession()->pageTextContains('Pager ID: 1');
$this->submitForm([], 'comment_settings_edit');
// Change default pager to 2.
......@@ -354,7 +354,7 @@ public function testTwoPagers() {
$this->submitForm([], 'comment_settings_edit');
$this->submitForm(['fields[comment][settings_edit_form][settings][pager_id]' => 0], 'Save');
// No summary for standard pager.
$this->assertNoText('Pager ID: 0');
$this->assertSession()->pageTextNotContains('Pager ID: 0');
$this->drupalLogin($this->adminUser);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment