Issue #3159788 by mondrake, ravi.shankar, narendra.rajwar27, longwave, Hardik_Patel_12, ankithashetty, sarvjeetsingh, kishor_kolekar: AssertLegacyTrait::assert(No)Text() in functional tests still have a message passed in

merge-requests/243/head
catch 2021-01-11 10:24:10 +00:00
parent 00b0a6edd5
commit 9ac7689b1a
192 changed files with 1231 additions and 1062 deletions

View File

@ -52,8 +52,9 @@ class ConfigurationTest extends BrowserTestBase {
$action_id = $edit['id'];
// Make sure that the new complex action was saved properly.
$this->assertText('The action has been successfully saved.', "Make sure we get a confirmation that we've successfully saved the complex action.");
$this->assertText($action_label, "Make sure the action label appears on the configuration page after we've saved the complex action.");
$this->assertText('The action has been successfully saved.');
// The action label appears on the configuration page.
$this->assertText($action_label);
// Make another POST request to the action edit page.
$this->clickLink(t('Configure'));
@ -66,9 +67,12 @@ class ConfigurationTest extends BrowserTestBase {
$this->assertSession()->statusCodeEquals(200);
// Make sure that the action updated properly.
$this->assertText('The action has been successfully saved.', "Make sure we get a confirmation that we've successfully updated the complex action.");
$this->assertNoText($action_label, "Make sure the old action label does NOT appear on the configuration page after we've updated the complex action.");
$this->assertText($new_action_label, "Make sure the action label appears on the configuration page after we've updated the complex action.");
$this->assertText('The action has been successfully saved.');
// The old action label does NOT appear on the configuration page.
$this->assertNoText($action_label);
// The action label appears on the configuration page after we've updated
// the complex action.
$this->assertText($new_action_label);
$this->clickLink(t('Configure'));
$element = $this->xpath('//input[@type="text" and @value="admin"]');
@ -86,7 +90,8 @@ class ConfigurationTest extends BrowserTestBase {
$this->assertRaw(t('The action %action has been deleted.', ['%action' => $new_action_label]));
$this->drupalGet('admin/config/system/actions');
$this->assertSession()->statusCodeEquals(200);
$this->assertNoText($new_action_label, "Make sure the action label does not appear on the overview page after we've deleted the action.");
// The action label does not appear on the overview page.
$this->assertNoText($new_action_label);
$action = Action::load($action_id);
$this->assertNull($action, 'Make sure the action is gone after being deleted.');

View File

@ -36,7 +36,8 @@ class AddFeedTest extends AggregatorTestBase {
// Check feed source.
$this->drupalGet('aggregator/sources/' . $feed->id());
$this->assertSession()->statusCodeEquals(200);
$this->assertText($feed->label(), 'Page title');
// Verify that the feed label is present in the page title.
$this->assertText($feed->label());
$this->assertRaw($feed->getWebsiteUrl());
// Try to add a duplicate.
@ -92,7 +93,8 @@ class AddFeedTest extends AggregatorTestBase {
// Check feed source.
$this->drupalGet('aggregator/sources/' . $feed->id());
$this->assertSession()->statusCodeEquals(200);
$this->assertText($feed->label(), 'Page title');
// Verify that the feed label is present in the page title.
$this->assertText($feed->label());
// Delete feeds.
$this->deleteFeed($feed);

View File

@ -56,7 +56,7 @@ class AggregatorRenderingTest extends AggregatorTestBase {
// Confirm that the block is now being displayed on pages.
$this->drupalGet('test-page');
$this->assertText($block->label(), 'Feed block is displayed on the page.');
$this->assertText($block->label());
// Confirm items appear as links.
$items = $this->container->get('entity_type.manager')->getStorage('aggregator_item')->loadByFeed($feed->id(), 1);
@ -80,7 +80,7 @@ class AggregatorRenderingTest extends AggregatorTestBase {
$block->save();
// Check that the block is no longer displayed.
$this->drupalGet('test-page');
$this->assertNoText($block->label(), 'Feed block is not displayed on the page when number of items is set to 0.');
$this->assertNoText($block->label());
}
/**

View File

@ -75,7 +75,7 @@ abstract class AggregatorTestBase extends BrowserTestBase {
public function createFeed($feed_url = NULL, array $edit = []) {
$edit = $this->getFeedEditArray($feed_url, $edit);
$this->drupalPostForm('aggregator/sources/add', $edit, 'Save');
$this->assertText('The feed ' . Html::escape($edit['title[0][value]']) . ' has been added.', new FormattableMarkup('The feed @name has been added.', ['@name' => $edit['title[0][value]']]));
$this->assertText('The feed ' . Html::escape($edit['title[0][value]']) . ' has been added.');
// Verify that the creation message contains a link to a feed.
$this->assertSession()->elementExists('xpath', '//div[@data-drupal-messages]//a[contains(@href, "aggregator/sources/")]');

View File

@ -26,20 +26,20 @@ class FeedAdminDisplayTest extends AggregatorTestBase {
// The scheduled feed shows that it has not been updated yet and is
// scheduled.
$this->assertText('never', 'The scheduled feed has not been updated yet. Last update shows "never".');
$this->assertText('imminently', 'The scheduled feed has not been updated yet. Next update shows "imminently".');
$this->assertNoText('ago', 'The scheduled feed has not been updated yet. Last update does not show "x x ago".');
$this->assertNoText('left', 'The scheduled feed has not been updated yet. Next update does not show "x x left".');
$this->assertText('never');
$this->assertText('imminently');
$this->assertNoText('ago');
$this->assertNoText('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', 'The scheduled feed has been updated. Last updated changed.');
$this->assertNoText('imminently', 'The scheduled feed has been updated. Next update changed.');
$this->assertText('ago', 'The scheduled feed been updated. Last update shows "x x ago".');
$this->assertText('left', 'The scheduled feed has been updated. Next update shows "x x left".');
$this->assertNoText('never');
$this->assertNoText('imminently');
$this->assertText('ago');
$this->assertText('left');
// Delete scheduled feed.
$this->deleteFeed($scheduled_feed);
@ -49,20 +49,20 @@ class FeedAdminDisplayTest extends AggregatorTestBase {
$this->drupalGet('admin/config/services/aggregator');
// The non scheduled feed shows that it has not been updated yet.
$this->assertText('never', 'The non scheduled feed has not been updated yet. Last update shows "never".');
$this->assertNoText('imminently', 'The non scheduled feed does not show "imminently" as next update.');
$this->assertNoText('ago', 'The non scheduled feed has not been updated. It does not show "x x ago" as last update.');
$this->assertNoText('left', 'The feed is not scheduled. It does not show a timeframe "x x left" for next update.');
$this->assertText('never');
$this->assertNoText('imminently');
$this->assertNoText('ago');
$this->assertNoText('left');
$this->updateFeedItems($non_scheduled_feed);
$this->drupalGet('admin/config/services/aggregator');
// After the feed update, we still need to see "never" as next update label.
// Last update will show an interval.
$this->assertNoText('imminently', 'The updated non scheduled feed does not show "imminently" as next update.');
$this->assertText('never', 'The updated non scheduled feed still shows "never" as next update.');
$this->assertText('ago', 'The non scheduled feed has been updated. It shows "x x ago" as last update.');
$this->assertNoText('left', 'The feed is not scheduled. It does not show a timeframe "x x left" for next update.');
$this->assertText('never');
$this->assertNoText('imminently');
$this->assertText('ago');
$this->assertNoText('left');
}
/**

View File

@ -46,7 +46,7 @@ class ImportOpmlTest extends AggregatorTestBase {
$this->drupalPlaceBlock('help_block', ['region' => 'help']);
$this->drupalGet('admin/config/services/aggregator/add/opml');
$this->assertText('A single OPML document may contain many feeds.', 'Found OPML help text.');
$this->assertText('A single OPML document may contain many feeds.');
// Ensure that the file upload, remote URL, and refresh fields exist.
$this->assertSession()->fieldExists('files[upload]');
$this->assertSession()->fieldExists('remote');
@ -72,9 +72,10 @@ class ImportOpmlTest extends AggregatorTestBase {
$this->drupalPostForm('admin/config/services/aggregator/add/opml', $edit, 'Import');
$this->assertRaw(t('<em>Either</em> upload a file or enter a URL.'));
// Error if the URL is invalid.
$edit = ['remote' => 'invalidUrl://empty'];
$this->drupalPostForm('admin/config/services/aggregator/add/opml', $edit, 'Import');
$this->assertText('The URL invalidUrl://empty is not valid.', 'Error if the URL is invalid.');
$this->assertText('The URL invalidUrl://empty is not valid.');
$after = $count_query->execute();
$this->assertEqual($before, $after, 'No feeds were added during the three last form submissions.');
@ -87,13 +88,15 @@ class ImportOpmlTest extends AggregatorTestBase {
$count_query = \Drupal::entityQuery('aggregator_feed')->count();
$before = $count_query->execute();
// Attempting to upload invalid XML.
$form['files[upload]'] = $this->getInvalidOpml();
$this->drupalPostForm('admin/config/services/aggregator/add/opml', $form, 'Import');
$this->assertText('No new feed has been added.', 'Attempting to upload invalid XML.');
$this->assertText('No new feed has been added.');
// Attempting to load empty OPML from remote URL
$edit = ['remote' => file_create_url($this->getEmptyOpml())];
$this->drupalPostForm('admin/config/services/aggregator/add/opml', $edit, 'Import');
$this->assertText('No new feed has been added.', 'Attempting to load empty OPML from remote URL.');
$this->assertText('No new feed has been added.');
$after = $count_query->execute();
$this->assertEqual($before, $after, 'No feeds were added during the two last form submissions.');

View File

@ -44,7 +44,7 @@ class UpdateFeedItemTest extends AggregatorTestBase {
$this->assertSession()->statusCodeEquals(200);
$this->drupalPostForm('aggregator/sources/add', $edit, 'Save');
$this->assertText('The feed ' . $edit['title[0][value]'] . ' has been added.', new FormattableMarkup('The feed @name has been added.', ['@name' => $edit['title[0][value]']]));
$this->assertText('The feed ' . $edit['title[0][value]'] . ' has been added.');
// Verify that the creation message contains a link to a feed.
$this->assertSession()->elementExists('xpath', '//div[@data-drupal-messages]//a[contains(@href, "aggregator/sources/")]');

View File

@ -2,8 +2,6 @@
namespace Drupal\Tests\aggregator\Functional;
use Drupal\Component\Render\FormattableMarkup;
/**
* Update feed test.
*
@ -32,7 +30,7 @@ class UpdateFeedTest extends AggregatorTestBase {
$edit[$same_field] = $feed->{$same_field}->value;
}
$this->drupalPostForm('aggregator/sources/' . $feed->id() . '/configure', $edit, 'Save');
$this->assertText('The feed ' . $edit['title[0][value]'] . ' has been updated.', new FormattableMarkup('The feed %name has been updated.', ['%name' => $edit['title[0][value]']]));
$this->assertText('The feed ' . $edit['title[0][value]'] . ' has been updated.');
// Verify that the creation message contains a link to a feed.
$this->assertSession()->elementExists('xpath', '//div[@data-drupal-messages]//a[contains(@href, "aggregator/sources/")]');
@ -41,10 +39,10 @@ class UpdateFeedTest extends AggregatorTestBase {
$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.
// Check feed source, the title should be on the page.
$this->drupalGet('aggregator/sources/' . $feed->id());
$this->assertSession()->statusCodeEquals(200);
$this->assertText($edit['title[0][value]'], 'Page title');
$this->assertText($edit['title[0][value]']);
// Set correct title so deleteFeed() will work.
$feed->title = $edit['title[0][value]'];

View File

@ -48,7 +48,7 @@ class BasicAuthTest extends BrowserTestBase {
// Ensure we can log in with valid authentication details.
$this->basicAuthGet($url, $account->getAccountName(), $account->pass_raw);
$this->assertText($account->getAccountName(), 'Account name is displayed.');
$this->assertText($account->getAccountName());
$this->assertSession()->statusCodeEquals(200);
$this->mink->resetSessions();
$this->assertSession()->responseHeaderDoesNotExist('X-Drupal-Cache');
@ -57,7 +57,7 @@ class BasicAuthTest extends BrowserTestBase {
// Ensure that invalid authentication details give access denied.
$this->basicAuthGet($url, $account->getAccountName(), $this->randomMachineName());
$this->assertNoText($account->getAccountName(), 'Bad basic auth credentials do not authenticate the user.');
$this->assertNoText($account->getAccountName());
$this->assertSession()->statusCodeEquals(403);
$this->mink->resetSessions();
@ -164,7 +164,7 @@ class BasicAuthTest extends BrowserTestBase {
$url = Url::fromRoute('router_test.11');
$this->basicAuthGet($url, $account->getAccountName(), $account->pass_raw);
$this->assertText($account->getAccountName(), 'Account name is displayed.');
$this->assertText($account->getAccountName());
$this->assertSession()->statusCodeEquals(200);
}
@ -175,27 +175,31 @@ class BasicAuthTest extends BrowserTestBase {
$account = $this->drupalCreateUser();
$url = Url::fromRoute('router_test.11');
// Case when no credentials are passed.
// Case when no credentials are passed, a user friendly access
// unauthorized message is displayed.
$this->drupalGet($url);
$this->assertSession()->statusCodeEquals(401);
$this->assertNoText('Exception', "No raw exception is displayed on the page.");
$this->assertText('Please log in to access this page.', "A user friendly access unauthorized message is displayed.");
$this->assertNoText('Exception');
$this->assertText('Please log in to access this page.');
// Case when empty credentials are passed.
// Case when empty credentials are passed, a user friendly access denied
// message is displayed.
$this->basicAuthGet($url, NULL, NULL);
$this->assertSession()->statusCodeEquals(403);
$this->assertText('Access denied', "A user friendly access denied message is displayed");
$this->assertText('Access denied');
// Case when wrong credentials are passed.
// Case when wrong credentials are passed, a user friendly access denied
// message is displayed.
$this->basicAuthGet($url, $account->getAccountName(), $this->randomMachineName());
$this->assertSession()->statusCodeEquals(403);
$this->assertText('Access denied', "A user friendly access denied message is displayed");
$this->assertText('Access denied');
// Case when correct credentials but hasn't access to the route.
// Case when correct credentials but hasn't access to the route, an user
// friendly access denied message is displayed.
$url = Url::fromRoute('router_test.15');
$this->basicAuthGet($url, $account->getAccountName(), $account->pass_raw);
$this->assertSession()->statusCodeEquals(403);
$this->assertText('Access denied', "A user friendly access denied message is displayed");
$this->assertText('Access denied');
}
/**

View File

@ -85,20 +85,21 @@ class BlockCacheTest extends BrowserTestBase {
\Drupal::state()->set('block_test.content', $current_content);
$this->drupalLogin($this->normalUser);
$this->drupalGet('');
$this->assertText($current_content, 'Block content displays.');
$this->assertText($current_content);
// Change the content, but the cached copy should still be served.
$old_content = $current_content;
$current_content = $this->randomMachineName();
\Drupal::state()->set('block_test.content', $current_content);
$this->drupalGet('');
$this->assertText($old_content, 'Block is served from the cache.');
$this->assertText($old_content);
// Clear the cache and verify that the stale data is no longer there.
Cache::invalidateTags(['block_view']);
$this->drupalGet('');
$this->assertNoText($old_content, 'Block cache clear removes stale cache data.');
$this->assertText($current_content, 'Fresh block content is displayed after clearing the cache.');
$this->assertNoText($old_content);
// Fresh block content is displayed after clearing the cache.
$this->assertText($current_content);
// Test whether the cached data is served for the correct users.
$old_content = $current_content;
@ -106,19 +107,23 @@ class BlockCacheTest extends BrowserTestBase {
\Drupal::state()->set('block_test.content', $current_content);
$this->drupalLogout();
$this->drupalGet('');
$this->assertNoText($old_content, 'Anonymous user does not see content cached per-role for normal user.');
// Anonymous user does not see content cached per-role for normal user.
$this->assertNoText($old_content);
// User with the same roles sees per-role cached content.
$this->drupalLogin($this->normalUserAlt);
$this->drupalGet('');
$this->assertText($old_content, 'User with the same roles sees per-role cached content.');
$this->assertText($old_content);
// Admin user does not see content cached per-role for normal user.
$this->drupalLogin($this->adminUser);
$this->drupalGet('');
$this->assertNoText($old_content, 'Admin user does not see content cached per-role for normal user.');
$this->assertNoText($old_content);
// Block is served from the per-role cache.
$this->drupalLogin($this->normalUser);
$this->drupalGet('');
$this->assertText($old_content, 'Block is served from the per-role cache.');
$this->assertText($old_content);
}
/**
@ -133,18 +138,20 @@ class BlockCacheTest extends BrowserTestBase {
\Drupal::state()->set('block_test.content', $current_content);
$this->drupalGet('');
$this->assertText($current_content, 'Block content displays.');
$this->assertText($current_content);
$old_content = $current_content;
$current_content = $this->randomMachineName();
\Drupal::state()->set('block_test.content', $current_content);
// Block content served from cache.
$this->drupalGet('user');
$this->assertText($old_content, 'Block content served from cache.');
$this->assertText($old_content);
// Block content not served from cache.
$this->drupalLogout();
$this->drupalGet('user');
$this->assertText($current_content, 'Block content not served from cache.');
$this->assertText($current_content);
}
/**
@ -158,13 +165,14 @@ class BlockCacheTest extends BrowserTestBase {
// If max_age = 0 has no effect, the next request would be cached.
$this->drupalGet('');
$this->assertText($current_content, 'Block content displays.');
$this->assertText($current_content);
// A cached copy should not be served.
$current_content = $this->randomMachineName();
\Drupal::state()->set('block_test.content', $current_content);
$this->drupalGet('');
$this->assertText($current_content, 'Maximum age of zero prevents blocks from being cached.');
// Maximum age of zero prevents blocks from being cached.
$this->assertText($current_content);
}
/**
@ -178,22 +186,25 @@ class BlockCacheTest extends BrowserTestBase {
$this->drupalLogin($this->normalUser);
$this->drupalGet('');
$this->assertText($current_content, 'Block content displays.');
$this->assertText($current_content);
$old_content = $current_content;
$current_content = $this->randomMachineName();
\Drupal::state()->set('block_test.content', $current_content);
// Block is served from per-user cache.
$this->drupalGet('');
$this->assertText($old_content, 'Block is served from per-user cache.');
$this->assertText($old_content);
// Per-user block cache is not served for other users.
$this->drupalLogin($this->normalUserAlt);
$this->drupalGet('');
$this->assertText($current_content, 'Per-user block cache is not served for other users.');
$this->assertText($current_content);
// Per-user block cache is persistent.
$this->drupalLogin($this->normalUser);
$this->drupalGet('');
$this->assertText($old_content, 'Per-user block cache is persistent.');
$this->assertText($old_content);
}
/**
@ -206,7 +217,7 @@ class BlockCacheTest extends BrowserTestBase {
\Drupal::state()->set('block_test.content', $current_content);
$this->drupalGet('test-page');
$this->assertText($current_content, 'Block content displays on the test page.');
$this->assertText($current_content);
$old_content = $current_content;
$current_content = $this->randomMachineName();
@ -214,10 +225,13 @@ class BlockCacheTest extends BrowserTestBase {
$this->drupalGet('user');
$this->assertSession()->statusCodeEquals(200);
$this->assertNoText($old_content, 'Block content cached for the test page does not show up for the user page.');
// Verify that block content cached for the test page does not show up
// for the user page.
$this->assertNoText($old_content);
$this->drupalGet('test-page');
$this->assertSession()->statusCodeEquals(200);
$this->assertText($old_content, 'Block content cached for the test page.');
// Verify that the block content is cached for the test page.
$this->assertText($old_content);
}
}

View File

@ -43,7 +43,7 @@ class BlockFormInBlockTest extends BrowserTestBase {
// Go to "test-page" and test if the block is enabled.
$this->drupalGet('test-page');
$this->assertSession()->statusCodeEquals(200);
$this->assertText('Your .com email address.', 'form found');
$this->assertText('Your .com email address.');
// Make sure that we're currently still on /test-page after submitting the
// form.
@ -54,7 +54,7 @@ class BlockFormInBlockTest extends BrowserTestBase {
// Go to a different page and see if the block is enabled there as well.
$this->drupalGet('test-render-title');
$this->assertSession()->statusCodeEquals(200);
$this->assertText('Your .com email address.', 'form found');
$this->assertText('Your .com email address.');
// Make sure that submitting the form didn't redirect us to the first page
// we submitted the form from after submitting the form from
@ -71,7 +71,7 @@ class BlockFormInBlockTest extends BrowserTestBase {
$this->drupalGet('test-multiple-forms');
$placeholder = 'form_action_' . Crypt::hashBase64('Drupal\Core\Form\FormBuilder::prepareForm');
$this->assertText('Form action: ' . $placeholder, 'placeholder found.');
$this->assertText('Form action: ' . $placeholder);
}
}

View File

@ -52,7 +52,7 @@ class BlockHiddenRegionTest extends BrowserTestBase {
// Ensure that the search form block is displayed.
$this->drupalGet('');
$this->assertText('Search', 'Block was displayed on the front page.');
$this->assertText('Search');
// Install "block_test_theme" and set it as the default theme.
$theme = 'block_test_theme';
@ -72,7 +72,7 @@ class BlockHiddenRegionTest extends BrowserTestBase {
// Ensure that the search form block is displayed.
$this->drupalGet('');
$this->assertText('Search', 'Block was displayed on the front page.');
$this->assertText('Search');
}
}

View File

@ -44,7 +44,9 @@ class BlockLanguageTest extends BrowserTestBase {
'predefined_langcode' => 'fr',
];
$this->drupalPostForm('admin/config/regional/language/add', $edit, 'Add language');
$this->assertText('French', 'Language added successfully.');
// Verify that language was added successfully.
$this->assertText('French');
}
/**
@ -75,11 +77,11 @@ class BlockLanguageTest extends BrowserTestBase {
// Check that a page has a block.
$this->drupalGet('en');
$this->assertText('Powered by Drupal', 'The body of the custom block appears on the page.');
$this->assertText('Powered by Drupal');
// Check that a page doesn't has a block for the current language anymore.
$this->drupalGet('fr');
$this->assertNoText('Powered by Drupal', 'The body of the custom block does not appear on the page.');
$this->assertNoText('Powered by Drupal');
}
/**
@ -154,9 +156,9 @@ class BlockLanguageTest extends BrowserTestBase {
// Interface negotiation depends on request arguments.
$this->drupalGet('node', ['query' => ['language' => 'en']]);
$this->assertNoText('Powered by Drupal', 'The body of the block does not appear on the page.');
$this->assertNoText('Powered by Drupal');
$this->drupalGet('node', ['query' => ['language' => 'fr']]);
$this->assertText('Powered by Drupal', 'The body of the block appears on the page.');
$this->assertText('Powered by Drupal');
// Log in again in order to clear the interface language stored in the
// session.
@ -166,9 +168,9 @@ class BlockLanguageTest extends BrowserTestBase {
// 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', 'The body of the block does not appear on the page.');
$this->assertNoText('Powered by Drupal');
$this->drupalGet('fr');
$this->assertNoText('Powered by Drupal', 'The body of the block does not appear on the page.');
$this->assertNoText('Powered by Drupal');
// Change visibility to now depend on content language for this block.
$edit = [
@ -179,15 +181,15 @@ class BlockLanguageTest extends BrowserTestBase {
// 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', 'The body of the block does not appear on the page.');
$this->assertNoText('Powered by Drupal');
$this->drupalGet('node', ['query' => ['language' => 'fr']]);
$this->assertNoText('Powered by Drupal', 'The body of the block does not appear on the page.');
$this->assertNoText('Powered by Drupal');
// Content language negotiation depends on path prefix.
$this->drupalGet('en');
$this->assertNoText('Powered by Drupal', 'The body of the block does not appear on the page.');
$this->assertNoText('Powered by Drupal');
$this->drupalGet('fr');
$this->assertText('Powered by Drupal', 'The body of the block appears on the page.');
$this->assertText('Powered by Drupal');
}
}

View File

@ -2,7 +2,6 @@
namespace Drupal\Tests\block\Functional;
use Drupal\Component\Render\FormattableMarkup;
use Drupal\Component\Utility\Html;
use Drupal\block\Entity\Block;
use Drupal\Core\Url;
@ -45,24 +44,27 @@ class BlockTest extends BlockTestBase {
$this->assertSession()->checkboxChecked('edit-visibility-request-path-negate-0');
$this->submitForm($edit, 'Save block');
$this->assertText('The block configuration has been saved.', 'Block was saved');
$this->assertText('The block configuration has been saved.');
$this->clickLink('Configure');
$this->assertSession()->checkboxChecked('edit-visibility-request-path-negate-1');
// Confirm that the block is displayed on the front page.
$this->drupalGet('');
$this->assertText($title, 'Block was displayed on the front page.');
$this->assertText($title);
// Confirm that the block is not displayed according to block visibility
// rules.
$this->drupalGet('user');
$this->assertNoText($title, 'Block was not displayed according to block visibility rules.');
$this->assertNoText($title);
// Confirm that the block is not displayed to anonymous users.
$this->drupalLogout();
$this->drupalGet('');
$this->assertNoText($title, 'Block was not displayed to anonymous users.');
$this->assertNoText($title);
// Confirm that an empty block is not displayed.
$this->assertNoText('Powered by Drupal', 'Empty block not displayed.');
$this->assertNoText('Powered by Drupal');
$this->assertNoRaw('sidebar-first');
}
@ -120,18 +122,22 @@ class BlockTest extends BlockTestBase {
// Set the block to be hidden on any user path, and to be shown only to
// authenticated users.
$this->drupalPostForm('admin/structure/block/add/' . $block_name . '/' . $default_theme, $edit, 'Save block');
$this->assertText('The block configuration has been saved.', 'Block was saved');
$this->assertText('The block configuration has been saved.');
// Confirm that block was not displayed according to block visibility
// rules.
$this->drupalGet('user');
$this->assertNoText($title, 'Block was not displayed according to block visibility rules.');
$this->assertNoText($title);
// Confirm that block was not displayed according to block visibility
// rules regardless of path case.
$this->drupalGet('USER');
$this->assertNoText($title, 'Block was not displayed according to block visibility rules regardless of path case.');
$this->assertNoText($title);
// Confirm that the block is not displayed to anonymous users.
$this->drupalLogout();
$this->drupalGet('');
$this->assertNoText($title, 'Block was not displayed to anonymous users on the front page.');
$this->assertNoText($title);
}
/**
@ -200,7 +206,7 @@ class BlockTest extends BlockTestBase {
// Set block title to confirm that interface works and override any custom titles.
$this->drupalPostForm('admin/structure/block/add/' . $block['id'] . '/' . $block['theme'], ['settings[label]' => $block['settings[label]'], 'settings[label_display]' => $block['settings[label_display]'], 'id' => $block['id'], 'region' => $block['region']], 'Save block');
$this->assertText('The block configuration has been saved.', 'Block title set.');
$this->assertText('The block configuration has been saved.');
// Check to see if the block was created by checking its configuration.
$instance = Block::load($block['id']);
@ -216,7 +222,7 @@ class BlockTest extends BlockTestBase {
$this->clickLink('Disable');
// Confirm that the block is now listed as disabled.
$this->assertText('The block settings have been updated.', 'Block successfully moved to disabled region.');
$this->assertText('The block settings have been updated.');
// Confirm that the block instance title and markup are not displayed.
$this->drupalGet('node');
@ -303,22 +309,24 @@ class BlockTest extends BlockTestBase {
'settings[label]' => $title,
];
$this->drupalPostForm('admin/structure/block/add/' . $block_name . '/' . $default_theme, $edit, 'Save block');
$this->assertText('The block configuration has been saved.', 'Block was saved');
$this->assertText('The block configuration has been saved.');
// Confirm that the block is not displayed by default.
$this->drupalGet('user');
$this->assertNoText($title, 'Block title was not displayed by default.');
$this->assertNoText($title);
$edit = [
'settings[label_display]' => TRUE,
];
$this->drupalPostForm('admin/structure/block/manage/' . $id, $edit, 'Save block');
$this->assertText('The block configuration has been saved.', 'Block was saved');
$this->assertText('The block configuration has been saved.');
$this->drupalGet('admin/structure/block/manage/' . $id);
$this->assertSession()->checkboxChecked('edit-settings-label-display');
// Confirm that the block is displayed when enabled.
$this->drupalGet('user');
$this->assertText($title, 'Block title was displayed when enabled.');
$this->assertText($title);
}
/**
@ -341,11 +349,11 @@ class BlockTest extends BlockTestBase {
$this->drupalPostForm('admin/structure/block', $edit, 'Save blocks');
// Confirm that the block was moved to the proper region.
$this->assertText('The block settings have been updated.', new FormattableMarkup('Block successfully moved to %region_name region.', ['%region_name' => $region]));
$this->assertText('The block settings have been updated.');
// Confirm that the block is being displayed.
$this->drupalGet('');
$this->assertText($block['settings[label]'], 'Block successfully being displayed on the page.');
$this->assertText($block['settings[label]']);
// Confirm that the custom block was found at the proper region.
$xpath = $this->assertSession()->buildXPathQuery('//div[@class=:region-class]//div[@id=:block-id]/*', [

View File

@ -97,8 +97,10 @@ class BlockContentRevisionsTest extends BlockContentTestBase {
$loaded->body = $this->randomMachineName(8);
$loaded->save();
// Confirm that revision body text is not present on default version of
// block.
$this->drupalGet('block/' . $loaded->id());
$this->assertNoText($loaded->body->value, 'Revision body text is not present on default version of block.');
$this->assertNoText($loaded->body->value);
// Verify that the non-default revision id is greater than the default
// revision id.

View File

@ -165,7 +165,7 @@ class BlockContentTypeTest extends BlockContentTestBase {
$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.', 'The block type deletion confirmation form is not available.');
$this->assertNoText('This action cannot be undone.');
// Delete the block.
$block->delete();
@ -174,7 +174,7 @@ class BlockContentTypeTest extends BlockContentTestBase {
$this->assertRaw(
t('Are you sure you want to delete the custom block type %type?', ['%type' => $type->id()])
);
$this->assertText('This action cannot be undone.', 'The custom block type deletion confirmation form is available.');
$this->assertText('This action cannot be undone.');
}
/**

View File

@ -2,7 +2,6 @@
namespace Drupal\Tests\book\Functional;
use Drupal\Component\Render\FormattableMarkup;
use Drupal\Core\Cache\Cache;
use Drupal\Tests\BrowserTestBase;
use Drupal\user\RoleInterface;
@ -254,7 +253,7 @@ class BookTest extends BrowserTestBase {
// Make sure each part of the book is there.
foreach ($nodes as $node) {
$this->assertText($node->label(), 'Node title found in printer friendly version.');
$this->assertText($node->label());
$this->assertRaw($node->body->processed);
}
@ -298,14 +297,17 @@ class BookTest extends BrowserTestBase {
$edit = [];
$edit[RoleInterface::ANONYMOUS_ID . '[node test view]'] = TRUE;
$this->drupalPostForm('admin/people/permissions/' . RoleInterface::ANONYMOUS_ID, $edit, 'Save permissions');
$this->assertText('The changes have been saved.', "Permission 'node test view' successfully assigned to anonymous users.");
$this->assertText('The changes have been saved.');
// Test correct display of the block.
$nodes = $this->createBook();
$this->drupalGet('<front>');
$this->assertText($block->label(), 'Book navigation block is displayed.');
$this->assertText($this->book->label(), new FormattableMarkup('Link to book root (@title) is displayed.', ['@title' => $nodes[0]->label()]));
$this->assertNoText($nodes[0]->label(), 'No links to individual book pages are displayed.');
// Book navigation block.
$this->assertText($block->label());
// Link to book root.
$this->assertText($this->book->label());
// No links to individual book pages.
$this->assertNoText($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
@ -396,7 +398,7 @@ class BookTest extends BrowserTestBase {
$edit = [];
$edit[RoleInterface::ANONYMOUS_ID . '[node test view]'] = TRUE;
$this->drupalPostForm('admin/people/permissions/' . RoleInterface::ANONYMOUS_ID, $edit, 'Save permissions');
$this->assertText('The changes have been saved.', "Permission 'node test view' successfully assigned to anonymous users.");
$this->assertText('The changes have been saved.');
// Create a book.
$this->createBook();
@ -404,16 +406,16 @@ class BookTest extends BrowserTestBase {
// Test correct display of the block to registered users.
$this->drupalLogin($this->webUser);
$this->drupalGet('node/' . $this->book->id());
$this->assertText($block->label(), 'Book navigation block is displayed to registered users.');
$this->assertText($block->label());
$this->drupalLogout();
// Test correct display of the block to anonymous users.
$this->drupalGet('node/' . $this->book->id());
$this->assertText($block->label(), 'Book navigation block is displayed to anonymous users.');
$this->assertText($block->label());
// Test the 'book pages' block_mode setting.
$this->drupalGet('<front>');
$this->assertNoText($block->label(), 'Book navigation block is not shown on non-book pages.');
$this->assertNoText($block->label());
}
/**
@ -557,8 +559,7 @@ class BookTest extends BrowserTestBase {
// Load the book page and assert the created book title is displayed.
$this->drupalGet('book');
$this->assertText($this->book->label(), 'The book title is displayed on the book listing page.');
$this->assertText($this->book->label());
// Unpublish the top book page and confirm that the created book title is
// not displayed for anonymous.
@ -609,7 +610,7 @@ class BookTest extends BrowserTestBase {
// Load the book page and assert the created book title is displayed.
$this->drupalLogin($this->adminUser);
$this->drupalGet('admin/structure/book');
$this->assertText($this->book->label(), 'The book title is displayed on the administrative book listing page.');
$this->assertText($this->book->label());
}
/**
@ -623,7 +624,7 @@ class BookTest extends BrowserTestBase {
// Load the book page list and assert the created book title is displayed
// and action links are shown on list items.
$this->drupalGet('admin/structure/book/' . $this->book->id());
$this->assertText($this->book->label(), 'The book title is displayed on the administrative book listing page.');
$this->assertText($this->book->label());
$elements = $this->xpath('//table//ul[@class="dropbutton"]/li/a');
$this->assertEqual($elements[0]->getText(), 'View', 'View link is found from the list.');
@ -709,7 +710,9 @@ class BookTest extends BrowserTestBase {
// Test node page.
$this->drupalGet('node/' . $this->book->id());
$this->assertText($this->book->label(), 'Unpublished book with "Show block only on book pages" book navigation settings.');
// Unpublished book with "Show block only on book pages" book navigation
// settings.
$this->assertText($this->book->label());
}
/**

View File

@ -141,7 +141,7 @@ trait BookTestTrait {
// Check printer friendly version.
$this->drupalGet('book/export/html/' . $node->id());
$this->assertText($node->label(), 'Printer friendly title found.');
$this->assertText($node->label());
$this->assertRaw($node->body->processed);
$number++;

View File

@ -51,7 +51,7 @@ class CommentAdminTest extends CommentTestBase {
$body = $this->randomMachineName();
// Set $contact to true so that it won't check for id and message.
$this->postComment($this->node, $body, $subject, TRUE);
$this->assertText('Your comment has been queued for review by site administrators and will be published after approval.', 'Comment requires approval.');
$this->assertText('Your comment has been queued for review by site administrators and will be published after approval.');
// Get unapproved comment id.
$this->drupalLogin($this->adminUser);
@ -83,13 +83,13 @@ class CommentAdminTest extends CommentTestBase {
// Publish multiple comments in one operation.
$this->drupalLogin($this->adminUser);
$this->drupalGet('admin/content/comment/approval');
$this->assertText('Unapproved comments (2)', 'Two unapproved comments waiting for approval.');
$this->assertText('Unapproved comments (2)');
$edit = [
"comments[{$comments[0]->id()}]" => 1,
"comments[{$comments[1]->id()}]" => 1,
];
$this->submitForm($edit, 'Update');
$this->assertText('Unapproved comments (0)', 'All comments were approved.');
$this->assertText('Unapproved comments (0)');
// Delete multiple comments in one operation.
$edit = [
@ -99,9 +99,9 @@ class CommentAdminTest extends CommentTestBase {
"comments[{$anonymous_comment4->id()}]" => 1,
];
$this->submitForm($edit, 'Update');
$this->assertText('Are you sure you want to delete these comments and all their children?', 'Confirmation required.');
$this->assertText('Are you sure you want to delete these comments and all their children?');
$this->submitForm([], 'Delete');
$this->assertText('No comments available.', 'All comments were deleted.');
$this->assertText('No comments available.');
// Test message when no comments selected.
$edit = [
'operation' => 'delete',
@ -139,7 +139,7 @@ class CommentAdminTest extends CommentTestBase {
$body = $this->randomMachineName();
// Set $contact to true so that it won't check for id and message.
$this->postComment($this->node, $body, $subject, TRUE);
$this->assertText('Your comment has been queued for review by site administrators and will be published after approval.', 'Comment requires approval.');
$this->assertText('Your comment has been queued for review by site administrators and will be published after approval.');
// Get unapproved comment id.
$this->drupalLogin($this->adminUser);

View File

@ -125,7 +125,7 @@ class CommentAnonymousTest extends CommentTestBase {
$anonymous_comment3 = $this->postComment($this->node, $this->randomMachineName(), $this->randomMachineName(), TRUE);
// Name should have 'Anonymous' for value by default.
$this->assertText('Email field is required.', 'Email required.');
$this->assertText('Email field is required.');
$this->assertFalse($this->commentExists($anonymous_comment3), 'Anonymous comment with contact info (required) not found.');
// Post comment with contact info (required).

View File

@ -2,7 +2,6 @@
namespace Drupal\Tests\comment\Functional;
use Drupal\Component\Render\FormattableMarkup;
use Drupal\user\RoleInterface;
/**
@ -71,9 +70,9 @@ class CommentBlockTest extends CommentTestBase {
$this->assertText('Recent comments');
// Test the only the 10 latest comments are shown and in the proper order.
$this->assertNoText($comments[10]->getSubject(), 'Comment 11 not found in block.');
$this->assertNoText($comments[10]->getSubject());
for ($i = 0; $i < 10; $i++) {
$this->assertText($comments[$i]->getSubject(), new FormattableMarkup('Comment @number found in block.', ['@number' => 10 - $i]));
$this->assertText($comments[$i]->getSubject());
if ($i > 1) {
$previous_position = $position;
$position = strpos($this->getSession()->getPage()->getContent(), $comments[$i]->getSubject());
@ -87,7 +86,7 @@ class CommentBlockTest extends CommentTestBase {
for ($i = 0; $i < 10; $i++) {
$this->clickLink($comments[$i]->getSubject());
$this->assertText($comments[$i]->getSubject(), 'Comment link goes to correct page.');
$this->assertText($comments[$i]->getSubject());
$this->assertRaw('<link rel="canonical"');
}
}

View File

@ -69,19 +69,19 @@ class CommentBookTest extends BrowserTestBase {
$this->drupalGet('node/' . $book_node->id());
$this->assertText($comment_subject, 'Comment subject found');
$this->assertText($comment_body, 'Comment body found');
$this->assertText('Add new comment', 'Comment form found');
$this->assertText($comment_subject);
$this->assertText($comment_body);
$this->assertText('Add new comment');
// Ensure that the comment form subject field exists.
$this->assertSession()->fieldExists('subject[0][value]');
$this->drupalGet('book/export/html/' . $book_node->id());
$this->assertText('Comments', 'Comment thread found');
$this->assertText($comment_subject, 'Comment subject found');
$this->assertText($comment_body, 'Comment body found');
$this->assertText('Comments');
$this->assertText($comment_subject);
$this->assertText($comment_body);
$this->assertNoText('Add new comment', 'Comment form not found');
$this->assertNoText('Add new comment');
// Verify that the comment form subject field is not found.
$this->assertSession()->fieldNotExists('subject[0][value]');
}

View File

@ -81,8 +81,8 @@ class CommentInterfaceTest extends CommentTestBase {
// Check comment display.
$this->drupalLogin($this->webUser);
$this->drupalGet('node/' . $this->node->id());
$this->assertText($subject_text, 'Individual comment subject found.');
$this->assertText($comment_text, 'Individual comment body found.');
$this->assertText($subject_text);
$this->assertText($comment_text);
$arguments = [
':link' => base_path() . 'comment/' . $comment->id() . '#comment-' . $comment->id(),
];
@ -128,8 +128,8 @@ class CommentInterfaceTest extends CommentTestBase {
// Verify we were correctly redirected.
$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.');
$this->assertText($subject_text);
$this->assertText($comment_text);
$reply = $this->postComment(NULL, $this->randomMachineName(), '', TRUE);
$reply_loaded = Comment::load($reply->id());
$this->assertTrue($this->commentExists($reply, TRUE), 'Reply found.');
@ -139,8 +139,8 @@ class CommentInterfaceTest extends CommentTestBase {
// Second reply to comment #2 creating comment #4.
$this->drupalGet('comment/reply/node/' . $this->node->id() . '/comment/' . $comment->id());
$this->assertText($comment->getSubject(), 'Individual comment-reply subject found.');
$this->assertText($comment->comment_body->value, 'Individual comment-reply body found.');
$this->assertText($comment->getSubject());
$this->assertText($comment->comment_body->value);
$reply = $this->postComment(NULL, $this->randomMachineName(), $this->randomMachineName(), TRUE);
$reply_loaded = Comment::load($reply->id());
$this->assertTrue($this->commentExists($reply, TRUE), 'Second reply found.');
@ -149,8 +149,8 @@ class CommentInterfaceTest extends CommentTestBase {
// Reply to comment #4 creating comment #5.
$this->drupalGet('comment/reply/node/' . $this->node->id() . '/comment/' . $reply_loaded->id());
$this->assertText($reply_loaded->getSubject(), 'Individual comment-reply subject found.');
$this->assertText($reply_loaded->comment_body->value, 'Individual comment-reply body found.');
$this->assertText($reply_loaded->getSubject());
$this->assertText($reply_loaded->comment_body->value);
$reply = $this->postComment(NULL, $this->randomMachineName(), $this->randomMachineName(), TRUE);
$reply_loaded = Comment::load($reply->id());
$this->assertTrue($this->commentExists($reply, TRUE), 'Second reply found.');
@ -194,7 +194,7 @@ class CommentInterfaceTest extends CommentTestBase {
$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', 'Posting to node with comments enabled');
$this->assertNoText('This discussion is closed');
// Ensure that the comment body field exists.
$this->assertSession()->fieldExists('edit-comment-body-0-value');

View File

@ -66,8 +66,8 @@ class CommentNodeAccessTest extends CommentTestBase {
// Check comment display.
$this->drupalGet('node/' . $this->node->id());
$this->assertText($comment_subject, 'Individual comment subject found.');
$this->assertText($comment_text, 'Individual comment body found.');
$this->assertText($comment_subject);
$this->assertText($comment_text);
// Reply to comment, creating second comment.
$this->drupalGet('comment/reply/node/' . $this->node->id() . '/comment/' . $comment->id());

View File

@ -2,7 +2,6 @@
namespace Drupal\Tests\comment\Functional;
use Drupal\Component\Render\FormattableMarkup;
use Drupal\comment\CommentInterface;
use Drupal\comment\Entity\Comment;
use Drupal\comment\Entity\CommentType;
@ -173,9 +172,9 @@ class CommentNonNodeTest extends BrowserTestBase {
if ($contact !== TRUE) {
// If true then attempting to find error message.
if ($subject) {
$this->assertText($subject, 'Comment subject posted.');
$this->assertText($subject);
}
$this->assertText($comment, 'Comment body posted.');
$this->assertText($comment);
// Check the comment ID was extracted.
$this->assertArrayHasKey(1, $match);
}
@ -242,7 +241,7 @@ class CommentNonNodeTest extends BrowserTestBase {
$this->assertRaw(\Drupal::translation()->formatPlural(1, 'Deleted 1 comment.', 'Deleted @count comments.'));
}
else {
$this->assertText('The update has been performed.', new FormattableMarkup('Operation "@operation" was performed on comment.', ['@operation' => $operation]));
$this->assertText('The update has been performed.');
}
}
@ -335,13 +334,13 @@ class CommentNonNodeTest extends BrowserTestBase {
$this->assertRaw('comments[' . $comment1->id() . ']');
// Check that entity access applies to administrative page.
$this->assertText($this->entity->label(), 'Name of commented account found.');
$this->assertText($this->entity->label());
$limited_user = $this->drupalCreateUser([
'administer comments',
]);
$this->drupalLogin($limited_user);
$this->drupalGet('admin/content/comment');
$this->assertNoText($this->entity->label(), 'No commented account name found.');
$this->assertNoText($this->entity->label());
$this->drupalLogout();
@ -396,7 +395,7 @@ class CommentNonNodeTest extends BrowserTestBase {
$this->drupalGet('comment/reply/entity_test/' . $this->entity->id() . '/comment/' . $comment1->id());
$this->assertSession()->statusCodeEquals(403);
$this->assertNoText($comment1->getSubject(), 'Comment not displayed.');
$this->assertNoText($comment1->getSubject());
// Test comment field widget changes.
$limited_user = $this->drupalCreateUser([

View File

@ -343,7 +343,8 @@ class CommentPagerTest extends CommentTestBase {
$account = $this->drupalCreateUser(['administer node display']);
$this->drupalLogin($account);
$this->drupalGet('admin/structure/types/manage/article/display');
$this->assertNoText('Pager ID: 0', 'No summary for standard pager');
// No summary for standard pager.
$this->assertNoText('Pager ID: 0');
$this->assertText('Pager ID: 1');
$this->submitForm([], 'comment_settings_edit');
// Change default pager to 2.
@ -352,7 +353,8 @@ class CommentPagerTest extends CommentTestBase {
// Revert the changes.
$this->submitForm([], 'comment_settings_edit');
$this->submitForm(['fields[comment][settings_edit_form][settings][pager_id]' => 0], 'Save');
$this->assertNoText('Pager ID: 0', 'No summary for standard pager');
// No summary for standard pager.
$this->assertNoText('Pager ID: 0');
$this->drupalLogin($this->adminUser);

View File

@ -68,8 +68,8 @@ class CommentPreviewTest extends CommentTestBase {
// Check that the preview is displaying the title and body.
$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($edit['subject[0][value]']);
$this->assertText($edit['comment_body[0][value]']);
// Check that the title and body fields are displayed with the correct values.
$this->assertSession()->fieldValueEquals('subject[0][value]', $edit['subject[0][value]']);
@ -102,8 +102,8 @@ class CommentPreviewTest extends CommentTestBase {
// Check that the preview is displaying the title and body.
$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($edit['subject[0][value]']);
$this->assertText($edit['comment_body[0][value]']);
// Check that the title and body fields are displayed with the correct values.
$this->assertSession()->fieldValueEquals('subject[0][value]', $edit['subject[0][value]']);
@ -156,10 +156,10 @@ class CommentPreviewTest extends CommentTestBase {
// Check that the preview is displaying the subject, comment, author and date correctly.
$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.');
$this->assertText($expected_text_date, 'Date displayed.');
$this->assertText($edit['subject[0][value]']);
$this->assertText($edit['comment_body[0][value]']);
$this->assertText($web_user->getAccountName());
$this->assertText($expected_text_date);
// Check that the subject, comment, author and date fields are displayed with the correct values.
$this->assertSession()->fieldValueEquals('subject[0][value]', $edit['subject[0][value]']);
@ -170,7 +170,7 @@ class CommentPreviewTest extends CommentTestBase {
// Check that saving a comment produces a success message.
$this->drupalPostForm('comment/' . $comment->id() . '/edit', $edit, 'Save');
$this->assertText('Your comment has been posted.', 'Comment posted.');
$this->assertText('Your comment has been posted.');
// Check that the comment fields are correct after loading the saved comment.
$this->drupalGet('comment/' . $comment->id() . '/edit');

View File

@ -172,9 +172,9 @@ abstract class CommentTestBase extends BrowserTestBase {
if ($contact !== TRUE) {
// If true then attempting to find error message.
if ($subject) {
$this->assertText($subject, 'Comment subject posted.');
$this->assertText($subject);
}
$this->assertText($comment, 'Comment body posted.');
$this->assertText($comment);
// Check the comment ID was extracted.
$this->assertArrayHasKey(1, $match);
}
@ -228,7 +228,7 @@ abstract class CommentTestBase extends BrowserTestBase {
*/
public function deleteComment(CommentInterface $comment) {
$this->drupalPostForm('comment/' . $comment->id() . '/delete', [], 'Delete');
$this->assertText('The comment and all its replies have been deleted.', 'Comment deleted.');
$this->assertText('The comment and all its replies have been deleted.');
}
/**
@ -368,7 +368,7 @@ abstract class CommentTestBase extends BrowserTestBase {
$this->assertRaw(\Drupal::translation()->formatPlural(1, 'Deleted 1 comment.', 'Deleted @count comments.'));
}
else {
$this->assertText('The update has been performed.', new FormattableMarkup('Operation "@operation" was performed on comment.', ['@operation' => $operation]));
$this->assertText('The update has been performed.');
}
}

View File

@ -166,7 +166,7 @@ class CommentTypeTest extends CommentTestBase {
'%field' => 'node.foo',
])
);
$this->assertNoText('This action cannot be undone.', 'The comment type deletion confirmation form is not available.');
$this->assertNoText('This action cannot be undone.');
// Delete the comment and the field.
$comment->delete();
@ -176,7 +176,7 @@ class CommentTypeTest extends CommentTestBase {
$this->assertRaw(
t('Are you sure you want to delete the comment type %type?', ['%type' => $type->id()])
);
$this->assertText('This action cannot be undone.', 'The comment type deletion confirmation form is available.');
$this->assertText('This action cannot be undone.');
// Test exception thrown when re-using an existing comment type.
try {

View File

@ -6,7 +6,6 @@ use Drupal\block_content\Entity\BlockContent;
use Drupal\block_content\Entity\BlockContentType;
use Drupal\comment\Entity\Comment;
use Drupal\comment\Plugin\Field\FieldType\CommentItemInterface;
use Drupal\Component\Render\FormattableMarkup;
use Drupal\Tests\comment\Functional\CommentTestBase as CommentBrowserTestBase;
use Drupal\Component\Utility\Html;
use Drupal\Component\Utility\Unicode;
@ -70,7 +69,7 @@ class CommentAdminTest extends CommentBrowserTestBase {
'name' => $author_name,
'comment_body[0][value]' => $body,
], 'Save');
$this->assertText('Your comment has been queued for review by site administrators and will be published after approval.', 'Comment requires approval.');
$this->assertText('Your comment has been queued for review by site administrators and will be published after approval.');
// Get unapproved comment id.
$this->drupalLogin($this->adminUser);
@ -94,7 +93,7 @@ class CommentAdminTest extends CommentBrowserTestBase {
$edit['comment_bulk_form[0]'] = $anonymous_comment4->id();
$this->drupalPostForm('admin/content/comment/approval', $edit, 'Apply to selected items');
$this->assertText('Publish comment was applied to 1 item.', new FormattableMarkup('Operation "@operation" was performed on comment.', ['@operation' => 'publish']));
$this->assertText('Publish comment was applied to 1 item.');
$this->drupalLogout();
$this->drupalGet('node/' . $this->node->id());
@ -107,7 +106,7 @@ class CommentAdminTest extends CommentBrowserTestBase {
// Publish multiple comments in one operation.
$this->drupalLogin($this->adminUser);
$this->drupalGet('admin/content/comment/approval');
$this->assertText('Unapproved comments (2)', 'Two unapproved comments waiting for approval.');
$this->assertText('Unapproved comments (2)');
// Assert the expose filters on the admin page.
$this->assertSession()->fieldExists('subject');
@ -120,7 +119,7 @@ class CommentAdminTest extends CommentBrowserTestBase {
"comment_bulk_form[0]" => $comments[1]->id(),
];
$this->submitForm($edit, 'Apply to selected items');
$this->assertText('Unapproved comments (0)', 'All comments were approved.');
$this->assertText('Unapproved comments (0)');
// Test message when no comments selected.
$this->drupalPostForm('admin/content/comment', [], 'Apply to selected items');
@ -132,7 +131,8 @@ class CommentAdminTest extends CommentBrowserTestBase {
':text' => $comments[0]->getSubject(),
]);
$this->assertTrue(!empty($subject_link), 'Comment listing shows the correct subject link.');
$this->assertText($author_name . ' (not verified)', 'Anonymous author name is displayed correctly.');
// Verify that anonymous author name is displayed correctly.
$this->assertText($author_name . ' (not verified)');
$subject_link = $this->xpath('//table/tbody/tr/td/a[contains(@href, :href) and contains(@title, :title) and text()=:text]', [
':href' => $anonymous_comment4->permalink()->toString(),
@ -140,7 +140,8 @@ class CommentAdminTest extends CommentBrowserTestBase {
':text' => $subject,
]);
$this->assertTrue(!empty($subject_link), 'Comment listing shows the correct subject link.');
$this->assertText($author_name . ' (not verified)', 'Anonymous author name is displayed correctly.');
// Verify that anonymous author name is displayed correctly.
$this->assertText($author_name . ' (not verified)');
// Delete multiple comments in one operation.
$edit = [
@ -150,9 +151,9 @@ class CommentAdminTest extends CommentBrowserTestBase {
"comment_bulk_form[2]" => $anonymous_comment4->id(),
];
$this->submitForm($edit, 'Apply to selected items');
$this->assertText('Are you sure you want to delete these comments and all their children?', 'Confirmation required.');
$this->assertText('Are you sure you want to delete these comments and all their children?');
$this->submitForm([], 'Delete');
$this->assertText('No comments available.', 'All comments were deleted.');
$this->assertText('No comments available.');
// Make sure the label of unpublished node is not visible on listing page.
$this->drupalGet('admin/content/comment');
@ -160,11 +161,13 @@ class CommentAdminTest extends CommentBrowserTestBase {
$this->drupalLogout();
$this->drupalLogin($this->adminUser);
$this->drupalGet('admin/content/comment');
$this->assertText(Html::escape($this->node->label()), 'Comment admin can see the title of a published node');
// Verify that comment admin can see the title of a published node.
$this->assertText(Html::escape($this->node->label()));
$this->node->setUnpublished()->save();
$this->assertFalse($this->node->isPublished(), 'Node is unpublished now.');
$this->drupalGet('admin/content/comment');
$this->assertNoText(Html::escape($this->node->label()), 'Comment admin cannot see the title of an unpublished node');
// Verify that comment admin cannot see the title of an unpublished node.
$this->assertNoText(Html::escape($this->node->label()));
$this->drupalLogout();
$node_access_user = $this->drupalCreateUser([
'administer comments',
@ -172,7 +175,9 @@ class CommentAdminTest extends CommentBrowserTestBase {
]);
$this->drupalLogin($node_access_user);
$this->drupalGet('admin/content/comment');
$this->assertText(Html::escape($this->node->label()), 'Comment admin with bypass node access permissions can still see the title of a published node');
// Verify that comment admin with bypass node access permissions can still
// see the title of a published node.
$this->assertText(Html::escape($this->node->label()));
}
/**
@ -217,11 +222,11 @@ class CommentAdminTest extends CommentBrowserTestBase {
]);
$this->assertTrue(!empty($comment_author_link), 'Comment listing links to comment author.');
// Admin page contains label of both entities.
$this->assertText(Html::escape($this->node->label()), 'Node title is visible.');
$this->assertText(Html::escape($block_content->label()), 'Block content label is visible.');
$this->assertText(Html::escape($this->node->label()));
$this->assertText(Html::escape($block_content->label()));
// Admin page contains subject of both entities.
$this->assertText(Html::escape($node_comment->label()), 'Node comment is visible.');
$this->assertText(Html::escape($block_content_comment->label()), 'Block content comment is visible.');
$this->assertText(Html::escape($node_comment->label()));
$this->assertText(Html::escape($block_content_comment->label()));
}
}

View File

@ -66,12 +66,12 @@ class ConfigDependencyWebTest extends BrowserTestBase {
$entity2->save();
$this->drupalGet($entity2->toUrl('delete-form'));
$this->assertNoText('Configuration updates', 'No configuration updates found.');
$this->assertNoText('Configuration deletions', 'No configuration deletes found.');
$this->assertNoText('Configuration updates');
$this->assertNoText('Configuration deletions');
$this->drupalGet($entity1->toUrl('delete-form'));
$this->assertNoText('Configuration updates', 'No configuration updates found.');
$this->assertText('Configuration deletions', 'Configuration deletions found.');
$this->assertText($entity2->id(), 'Entity2 id found');
$this->assertNoText('Configuration updates');
$this->assertText('Configuration deletions');
$this->assertText($entity2->id());
$this->drupalPostForm($entity1->toUrl('delete-form'), [], 'Delete');
$storage->resetCache();
$this->assertEmpty($storage->loadMultiple([$entity1->id(), $entity2->id()]), 'Test entities deleted');
@ -117,11 +117,11 @@ class ConfigDependencyWebTest extends BrowserTestBase {
$entity3->save();
$this->drupalGet($entity1->toUrl('delete-form'));
$this->assertText('Configuration updates', 'Configuration updates found.');
$this->assertNoText('Configuration deletions', 'No configuration deletions found.');
$this->assertNoText($entity2->id(), 'Entity2 id not found');
$this->assertText($entity2->label(), 'Entity2 label not found');
$this->assertNoText($entity3->id(), 'Entity3 id not found');
$this->assertText('Configuration updates');
$this->assertNoText('Configuration deletions');
$this->assertNoText($entity2->id());
$this->assertText($entity2->label());
$this->assertNoText($entity3->id());
$this->drupalPostForm($entity1->toUrl('delete-form'), [], 'Delete');
$storage->resetCache();
$this->assertNull($storage->load('entity1'), 'Test entity 1 deleted');

View File

@ -44,7 +44,7 @@ class LanguageNegotiationFormOverrideTest extends BrowserTestBase {
$this->drupalGet('admin/config/regional/language/detection/url');
// The language-negotiation form should be found.
$this->assertText('Path prefix configuration', 'Language-negotiation form found for English.');
$this->assertText('Path prefix configuration');
// The English override should not be found.
$this->assertSession()->fieldValueNotEquals('prefix[en]', $overridden_value_en);
@ -53,7 +53,7 @@ class LanguageNegotiationFormOverrideTest extends BrowserTestBase {
$this->drupalGet($overridden_value_es . '/admin/config/regional/language/detection/url');
// The language-negotiation form should be found.
$this->assertText('Path prefix configuration', 'Language-negotiation form found for Spanish using the overridden prefix.');
$this->assertText('Path prefix configuration');
// The Spanish override should not be found.
$this->assertSession()->fieldValueNotEquals('prefix[es]', $overridden_value_es);

View File

@ -203,7 +203,7 @@ class ContactPersonalTest extends BrowserTestBase {
$this->drupalLogin($this->adminUser);
$edit = ['contact_default_status' => FALSE];
$this->drupalPostForm('admin/config/people/accounts', $edit, 'Save configuration');
$this->assertText('The configuration options have been saved.', 'Setting successfully saved.');
$this->assertText('The configuration options have been saved.');
$this->drupalLogout();
// Re-create our contacted user with personal contact forms disabled by
@ -265,7 +265,7 @@ class ContactPersonalTest extends BrowserTestBase {
// Submit contact form with correct values and check flood interval.
for ($i = 0; $i < $flood_limit; $i++) {
$this->submitPersonalContact($this->contactUser);
$this->assertText('Your message has been sent.', 'Message sent.');
$this->assertText('Your message has been sent.');
}
// Submit contact form one over limit.
@ -276,7 +276,7 @@ class ContactPersonalTest extends BrowserTestBase {
// Test that the admin user can still access the contact form even though
// the flood limit was reached.
$this->drupalLogin($this->adminUser);
$this->assertNoText('Try again later.', 'Admin user not denied access to flooded contact form.');
$this->assertNoText('Try again later.');
}
/**

View File

@ -130,7 +130,7 @@ class ContactSitewideTest extends BrowserTestBase {
// Delete old forms to ensure that new forms are used.
$this->deleteContactForms();
$this->drupalGet('admin/structure/contact');
$this->assertText('Personal', 'Personal form was not deleted');
$this->assertText('Personal');
$this->assertSession()->linkByHrefNotExists('admin/structure/contact/manage/feedback');
// Ensure that the contact form won't be shown without forms.

View File

@ -165,7 +165,7 @@ class ModerationFormTest extends ModerationStateTestBase {
$this->drupalGet($latest_version_path);
$this->assertSession()->statusCodeEquals(200);
$this->assertSession()->fieldExists('edit-new-state');
$this->assertText('Draft', 'Correct status found on the latest-version page.');
$this->assertText('Draft');
// Submit the moderation form to change status to published.
$this->drupalPostForm($latest_version_path, [
@ -209,7 +209,7 @@ class ModerationFormTest extends ModerationStateTestBase {
// default revision.
$this->drupalGet('entity_test_mulrevpub/manage/1');
$this->assertSession()->statusCodeEquals(200);
$this->assertNoText('Status', 'The node view page has no moderation form.');
$this->assertNoText('Status');
// The latest version page should not show, because there is still no
// pending revision.
@ -223,14 +223,14 @@ class ModerationFormTest extends ModerationStateTestBase {
// default revision.
$this->drupalGet('entity_test_mulrevpub/manage/1');
$this->assertSession()->statusCodeEquals(200);
$this->assertNoText('Status', 'The node view page has no moderation form.');
$this->assertNoText('Status');
// The latest version page should show the moderation form and have "Draft"
// status, because the pending revision is in "Draft".
$this->drupalGet('entity_test_mulrevpub/manage/1/latest');
$this->assertSession()->statusCodeEquals(200);
$this->assertText('Moderation state', 'Form text found on the latest-version page.');
$this->assertText('Draft', 'Correct status found on the latest-version page.');
$this->assertText('Moderation state');
$this->assertText('Draft');
// Submit the moderation form to change status to published.
$this->drupalPostForm('entity_test_mulrevpub/manage/1/latest', [

View File

@ -285,7 +285,7 @@ class ContentTranslationSettingsTest extends BrowserTestBase {
$path = 'admin/structure/types/manage/article/fields/node.article.field_article_text';
$this->drupalGet($path);
$this->assertSession()->fieldDisabled('edit-translatable');
$this->assertText('To configure translation for this field, enable language support for this type.', 'No translatable setting for field.');
$this->assertText('To configure translation for this field, enable language support for this type.');
// Tests that field has translatable setting if bundle is translatable.
// Note: this field is not translatable when enable bundle translatability.
@ -299,7 +299,7 @@ class ContentTranslationSettingsTest extends BrowserTestBase {
$this->drupalGet($path);
$this->assertSession()->fieldEnabled('edit-translatable');
$this->assertSession()->checkboxChecked('edit-translatable');
$this->assertNoText('To enable translation of this field, enable language support for this type.', 'Translatable setting for field available.');
$this->assertNoText('To enable translation of this field, enable language support for this type.');
}
/**

View File

@ -90,7 +90,7 @@ abstract class ContentTranslationUITestBase extends ContentTranslationTestBase {
$this->assertCacheContexts($this->defaultCacheContexts);
$this->drupalGet($entity->toUrl('drupal:content-translation-overview'));
$this->assertNoText('Source language', 'Source language column correctly hidden.');
$this->assertNoText('Source language');
$translation = $this->getTranslation($entity, $default_langcode);
foreach ($values[$default_langcode] as $property => $value) {
@ -164,7 +164,7 @@ abstract class ContentTranslationUITestBase extends ContentTranslationTestBase {
$storage->resetCache([$this->entityId]);
$entity = $storage->load($this->entityId);
$this->drupalGet($entity->toUrl('drupal:content-translation-overview'));
$this->assertNoText('Source language', 'Source language column correctly hidden.');
$this->assertNoText('Source language');
// Switch the source language.
$langcode = 'fr';
@ -195,7 +195,7 @@ abstract class ContentTranslationUITestBase extends ContentTranslationTestBase {
$storage->resetCache([$this->entityId]);
$entity = $storage->load($this->entityId);
$this->drupalGet($entity->toUrl('drupal:content-translation-overview'));
$this->assertText('Source language', 'Source language column correctly shown.');
$this->assertText('Source language');
// Check that the entered values have been correctly stored.
foreach ($values as $langcode => $property_values) {

View File

@ -813,32 +813,36 @@ class DateTimeFieldTest extends DateTestBase {
"{$field_name}[0][value][time]" => '12:00:00',
];
$this->submitForm($edit, 'Save');
$this->assertText('date is invalid', 'Empty date value has been caught.');
$this->assertText('date is invalid');
// Invalid year value.
$date_value = 'aaaa-12-01';
$edit = [
"{$field_name}[0][value][date]" => $date_value,
"{$field_name}[0][value][time]" => '00:00:00',
];
$this->submitForm($edit, 'Save');
$this->assertText('date is invalid', new FormattableMarkup('Invalid year value %date has been caught.', ['%date' => $date_value]));
$this->assertText('date is invalid');
// Invalid month value.
$date_value = '2012-75-01';
$edit = [
"{$field_name}[0][value][date]" => $date_value,
"{$field_name}[0][value][time]" => '00:00:00',
];
$this->submitForm($edit, 'Save');
$this->assertText('date is invalid', new FormattableMarkup('Invalid month value %date has been caught.', ['%date' => $date_value]));
$this->assertText('date is invalid');
// Invalid day value.
$date_value = '2012-12-99';
$edit = [
"{$field_name}[0][value][date]" => $date_value,
"{$field_name}[0][value][time]" => '00:00:00',
];
$this->submitForm($edit, 'Save');
$this->assertText('date is invalid', new FormattableMarkup('Invalid day value %date has been caught.', ['%date' => $date_value]));
$this->assertText('date is invalid');
// Invalid time value.
$date_value = '2012-12-01';
$time_value = '';
$edit = [
@ -846,8 +850,9 @@ class DateTimeFieldTest extends DateTestBase {
"{$field_name}[0][value][time]" => $time_value,
];
$this->submitForm($edit, 'Save');
$this->assertText('date is invalid', 'Empty time value has been caught.');
$this->assertText('date is invalid');
// Invalid hour value.
$date_value = '2012-12-01';
$time_value = '49:00:00';
$edit = [
@ -855,8 +860,9 @@ class DateTimeFieldTest extends DateTestBase {
"{$field_name}[0][value][time]" => $time_value,
];
$this->submitForm($edit, 'Save');
$this->assertText('date is invalid', new FormattableMarkup('Invalid hour value %time has been caught.', ['%time' => $time_value]));
$this->assertText('date is invalid');
// Invalid minutes value.
$date_value = '2012-12-01';
$time_value = '12:99:00';
$edit = [
@ -864,8 +870,9 @@ class DateTimeFieldTest extends DateTestBase {
"{$field_name}[0][value][time]" => $time_value,
];
$this->submitForm($edit, 'Save');
$this->assertText('date is invalid', new FormattableMarkup('Invalid minute value %time has been caught.', ['%time' => $time_value]));
$this->assertText('date is invalid');
// Invalid seconds value.
$date_value = '2012-12-01';
$time_value = '12:15:99';
$edit = [
@ -873,7 +880,7 @@ class DateTimeFieldTest extends DateTestBase {
"{$field_name}[0][value][time]" => $time_value,
];
$this->submitForm($edit, 'Save');
$this->assertText('date is invalid', new FormattableMarkup('Invalid second value %time has been caught.', ['%time' => $time_value]));
$this->assertText('date is invalid');
}
/**

View File

@ -1191,8 +1191,9 @@ class DateRangeFieldTest extends DateTestBase {
"{$field_name}[0][end_value][time]" => '12:00:00',
];
$this->submitForm($edit, 'Save');
$this->assertText('date is invalid', 'Empty start date value has been caught.');
$this->assertText('date is invalid');
// Invalid year value.
$date_value = 'aaaa-12-01';
$edit = [
"{$field_name}[0][value][date]" => $date_value,
@ -1201,8 +1202,9 @@ class DateRangeFieldTest extends DateTestBase {
"{$field_name}[0][end_value][time]" => '12:00:00',
];
$this->submitForm($edit, 'Save');
$this->assertText('date is invalid', 'Invalid start year value ' . $date_value . ' has been caught.');
$this->assertText('date is invalid');
// Invalid month value.
$date_value = '2012-75-01';
$edit = [
"{$field_name}[0][value][date]" => $date_value,
@ -1211,8 +1213,9 @@ class DateRangeFieldTest extends DateTestBase {
"{$field_name}[0][end_value][time]" => '12:00:00',
];
$this->submitForm($edit, 'Save');
$this->assertText('date is invalid', 'Invalid start month value ' . $date_value . ' has been caught.');
$this->assertText('date is invalid');
// Invalid day value.
$date_value = '2012-12-99';
$edit = [
"{$field_name}[0][value][date]" => $date_value,
@ -1221,7 +1224,7 @@ class DateRangeFieldTest extends DateTestBase {
"{$field_name}[0][end_value][time]" => '12:00:00',
];
$this->submitForm($edit, 'Save');
$this->assertText('date is invalid', 'Invalid start day value ' . $date_value . ' has been caught.');
$this->assertText('date is invalid');
// Submit invalid start times and ensure they is not accepted.
$time_value = '';
@ -1232,8 +1235,9 @@ class DateRangeFieldTest extends DateTestBase {
"{$field_name}[0][end_value][time]" => '12:00:00',
];
$this->submitForm($edit, 'Save');
$this->assertText('date is invalid', 'Empty start time value has been caught.');
$this->assertText('date is invalid');
// Invalid hour value.
$time_value = '49:00:00';
$edit = [
"{$field_name}[0][value][date]" => '2012-12-01',
@ -1242,8 +1246,9 @@ class DateRangeFieldTest extends DateTestBase {
"{$field_name}[0][end_value][time]" => '12:00:00',
];
$this->submitForm($edit, 'Save');
$this->assertText('date is invalid', 'Invalid start hour value ' . $time_value . ' has been caught.');
$this->assertText('date is invalid');
// Invalid minutes value.
$time_value = '12:99:00';
$edit = [
"{$field_name}[0][value][date]" => '2012-12-01',
@ -1252,8 +1257,9 @@ class DateRangeFieldTest extends DateTestBase {
"{$field_name}[0][end_value][time]" => '12:00:00',
];
$this->submitForm($edit, 'Save');
$this->assertText('date is invalid', 'Invalid start minute value ' . $time_value . ' has been caught.');
$this->assertText('date is invalid');
// Invalid seconds value.
$time_value = '12:15:99';
$edit = [
"{$field_name}[0][value][date]" => '2012-12-01',
@ -1262,7 +1268,7 @@ class DateRangeFieldTest extends DateTestBase {
"{$field_name}[0][end_value][time]" => '12:00:00',
];
$this->submitForm($edit, 'Save');
$this->assertText('date is invalid', 'Invalid start second value ' . $time_value . ' has been caught.');
$this->assertText('date is invalid');
// Submit invalid end dates and ensure they is not accepted.
$date_value = '';
@ -1273,8 +1279,9 @@ class DateRangeFieldTest extends DateTestBase {
"{$field_name}[0][end_value][time]" => '12:00:00',
];
$this->submitForm($edit, 'Save');
$this->assertText('date is invalid', 'Empty end date value has been caught.');
$this->assertText('date is invalid');
// Invalid year value.
$date_value = 'aaaa-12-01';
$edit = [
"{$field_name}[0][value][date]" => '2012-12-01',
@ -1283,8 +1290,9 @@ class DateRangeFieldTest extends DateTestBase {
"{$field_name}[0][end_value][time]" => '00:00:00',
];
$this->submitForm($edit, 'Save');
$this->assertText('date is invalid', 'Invalid end year value ' . $date_value . ' has been caught.');
$this->assertText('date is invalid');
// Invalid month value.
$date_value = '2012-75-01';
$edit = [
"{$field_name}[0][value][date]" => '2012-12-01',
@ -1293,8 +1301,9 @@ class DateRangeFieldTest extends DateTestBase {
"{$field_name}[0][end_value][time]" => '00:00:00',
];
$this->submitForm($edit, 'Save');
$this->assertText('date is invalid', 'Invalid end month value ' . $date_value . ' has been caught.');
$this->assertText('date is invalid');
// Invalid day value.
$date_value = '2012-12-99';
$edit = [
"{$field_name}[0][value][date]" => '2012-12-01',
@ -1303,7 +1312,7 @@ class DateRangeFieldTest extends DateTestBase {
"{$field_name}[0][end_value][time]" => '00:00:00',
];
$this->submitForm($edit, 'Save');
$this->assertText('date is invalid', 'Invalid end day value ' . $date_value . ' has been caught.');
$this->assertText('date is invalid');
// Submit invalid start times and ensure they is not accepted.
$time_value = '';
@ -1314,8 +1323,9 @@ class DateRangeFieldTest extends DateTestBase {
"{$field_name}[0][end_value][time]" => $time_value,
];
$this->submitForm($edit, 'Save');
$this->assertText('date is invalid', 'Empty end time value has been caught.');
$this->assertText('date is invalid');
// Invalid hour value.
$time_value = '49:00:00';
$edit = [
"{$field_name}[0][value][date]" => '2012-12-01',
@ -1324,8 +1334,9 @@ class DateRangeFieldTest extends DateTestBase {
"{$field_name}[0][end_value][time]" => $time_value,
];
$this->submitForm($edit, 'Save');
$this->assertText('date is invalid', 'Invalid end hour value ' . $time_value . ' has been caught.');
$this->assertText('date is invalid');
// Invalid minutes value.
$time_value = '12:99:00';
$edit = [
"{$field_name}[0][value][date]" => '2012-12-01',
@ -1334,8 +1345,9 @@ class DateRangeFieldTest extends DateTestBase {
"{$field_name}[0][end_value][time]" => $time_value,
];
$this->submitForm($edit, 'Save');
$this->assertText('date is invalid', 'Invalid end minute value ' . $time_value . ' has been caught.');
$this->assertText('date is invalid');
// Invalid seconds value.
$time_value = '12:15:99';
$edit = [
"{$field_name}[0][value][date]" => '2012-12-01',
@ -1344,8 +1356,9 @@ class DateRangeFieldTest extends DateTestBase {
"{$field_name}[0][end_value][time]" => $time_value,
];
$this->submitForm($edit, 'Save');
$this->assertText('date is invalid', 'Invalid end second value ' . $time_value . ' has been caught.');
$this->assertText('date is invalid');
// End date before start date.
$edit = [
"{$field_name}[0][value][date]" => '2012-12-01',
"{$field_name}[0][value][time]" => '12:00:00',
@ -1353,8 +1366,9 @@ class DateRangeFieldTest extends DateTestBase {
"{$field_name}[0][end_value][time]" => '12:00:00',
];
$this->submitForm($edit, 'Save');
$this->assertText('The ' . $field_label . ' end date cannot be before the start date', 'End date before start date has been caught.');
$this->assertText('The ' . $field_label . ' end date cannot be before the start date');
// End date before start date.
$edit = [
"{$field_name}[0][value][date]" => '2012-12-01',
"{$field_name}[0][value][time]" => '12:00:00',
@ -1362,7 +1376,7 @@ class DateRangeFieldTest extends DateTestBase {
"{$field_name}[0][end_value][time]" => '11:00:00',
];
$this->submitForm($edit, 'Save');
$this->assertText('The ' . $field_label . ' end date cannot be before the start date', 'End time before start time has been caught.');
$this->assertText('The ' . $field_label . ' end date cannot be before the start date');
}
/**

View File

@ -139,7 +139,7 @@ class DbLogTest extends BrowserTestBase {
$this->assertRaw($context['request_uri']);
// Verify severity.
$this->assertText('Notice', 'The severity was properly displayed on the detail page.');
$this->assertText('Notice');
}
/**
@ -219,10 +219,10 @@ class DbLogTest extends BrowserTestBase {
$this->drupalGet('admin/reports/dblog/event/' . $wid);
// Verify table headers are present, even though the referrer is missing.
$this->assertText('Referrer', 'Referrer header is present on the detail page.');
$this->assertText('Referrer');
// Verify severity.
$this->assertText('Notice', 'The severity is properly displayed on the detail page.');
$this->assertText('Notice');
// Test log event page with incorrect location.
$request_uri = '/some/incorrect/url';
@ -235,10 +235,10 @@ class DbLogTest extends BrowserTestBase {
$this->drupalGet('admin/reports/dblog/event/' . $wid);
// Verify table headers are present.
$this->assertText('Location', 'Location header is present on the detail page.');
$this->assertText('Location');
// Verify severity.
$this->assertText('Notice', 'The severity is properly displayed on the detail page.');
$this->assertText('Notice');
// Verify location is available as plain text.
$this->assertEquals($request_uri, $this->cssSelect('table.dblog-event > tbody > tr:nth-child(4) > td')[0]->getHtml());
@ -300,34 +300,34 @@ class DbLogTest extends BrowserTestBase {
$this->drupalGet('admin/help/dblog');
$this->assertSession()->statusCodeEquals($response);
if ($response == 200) {
$this->assertText('Database Logging', 'DBLog help was displayed');
$this->assertText('Database Logging');
}
// View the database log report page.
$this->drupalGet('admin/reports/dblog');
$this->assertSession()->statusCodeEquals($response);
if ($response == 200) {
$this->assertText('Recent log messages', 'DBLog report was displayed');
$this->assertText('Recent log messages');
}
$this->drupalGet('admin/reports/dblog/confirm');
$this->assertSession()->statusCodeEquals($response);
if ($response == 200) {
$this->assertText('Are you sure you want to delete the recent logs?', 'DBLog clear logs form was displayed');
$this->assertText('Are you sure you want to delete the recent logs?');
}
// View the database log page-not-found report page.
$this->drupalGet('admin/reports/page-not-found');
$this->assertSession()->statusCodeEquals($response);
if ($response == 200) {
$this->assertText("Top 'page not found' errors", 'DBLog page-not-found report was displayed');
$this->assertText("Top 'page not found' errors");
}
// View the database log access-denied report page.
$this->drupalGet('admin/reports/access-denied');
$this->assertSession()->statusCodeEquals($response);
if ($response == 200) {
$this->assertText("Top 'access denied' errors", 'DBLog access-denied report was displayed');
$this->assertText("Top 'access denied' errors");
}
// View the database log event page.
@ -337,7 +337,7 @@ class DbLogTest extends BrowserTestBase {
$this->drupalGet('admin/reports/dblog/event/' . $wid);
$this->assertSession()->statusCodeEquals($response);
if ($response == 200) {
$this->assertText('Details', 'DBLog event node was displayed');
$this->assertText('Details');
}
}
@ -382,7 +382,7 @@ class DbLogTest extends BrowserTestBase {
public function verifySort($sort = 'asc', $order = 'Date') {
$this->drupalGet('admin/reports/dblog', ['query' => ['sort' => $sort, 'order' => $order]]);
$this->assertSession()->statusCodeEquals(200);
$this->assertText('Recent log messages', 'DBLog report was displayed correctly and sorting went fine.');
$this->assertText('Recent log messages');
}
/**
@ -482,7 +482,7 @@ class DbLogTest extends BrowserTestBase {
$this->drupalGet('admin/reports/page-not-found');
$this->assertSession()->statusCodeEquals(200);
// Check that full-length URL displayed.
$this->assertText($not_found_url, 'DBLog event was recorded: [page not found]');
$this->assertText($not_found_url);
}
/**
@ -539,13 +539,13 @@ class DbLogTest extends BrowserTestBase {
$this->drupalGet('admin/reports/access-denied');
$this->assertSession()->statusCodeEquals(200);
// Verify that the 'access denied' event was recorded.
$this->assertText('admin/reports/dblog', 'DBLog event was recorded: [access denied]');
$this->assertText('admin/reports/dblog');
// View the database log page-not-found report page.
$this->drupalGet('admin/reports/page-not-found');
$this->assertSession()->statusCodeEquals(200);
// Verify that the 'page not found' event was recorded.
$this->assertText('node/' . $node->id(), 'DBLog event was recorded: [page not found]');
$this->assertText('node/' . $node->id());
}
/**
@ -696,13 +696,13 @@ class DbLogTest extends BrowserTestBase {
$this->drupalGet('admin/reports/dblog', ['query' => ['order' => 'Type']]);
$this->assertSession()->statusCodeEquals(200);
$this->assertText('Operations', 'Operations text found');
$this->assertText('Operations');
// Clear all logs and make sure the confirmation message is found.
$this->clearLogsEntries();
// Confirm that the logs should be cleared.
$this->submitForm([], 'Confirm');
$this->assertText('Database log cleared.', 'Confirmation message found');
$this->assertText('Database log cleared.');
}
/**

View File

@ -107,7 +107,7 @@ class BooleanFieldTest extends BrowserTestBase {
// Display creation form.
$this->drupalGet('entity_test/add');
$this->assertSession()->fieldValueEquals("{$field_name}[value]", '');
$this->assertText($this->field->label(), 'Uses field label by default.');
$this->assertText($this->field->label());
$this->assertNoRaw($on);
// Submit and ensure it is accepted.
@ -157,10 +157,7 @@ class BooleanFieldTest extends BrowserTestBase {
// Click on the widget settings button to open the widget settings form.
$this->submitForm([], $field_name . "_settings_edit");
$this->assertText(
'Use field label instead of the "On" label as the label.',
t('Display setting checkbox available.')
);
$this->assertText('Use field label instead of the "On" label as the label.');
// Enable setting.
$edit = ['fields[' . $field_name . '][settings_edit_form][settings][display_label]' => 1];
@ -170,13 +167,10 @@ class BooleanFieldTest extends BrowserTestBase {
// Go again to the form display page and check if the setting
// is stored and has the expected effect.
$this->drupalGet($fieldEditUrl);
$this->assertText('Use field label: Yes', 'Checking the display settings checkbox updated the value.');
$this->assertText('Use field label: Yes');
$this->submitForm([], $field_name . "_settings_edit");
$this->assertText(
'Use field label instead of the "On" label as the label.',
t('Display setting checkbox is available')
);
$this->assertText('Use field label instead of the "On" label as the label.');
$this->getSession()->getPage()->hasCheckedField('fields[' . $field_name . '][settings_edit_form][settings][display_label]');
// Test the boolean field settings.

View File

@ -144,8 +144,8 @@ class EntityReferenceAutoCreateTest extends BrowserTestBase {
// Now try to view the node and check that the referenced node is shown.
$this->drupalGet('node/' . $referencing_node->id());
$this->assertText($referencing_node->label(), 'Referencing node label found.');
$this->assertText($referenced_node->label(), 'Referenced node label found.');
$this->assertText($referencing_node->label());
$this->assertText($referenced_node->label());
}
/**

View File

@ -180,13 +180,13 @@ class EntityReferenceFieldTranslatedReferenceViewTest extends BrowserTestBase {
$translation_url = $this->referrerEntity->toUrl('canonical', ['language' => ConfigurableLanguage::load($this->translateToLangcode)]);
$this->drupalGet($url);
$this->assertText($this->labelOfNotTranslatedReference, 'The label of not translated reference is displayed.');
$this->assertText($this->originalLabel, 'The default label of translated reference is displayed.');
$this->assertNoText($this->translatedLabel, 'The translated label of translated reference is not displayed.');
$this->assertText($this->labelOfNotTranslatedReference);
$this->assertText($this->originalLabel);
$this->assertNoText($this->translatedLabel);
$this->drupalGet($translation_url);
$this->assertText($this->labelOfNotTranslatedReference, 'The label of not translated reference is displayed.');
$this->assertNoText($this->originalLabel, 'The default label of translated reference is not displayed.');
$this->assertText($this->translatedLabel, 'The translated label of translated reference is displayed.');
$this->assertText($this->labelOfNotTranslatedReference);
$this->assertNoText($this->originalLabel);
$this->assertText($this->translatedLabel);
}
/**

View File

@ -59,7 +59,9 @@ class FieldHelpTest extends BrowserTestBase {
$this->drupalGet('admin/help/field');
$this->assertSession()->linkExists('Options', 0, 'Options module is listed on the Field help page.');
$this->assertText('Field API Test', 'Modules with field types that do not implement hook_help are listed.');
// Verify that modules with field types that do not implement hook_help are
// listed.
$this->assertText('Field API Test');
$this->assertSession()->linkNotExists('Field API Test', 'Modules with field types that do not implement hook_help are not linked.');
$this->assertSession()->linkNotExists('Link', 'Modules that have not been installed, are not listed.');
}

View File

@ -121,17 +121,17 @@ class FormTest extends FieldTestBase {
// Create token value expected for description.
$token_description = Html::escape($this->config('system.site')->get('name')) . '_description';
$this->assertText($token_description, 'Token replacement for description is displayed');
$this->assertText($token_description);
$this->assertSession()->fieldValueEquals("{$field_name}[0][value]", '');
// Verify that no extraneous widget is displayed.
$this->assertSession()->fieldNotExists("{$field_name}[1][value]");
// Check that hook_field_widget_form_alter() does not believe this is the
// default value form.
$this->assertNoText('From hook_field_widget_form_alter(): Default form is true.', 'Not default value form in hook_field_widget_form_alter().');
$this->assertNoText('From hook_field_widget_form_alter(): Default form is true.');
// Check that hook_field_widget_form_alter() does not believe this is the
// default value form.
$this->assertNoText('From hook_field_widget_multivalue_form_alter(): Default form is true.', 'Not default value form in hook_field_widget_form_alter().');
$this->assertNoText('From hook_field_widget_multivalue_form_alter(): Default form is true.');
// Submit with invalid value (field-level validation).
$edit = [
@ -149,7 +149,7 @@ class FormTest extends FieldTestBase {
$this->submitForm($edit, 'Save');
preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match);
$id = $match[1];
$this->assertText('entity_test ' . $id . ' has been created.', 'Entity was created');
$this->assertText('entity_test ' . $id . ' has been created.');
$entity = EntityTest::load($id);
$this->assertEqual($entity->{$field_name}->value, $value, 'Field value was saved');
@ -166,7 +166,7 @@ class FormTest extends FieldTestBase {
"{$field_name}[0][value]" => $value,
];
$this->submitForm($edit, 'Save');
$this->assertText('entity_test ' . $id . ' has been updated.', 'Entity was updated');
$this->assertText('entity_test ' . $id . ' has been updated.');
$this->container->get('entity_type.manager')->getStorage('entity_test')->resetCache([$id]);
$entity = EntityTest::load($id);
$this->assertEqual($entity->{$field_name}->value, $value, 'Field value was updated');
@ -177,7 +177,7 @@ class FormTest extends FieldTestBase {
"{$field_name}[0][value]" => $value,
];
$this->drupalPostForm('entity_test/manage/' . $id . '/edit', $edit, 'Save');
$this->assertText('entity_test ' . $id . ' has been updated.', 'Entity was updated');
$this->assertText('entity_test ' . $id . ' has been updated.');
$this->container->get('entity_type.manager')->getStorage('entity_test')->resetCache([$id]);
$entity = EntityTest::load($id);
$this->assertTrue($entity->{$field_name}->isEmpty(), 'Field was emptied');
@ -211,7 +211,7 @@ class FormTest extends FieldTestBase {
$this->submitForm($edit, 'Save');
preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match);
$id = $match[1];
$this->assertText('entity_test ' . $id . ' has been created.', 'Entity was created.');
$this->assertText('entity_test ' . $id . ' has been created.');
$entity = EntityTest::load($id);
$this->assertTrue($entity->{$field_name}->isEmpty(), 'Field is now empty.');
}
@ -241,7 +241,7 @@ class FormTest extends FieldTestBase {
$this->submitForm($edit, 'Save');
preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match);
$id = $match[1];
$this->assertText('entity_test ' . $id . ' has been created.', 'Entity was created');
$this->assertText('entity_test ' . $id . ' has been created.');
$entity = EntityTest::load($id);
$this->assertEqual($entity->{$field_name}->value, $value, 'Field value was saved');
@ -327,7 +327,7 @@ class FormTest extends FieldTestBase {
$this->submitForm($edit, 'Save');
preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match);
$id = $match[1];
$this->assertText('entity_test ' . $id . ' has been created.', 'Entity was created');
$this->assertText('entity_test ' . $id . ' has been created.');
$entity = EntityTest::load($id);
ksort($field_values);
$field_values = array_values($field_values);
@ -601,7 +601,7 @@ class FormTest extends FieldTestBase {
$this->submitForm([], 'Save');
preg_match('|' . $entity_type . '/manage/(\d+)|', $this->getUrl(), $match);
$id = $match[1];
$this->assertText('entity_test_rev ' . $id . ' has been created.', 'Entity was created');
$this->assertText('entity_test_rev ' . $id . ' has been created.');
$storage = $this->container->get('entity_type.manager')
->getStorage($entity_type);
@ -627,7 +627,7 @@ class FormTest extends FieldTestBase {
$value = mt_rand(1, 127);
$edit = ["{$field_name}[0][value]" => $value];
$this->submitForm($edit, 'Save');
$this->assertText('entity_test_rev ' . $id . ' has been updated.', 'Entity was updated');
$this->assertText('entity_test_rev ' . $id . ' has been updated.');
$storage->resetCache([$id]);
$entity = $storage->load($id);
$this->assertEqual($entity->{$field_name}->value, $value, 'Field value was updated');

View File

@ -86,7 +86,7 @@ class NumberFieldTest extends BrowserTestBase {
$this->submitForm($edit, 'Save');
preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match);
$id = $match[1];
$this->assertText('entity_test ' . $id . ' has been created.', 'Entity was created');
$this->assertText('entity_test ' . $id . ' has been created.');
$this->assertRaw($value);
// Try to create entries with more than one decimal separator; assert fail.
@ -201,7 +201,7 @@ class NumberFieldTest extends BrowserTestBase {
$this->submitForm($edit, 'Save');
preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match);
$id = $match[1];
$this->assertText('entity_test ' . $id . ' has been created.', 'Entity was created');
$this->assertText('entity_test ' . $id . ' has been created.');
// Try to set a value below the minimum value
$this->drupalGet('entity_test/add');
@ -250,7 +250,7 @@ class NumberFieldTest extends BrowserTestBase {
$this->submitForm($edit, 'Save');
preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match);
$id = $match[1];
$this->assertText('entity_test ' . $id . ' has been created.', 'Entity was created');
$this->assertText('entity_test ' . $id . ' has been created.');
$this->assertRaw($valid_entry);
// Verify that the "content" attribute is not present since the Prefix is
// not being displayed.
@ -274,7 +274,7 @@ class NumberFieldTest extends BrowserTestBase {
$this->submitForm($edit, 'Save');
preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match);
$id = $match[1];
$this->assertText('entity_test ' . $id . ' has been created.', 'Entity was created');
$this->assertText('entity_test ' . $id . ' has been created.');
$this->drupalGet('entity_test/' . $id);
// Verify that the "content" attribute has been set to the value of the
// field, and the prefix is being displayed.
@ -330,7 +330,7 @@ class NumberFieldTest extends BrowserTestBase {
$this->submitForm($edit, 'Save');
preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match);
$id = $match[1];
$this->assertText('entity_test ' . $id . ' has been created.', 'Entity was created');
$this->assertText('entity_test ' . $id . ' has been created.');
// Ensure that the 'number_decimal' formatter displays the number with the
// expected rounding.

View File

@ -102,7 +102,7 @@ class StringFieldTest extends BrowserTestBase {
$this->submitForm($edit, 'Save');
preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match);
$id = $match[1];
$this->assertText('entity_test ' . $id . ' has been created.', 'Entity was created');
$this->assertText('entity_test ' . $id . ' has been created.');
// Display the entity.
$entity = EntityTest::load($id);

View File

@ -188,7 +188,7 @@ class ManageDisplayTest extends BrowserTestBase {
*/
public function testSingleViewMode() {
$this->drupalGet('admin/structure/taxonomy/manage/' . $this->vocabulary . '/display');
$this->assertNoText('Use custom display settings for the following view modes', 'Custom display settings fieldset found.');
$this->assertNoText('Use custom display settings for the following view modes');
// This may not trigger a notice when 'view_modes_custom' isn't available.
$this->drupalPostForm('admin/structure/taxonomy/manage/' . $this->vocabulary . '/overview/display', [], 'Save');

View File

@ -233,7 +233,7 @@ class ManageFieldsFunctionalTest extends BrowserTestBase {
$edit = [
'settings[test_field_setting]' => $string,
];
$this->assertText('Default value', 'Default value heading is shown');
$this->assertText('Default value');
$this->submitForm($edit, 'Save settings');
// Assert the field settings are correct.
@ -463,12 +463,12 @@ class ManageFieldsFunctionalTest extends BrowserTestBase {
// Check that invalid default values are rejected.
$edit = [$element_name => '-1'];
$this->drupalPostForm($admin_path, $edit, 'Save settings');
$this->assertText("$field_name does not accept the value -1", 'Form validation failed.');
$this->assertText("$field_name does not accept the value -1");
// Check that the default value is saved.
$edit = [$element_name => '1'];
$this->drupalPostForm($admin_path, $edit, 'Save settings');
$this->assertText("Saved $field_name configuration", 'The form was successfully submitted.');
$this->assertText("Saved $field_name configuration");
$field = FieldConfig::loadByName('node', $this->contentType, $field_name);
$this->assertEqual($field->getDefaultValueLiteral(), [['value' => 1]], 'The default value was correctly saved.');
@ -479,7 +479,7 @@ class ManageFieldsFunctionalTest extends BrowserTestBase {
// Check that the default value can be emptied.
$edit = [$element_name => ''];
$this->submitForm($edit, 'Save settings');
$this->assertText("Saved $field_name configuration", 'The form was successfully submitted.');
$this->assertText("Saved $field_name configuration");
$field = FieldConfig::loadByName('node', $this->contentType, $field_name);
$this->assertEqual($field->getDefaultValueLiteral(), [], 'The default value was correctly saved.');
@ -497,7 +497,7 @@ class ManageFieldsFunctionalTest extends BrowserTestBase {
$this->drupalGet($admin_path);
$this->submitForm([], 'Save settings');
$this->assertText("Saved $field_name configuration", 'The form was successfully submitted.');
$this->assertText("Saved $field_name configuration");
$field = FieldConfig::loadByName('node', $this->contentType, $field_name);
$this->assertEqual($field->getDefaultValueLiteral(), [], 'The default value was correctly saved.');
@ -736,7 +736,7 @@ class ManageFieldsFunctionalTest extends BrowserTestBase {
// Check that hook_field_widget_form_alter() does believe this is the
// default value form.
$this->drupalGet('admin/structure/types/manage/article/fields/node.article.field_tags');
$this->assertText('From hook_field_widget_form_alter(): Default form is true.', 'Default value form in hook_field_widget_form_alter().');
$this->assertText('From hook_field_widget_form_alter(): Default form is true.');
$edit = [
'description' => '<em>Test with a non upload field.',
@ -753,7 +753,7 @@ class ManageFieldsFunctionalTest extends BrowserTestBase {
*/
public function fieldListAdminPage() {
$this->drupalGet('admin/reports/fields');
$this->assertText($this->fieldName, 'Field name is displayed in field list.');
$this->assertText($this->fieldName);
$this->assertSession()->linkByHrefExists('admin/structure/types/manage/' . $this->contentType . '/fields');
}

View File

@ -50,7 +50,7 @@ class FileFieldAnonymousSubmissionTest extends FileFieldTestBase {
$this->submitForm($edit, 'Save');
$this->assertSession()->statusCodeEquals(200);
$t_args = ['@type' => $bundle_label, '%title' => $node_title];
$this->assertText(strip_tags(t('@type %title has been created.', $t_args)), 'The node was created.');
$this->assertText(strip_tags(t('@type %title has been created.', $t_args)));
$matches = [];
if (preg_match('@node/(\d+)$@', $this->getUrl(), $matches)) {
$nid = end($matches);
@ -86,7 +86,7 @@ class FileFieldAnonymousSubmissionTest extends FileFieldTestBase {
$this->submitForm($edit, 'Save');
$this->assertSession()->statusCodeEquals(200);
$t_args = ['@type' => $bundle_label, '%title' => $node_title];
$this->assertText(strip_tags(t('@type %title has been created.', $t_args)), 'The node was created.');
$this->assertText(strip_tags(t('@type %title has been created.', $t_args)));
$matches = [];
if (preg_match('@node/(\d+)$@', $this->getUrl(), $matches)) {
$nid = end($matches);
@ -148,7 +148,7 @@ class FileFieldAnonymousSubmissionTest extends FileFieldTestBase {
$this->submitForm($edit, $label);
$this->assertSession()->statusCodeEquals(200);
$t_args = ['@type' => $bundle_label, '%title' => $node_title];
$this->assertNoText(strip_tags(t('@type %title has been created.', $t_args)), 'The node was created.');
$this->assertNoText(strip_tags(t('@type %title has been created.', $t_args)));
$this->assertText('Title field is required.');
// Submit the form again but this time with the missing title field. This
@ -160,7 +160,7 @@ class FileFieldAnonymousSubmissionTest extends FileFieldTestBase {
// Confirm the final submission actually worked.
$t_args = ['@type' => $bundle_label, '%title' => $node_title];
$this->assertText(strip_tags(t('@type %title has been created.', $t_args)), 'The node was created.');
$this->assertText(strip_tags(t('@type %title has been created.', $t_args)));
$matches = [];
if (preg_match('@node/(\d+)$@', $this->getUrl(), $matches)) {
$nid = end($matches);

View File

@ -2,7 +2,6 @@
namespace Drupal\Tests\file\Functional;
use Drupal\Component\Render\FormattableMarkup;
use Drupal\Core\Field\FieldStorageDefinitionInterface;
use Drupal\file\Entity\File;
use Drupal\node\Entity\Node;
@ -56,7 +55,8 @@ class FileFieldDisplayTest extends FileFieldTestBase {
}
$this->drupalPostForm("admin/structure/types/manage/$type_name/display", $edit, 'Save');
$this->drupalGet('node/' . $node->id());
$this->assertNoText($field_name, new FormattableMarkup('Field label is hidden when no file attached for formatter %formatter', ['%formatter' => $formatter]));
// Verify that the field label is hidden when no file is attached.
$this->assertNoText($field_name);
}
$this->generateFile('escaped-&-text', 64, 10, 'text');

View File

@ -146,13 +146,16 @@ class FileListingTest extends FileFieldTestBase {
$usage = $file_usage->listUsage($file);
$this->drupalGet('admin/content/files/usage/' . $file->id());
$this->assertSession()->statusCodeEquals(200);
$this->assertText($node->getTitle(), 'Node title found on usage page.');
$this->assertText('node', 'Registering entity type found on usage page.');
$this->assertText('file', 'Registering module found on usage page.');
$this->assertText($node->getTitle());
// Verify that registering entity type is found on usage page.
$this->assertText('node');
// Verify that registering module is found on usage page.
$this->assertText('file');
foreach ($usage as $module) {
foreach ($module as $entity_type) {
foreach ($entity_type as $entity) {
$this->assertText($entity, 'Usage count found on usage page.');
// Verify that usage count is found on usage page.
$this->assertText($entity);
}
}
}
@ -204,7 +207,7 @@ class FileListingTest extends FileFieldTestBase {
$this->assertSession()->statusCodeEquals(200);
// Entity name should be displayed, but not linked if Entity::toUrl
// throws an exception
$this->assertText($entity_name, 'Entity name is added to file usage listing.');
$this->assertText($entity_name);
$this->assertSession()->linkNotExists($entity_name, 'Linked entity name not added to file usage listing.');
$this->assertSession()->linkExists($node->getTitle());
}

View File

@ -302,7 +302,7 @@ class FilterAdminTest extends BrowserTestBase {
$edit['body[0][value]'] = $text;
$edit['body[0][format]'] = $basic;
$this->drupalPostForm('node/add/page', $edit, 'Save');
$this->assertText('Basic page ' . $edit['title[0][value]'] . ' has been created.', 'Filtered node created.');
$this->assertText('Basic page ' . $edit['title[0][value]'] . ' has been created.');
// Verify that the creation message contains a link to a node.
$view_link = $this->xpath('//div[contains(@class, "messages")]//a[contains(@href, :href)]', [':href' => 'node/']);

View File

@ -242,13 +242,13 @@ class FilterFormatAccessTest extends BrowserTestBase {
$new_edit = [];
$new_edit['title[0][value]'] = $this->randomMachineName(8);
$this->submitForm($new_edit, 'Preview');
$this->assertText($edit[$body_value_key], 'Old body found in preview.');
$this->assertText($edit[$body_value_key]);
// Save and verify that only the title was changed.
$this->drupalPostForm('node/' . $node->id() . '/edit', $new_edit, 'Save');
$this->assertNoText($edit['title[0][value]'], 'Old title not found.');
$this->assertText($new_edit['title[0][value]'], 'New title found.');
$this->assertText($edit[$body_value_key], 'Old body found.');
$this->assertNoText($edit['title[0][value]']);
$this->assertText($new_edit['title[0][value]']);
$this->assertText($edit[$body_value_key]);
// Check that even an administrator with "administer filters" permission
// cannot edit the body field if they do not have specific permission to
@ -286,17 +286,17 @@ class FilterFormatAccessTest extends BrowserTestBase {
$edit = [];
$edit['title[0][value]'] = $new_title;
$this->drupalPostForm('node/' . $node->id() . '/edit', $edit, 'Save');
$this->assertText('Text format field is required.', 'Error message is displayed.');
$this->assertText('Text format field is required.');
$this->drupalGet('node/' . $node->id());
$this->assertText($old_title, 'Old title found.');
$this->assertNoText($new_title, 'New title not found.');
$this->assertText($old_title);
$this->assertNoText($new_title);
// 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, 'Save');
$this->assertSession()->addressEquals('node/' . $node->id());
$this->assertText($new_title, 'New title found.');
$this->assertNoText($old_title, 'Old title not found.');
$this->assertText($new_title);
$this->assertNoText($old_title);
// Switch the text format to a new one, then disable that format and all
// other formats on the site (leaving only the fallback format).
@ -321,15 +321,15 @@ class FilterFormatAccessTest extends BrowserTestBase {
$edit = [];
$edit['title[0][value]'] = $new_title;
$this->drupalPostForm('node/' . $node->id() . '/edit', $edit, 'Save');
$this->assertText('Text format field is required.', 'Error message is displayed.');
$this->assertText('Text format field is required.');
$this->drupalGet('node/' . $node->id());
$this->assertText($old_title, 'Old title found.');
$this->assertNoText($new_title, 'New title not found.');
$this->assertText($old_title);
$this->assertNoText($new_title);
$edit[$body_format_key] = filter_fallback_format();
$this->drupalPostForm('node/' . $node->id() . '/edit', $edit, 'Save');
$this->assertSession()->addressEquals('node/' . $node->id());
$this->assertText($new_title, 'New title found.');
$this->assertNoText($old_title, 'Old title not found.');
$this->assertText($new_title);
$this->assertNoText($old_title);
}
/**

View File

@ -66,7 +66,7 @@ class FilterSecurityTest extends BrowserTestBase {
$body_raw = $node->body->value;
$format_id = $node->body->format;
$this->drupalGet('node/' . $node->id());
$this->assertText($body_raw, 'Node body found.');
$this->assertText($body_raw);
// Enable the filter_test_replace filter.
$edit = [
@ -76,15 +76,15 @@ class FilterSecurityTest extends BrowserTestBase {
// Verify that filter_test_replace filter replaced the content.
$this->drupalGet('node/' . $node->id());
$this->assertNoText($body_raw, 'Node body not found.');
$this->assertText('Filter: Testing filter', 'Testing filter output found.');
$this->assertNoText($body_raw);
$this->assertText('Filter: Testing filter');
// Disable the text format entirely.
$this->drupalPostForm('admin/config/content/formats/manage/' . $format_id . '/disable', [], 'Disable');
// Verify that the content is empty, because the text format does not exist.
$this->drupalGet('node/' . $node->id());
$this->assertNoText($body_raw, 'Node body not found.');
$this->assertNoText($body_raw);
}
/**

View File

@ -78,7 +78,7 @@ class ForumBlockTest extends BrowserTestBase {
$this->assertSession()->linkExists($topics[$index], 0, new FormattableMarkup('Forum topic @topic found in the "New forum topics" block.', ['@topic' => $topics[$index]]));
}
else {
$this->assertNoText($topics[$index], new FormattableMarkup('Forum topic @topic not found in the "New forum topics" block.', ['@topic' => $topics[$index]]));
$this->assertNoText($topics[$index]);
}
}
}
@ -124,7 +124,7 @@ class ForumBlockTest extends BrowserTestBase {
$this->assertSession()->linkExists($topics[$index], 0, new FormattableMarkup('Forum topic @topic found in the "Active forum topics" block.', ['@topic' => $topics[$index]]));
}
else {
$this->assertNoText($topics[$index], new FormattableMarkup('Forum topic @topic not found in the "Active forum topics" block.', ['@topic' => $topics[$index]]));
$this->assertNoText($topics[$index]);
}
}
@ -141,7 +141,7 @@ class ForumBlockTest extends BrowserTestBase {
$this->assertSession()->linkExists($topics[$index], 0, 'Forum topic found in the "Active forum topics" block.');
}
else {
$this->assertNoText($topics[$index], 'Forum topic not found in the "Active forum topics" block.');
$this->assertNoText($topics[$index]);
}
}
}

View File

@ -74,7 +74,7 @@ class ForumIndexTest extends BrowserTestBase {
// Verify that the node appears on the index.
$this->drupalGet('forum/' . $tid);
$this->assertText($title, 'Published forum topic appears on index.');
$this->assertText($title);
$this->assertSession()->responseHeaderContains('X-Drupal-Cache-Tags', 'node_list');
$this->assertSession()->responseHeaderContains('X-Drupal-Cache-Tags', 'config:node.type.forum');
$this->assertSession()->responseHeaderContains('X-Drupal-Cache-Tags', 'comment_list');
@ -86,11 +86,11 @@ class ForumIndexTest extends BrowserTestBase {
$edit = ['status[value]' => FALSE];
$this->drupalPostForm('node/' . $node->id() . '/edit', $edit, 'Save');
$this->drupalGet('node/' . $node->id());
$this->assertText('Access denied', 'Unpublished node is no longer accessible.');
$this->assertText('Access denied');
// Verify that the node no longer appears on the index.
$this->drupalGet('forum/' . $tid);
$this->assertNoText($title, 'Unpublished forum topic no longer appears on index.');
$this->assertNoText($title);
}
}

View File

@ -88,16 +88,16 @@ class ForumNodeAccessTest extends BrowserTestBase {
$this->drupalGet('');
// Ensure private node and public node are found.
$this->assertText($private_node->getTitle(), 'Private node found in block by $access_user');
$this->assertText($public_node->getTitle(), 'Public node found in block by $access_user');
$this->assertText($private_node->getTitle());
$this->assertText($public_node->getTitle());
// Test for $no_access_user.
$this->drupalLogin($no_access_user);
$this->drupalGet('');
// Ensure private node is not found but public is found.
$this->assertNoText($private_node->getTitle(), 'Private node not found in block by $no_access_user');
$this->assertText($public_node->getTitle(), 'Public node found in block by $no_access_user');
$this->assertNoText($private_node->getTitle());
$this->assertText($public_node->getTitle());
}
}

View File

@ -171,7 +171,7 @@ class ForumTest extends BrowserTestBase {
$this->drupalLogin($this->webUser);
// Verify that this user is shown a message that they may not post content.
$this->drupalGet('forum/' . $this->forum['tid']);
$this->assertText('You are not allowed to post new content in the forum', "Authenticated user without permission to post forum content is shown message in local tasks to that effect.");
$this->assertText('You are not allowed to post new content in the forum');
// Log in, and do basic tests for a user with permission to edit any forum
// content.
@ -440,9 +440,7 @@ class ForumTest extends BrowserTestBase {
$this->drupalPostForm('admin/structure/forum/add/' . $type, $edit, 'Save');
$this->assertSession()->statusCodeEquals(200);
$type = ($type == 'container') ? 'forum container' : 'forum';
$this->assertText('Created new ' . $type . ' ' . $name . '.',
new FormattableMarkup('@type was created', ['@type' => ucfirst($type)])
);
$this->assertText('Created new ' . $type . ' ' . $name . '.');
// Verify that the creation message contains a link to a term.
$this->assertSession()->elementExists('xpath', '//div[@data-drupal-messages]//a[contains(@href, "term/")]');
@ -576,12 +574,12 @@ class ForumTest extends BrowserTestBase {
$type = t('Forum topic');
if ($container) {
$this->assertNoText("$type $title has been created.", 'Forum topic was not created');
$this->assertNoText("$type $title has been created.");
$this->assertRaw(t('The item %title is a forum container, not a forum.', ['%title' => $forum['name']]));
return;
}
else {
$this->assertText($type . ' ' . $title . ' has been created.', 'Forum topic was created');
$this->assertText($type . ' ' . $title . ' has been created.');
$this->assertNoRaw(t('The item %title is a forum container, not a forum.', ['%title' => $forum['name']]));
// Verify that the creation message contains a link to a node.
@ -619,7 +617,7 @@ class ForumTest extends BrowserTestBase {
$this->assertSession()->statusCodeEquals($response2);
if ($response2 == 200) {
$this->assertSession()->titleEquals('Forum | Drupal');
$this->assertText('Forum', 'Forum help node was displayed');
$this->assertText('Forum');
}
// View forum container page.
@ -661,7 +659,7 @@ class ForumTest extends BrowserTestBase {
$edit['taxonomy_forums'] = $this->rootForum['tid'];
$edit['shadow'] = TRUE;
$this->drupalPostForm('node/' . $node->id() . '/edit', $edit, 'Save');
$this->assertText('Forum topic ' . $edit['title[0][value]'] . ' has been updated.', 'Forum node was edited');
$this->assertText('Forum topic ' . $edit['title[0][value]'] . ' has been updated.');
// Verify topic was moved to a different forum.
$forum_tid = $this->container

View File

@ -45,7 +45,9 @@ class NoHelpTest extends BrowserTestBase {
$this->assertSession()->statusCodeEquals(200);
$this->assertText('Module overviews are provided by modules');
$this->assertFalse(\Drupal::moduleHandler()->implementsHook('menu_test', 'help'), 'The menu_test module does not implement hook_help');
$this->assertNoText(\Drupal::moduleHandler()->getName('menu_test'), 'Making sure the test module menu_test does not display a help link on admin/help.');
// Make sure the test module menu_test does not display a help link on
// admin/help.
$this->assertNoText(\Drupal::moduleHandler()->getName('menu_test'));
// Ensure that the module overview help page for a module that does not
// implement hook_help() results in a 404.

View File

@ -249,7 +249,7 @@ class HelpTopicSearchTest extends HelpTopicTranslatedTestBase {
$edit['uninstall[help_topics]'] = TRUE;
$this->drupalPostForm('admin/modules/uninstall', $edit, 'Uninstall');
$this->submitForm([], 'Uninstall');
$this->assertText('The selected modules have been uninstalled.', 'Modules status has been updated.');
$this->assertText('The selected modules have been uninstalled.');
$this->drupalGet('admin/help');
$this->assertSession()->statusCodeEquals(200);
}

View File

@ -348,7 +348,7 @@ class ImageAdminStylesTest extends ImageFieldTestBase {
'label' => $new_style_label,
];
$this->drupalPostForm($style_path . $style_name, $edit, 'Save');
$this->assertText('Changes to the style have been saved.', new FormattableMarkup('Style %name was renamed to %new_name.', ['%name' => $style_name, '%new_name' => $new_style_name]));
$this->assertText('Changes to the style have been saved.');
$this->drupalGet('node/' . $nid);
// Reload the image style using the new name.

View File

@ -262,9 +262,9 @@ class ImageFieldDisplayTest extends ImageFieldTestBase {
$this->assertSession()->fieldValueEquals('settings[min_resolution][y]', '10');
$this->drupalGet('node/add/article');
$this->assertText('50 KB limit.', 'Image widget max file size is displayed on article form.');
$this->assertText('Allowed types: ' . $test_image_extension . '.', 'Image widget allowed file types displayed on article form.');
$this->assertText('Images must be larger than 10x10 pixels. Images larger than 100x100 pixels will be resized.', 'Image widget allowed resolution displayed on article form.');
$this->assertText('50 KB limit.');
$this->assertText('Allowed types: ' . $test_image_extension . '.');
$this->assertText('Images must be larger than 10x10 pixels. Images larger than 100x100 pixels will be resized.');
// We have to create the article first and then edit it because the alt
// and title fields do not display until the image has been attached.

View File

@ -101,7 +101,7 @@ class LanguageConfigurationTest extends BrowserTestBase {
'prefix[fr]' => '',
];
$this->submitForm($edit, 'Save configuration');
$this->assertNoText('The prefix may only be left blank for the selected detection fallback language.', 'The path prefix can be removed for the default language');
$this->assertNoText('The prefix may only be left blank for the selected detection fallback language.');
// Change default negotiation language.
$this->config('language.negotiation')->set('selected_langcode', 'fr')->save();
@ -118,7 +118,7 @@ class LanguageConfigurationTest extends BrowserTestBase {
'prefix[en]' => 'foo/bar',
];
$this->submitForm($edit, 'Save configuration');
$this->assertText('The prefix may not contain a slash.', 'English prefix cannot be changed to contain a slash.');
$this->assertText('The prefix may not contain a slash.');
// Remove English language and add a new Language to check if langcode of
// Language entity is 'en'.

View File

@ -48,7 +48,7 @@ class LanguageListTest extends BrowserTestBase {
'predefined_langcode' => 'fr',
];
$this->drupalPostForm('admin/config/regional/language/add', $edit, 'Add language');
$this->assertText('French', 'Language added successfully.');
$this->assertText('French');
$this->assertSession()->addressEquals(Url::fromRoute('entity.configurable_language.collection'));
// Get the weight of the last language and check that the weight is one unit
@ -71,7 +71,7 @@ class LanguageListTest extends BrowserTestBase {
$this->drupalPostForm('admin/config/regional/language/add', $edit, 'Add custom language');
$this->assertSession()->addressEquals(Url::fromRoute('entity.configurable_language.collection'));
$this->assertRaw('"edit-languages-' . $langcode . '-weight"');
$this->assertText($name, 'Test language added.');
$this->assertText($name);
$language = \Drupal::service('language_manager')->getLanguage($langcode);
$english = \Drupal::service('language_manager')->getLanguage('en');
@ -115,7 +115,7 @@ class LanguageListTest extends BrowserTestBase {
// Ensure 'delete' link works.
$this->drupalGet('admin/config/regional/language');
$this->clickLink(t('Delete'));
$this->assertText('Are you sure you want to delete the language', '"Delete" link is correct.');
$this->assertText('Are you sure you want to delete the language');
// Delete a language.
$this->drupalGet('admin/config/regional/language/delete/' . $langcode);
// First test the 'cancel' link.
@ -159,7 +159,7 @@ class LanguageListTest extends BrowserTestBase {
];
$this->drupalPostForm('admin/config/regional/language/add', $edit, 'Add custom language');
$this->assertSession()->addressEquals(Url::fromRoute('entity.configurable_language.collection'));
$this->assertText($name, 'Name found.');
$this->assertText($name);
// Check if we can change the default language.
$path = 'admin/config/regional/language';

View File

@ -76,7 +76,7 @@ class LanguagePathMonolingualTest extends BrowserTestBase {
// Verify that links in this page can be followed and work.
$this->clickLink(t('Languages'));
$this->assertSession()->statusCodeEquals(200);
$this->assertText('Add language', 'Page contains the add language text');
$this->assertText('Add language');
}
}

View File

@ -85,7 +85,7 @@ class LanguageSwitchingTest extends BrowserTestBase {
protected function doTestLanguageBlockAuthenticated($block_label) {
// Assert that the language switching block is displayed on the frontpage.
$this->drupalGet('');
$this->assertText($block_label, 'Language switcher block found.');
$this->assertText($block_label);
// Assert that each list item and anchor element has the appropriate data-
// attributes.
@ -139,7 +139,7 @@ class LanguageSwitchingTest extends BrowserTestBase {
// Assert that the language switching block is displayed on the frontpage
// and ensure that the active class is added when query params are present.
$this->drupalGet('', ['query' => ['foo' => 'bar']]);
$this->assertText($block_label, 'Language switcher block found.');
$this->assertText($block_label);
// Assert that only the current language is marked as active.
$language_switchers = $this->xpath('//div[@id=:id]/ul/li', [':id' => 'block-test-language-block']);
@ -203,7 +203,7 @@ class LanguageSwitchingTest extends BrowserTestBase {
'domain[en]' => '',
];
$this->drupalPostForm('admin/config/regional/language/detection/url', $edit, 'Save configuration');
$this->assertText('The domain may not be left blank for English', 'The form does not allow blank domains.');
$this->assertText('The domain may not be left blank for English');
// Change the domain for the Italian language.
$edit = [
@ -212,7 +212,7 @@ class LanguageSwitchingTest extends BrowserTestBase {
'domain[it]' => 'it.example.com',
];
$this->drupalPostForm('admin/config/regional/language/detection/url', $edit, 'Save configuration');
$this->assertText('The configuration options have been saved', 'Domain configuration is saved.');
$this->assertText('The configuration options have been saved');
// Enable the language switcher block.
$this->drupalPlaceBlock('language_block:' . LanguageInterface::TYPE_INTERFACE, ['id' => 'test_language_block']);

View File

@ -409,7 +409,7 @@ class LanguageUILanguageNegotiationTest extends BrowserTestBase {
}
$this->container->get('language_manager')->reset();
$this->drupalGet($test['path'], $test['path_options'], $test['http_header']);
$this->assertText($test['expect'], $test['message']);
$this->assertText($test['expect']);
$this->assertText('Language negotiation method: ' . $test['expected_method_id']);
// Get the private file and ensure it is a 200. It is important to
@ -499,7 +499,7 @@ class LanguageUILanguageNegotiationTest extends BrowserTestBase {
'domain[en]' => '',
];
$this->drupalPostForm('admin/config/regional/language/detection/url', $edit, 'Save configuration');
$this->assertText('The domain may not be left blank for English', 'The form does not allow blank domains.');
$this->assertText('The domain may not be left blank for English');
$this->rebuildContainer();
// Change the domain for the Italian language.
@ -509,7 +509,7 @@ class LanguageUILanguageNegotiationTest extends BrowserTestBase {
'domain[it]' => 'it.example.com',
];
$this->drupalPostForm('admin/config/regional/language/detection/url', $edit, 'Save configuration');
$this->assertText('The configuration options have been saved', 'Domain configuration is saved.');
$this->assertText('The configuration options have been saved');
$this->rebuildContainer();
// Try to use an invalid domain.

View File

@ -69,7 +69,7 @@ class LanguageUrlRewritingTest extends BrowserTestBase {
// Check that URL rewriting is not applied to subrequests.
$this->drupalGet('language_test/subrequest');
$this->assertText($this->webUser->getAccountName(), 'Page correctly retrieved');
$this->assertText($this->webUser->getAccountName());
}
/**

View File

@ -98,7 +98,7 @@ class LocaleContentTest extends BrowserTestBase {
// Set the content type to use multilingual support.
$this->drupalGet("admin/structure/types/manage/{$type2->id()}");
$this->assertText('Language settings', 'Multilingual support widget present on content type configuration form.');
$this->assertText('Language settings');
$edit = [
'language_configuration[language_alterable]' => TRUE,
];
@ -118,7 +118,7 @@ class LocaleContentTest extends BrowserTestBase {
// Verify language select list is present.
$this->assertSession()->fieldExists('langcode[0][value]');
// Ensure language appears.
$this->assertText($name, 'Language present.');
$this->assertText($name);
// Create a node.
$node_title = $this->randomMachineName();

View File

@ -2,7 +2,6 @@
namespace Drupal\Tests\locale\Functional;
use Drupal\Component\Render\FormattableMarkup;
use Drupal\Core\Url;
use Drupal\Core\Database\Database;
use Drupal\Core\File\FileSystemInterface;
@ -147,7 +146,7 @@ class LocaleImportFunctionalTest extends BrowserTestBase {
'files[file]' => $name,
], 'Import');
$this->assertSession()->addressEquals(Url::fromRoute('locale.translate_import'));
$this->assertText('File to import not found.', 'File to import not found message.');
$this->assertText('File to import not found.');
// Try importing a .po file with overriding strings, and ensure existing
// strings are kept.
@ -164,7 +163,7 @@ class LocaleImportFunctionalTest extends BrowserTestBase {
'translation' => 'translated',
];
$this->drupalPostForm('admin/config/regional/translate', $search, 'Filter');
$this->assertText('No strings available.', 'String not overwritten by imported string.');
$this->assertText('No strings available.');
// This import should not have changed number of plural forms.
$locale_plurals = \Drupal::service('locale.plural.formula')->getNumberOfPlurals('fr');
@ -186,7 +185,7 @@ class LocaleImportFunctionalTest extends BrowserTestBase {
'translation' => 'translated',
];
$this->drupalPostForm('admin/config/regional/translate', $search, 'Filter');
$this->assertNoText('No strings available.', 'String overwritten by imported string.');
$this->assertNoText('No strings available.');
// This import should have changed number of plural forms.
$locale_plurals = \Drupal::service('locale.plural.formula')->reset()->getNumberOfPlurals('fr');
$this->assertEqual(3, $locale_plurals, 'Plural numbers changed.');
@ -226,7 +225,7 @@ class LocaleImportFunctionalTest extends BrowserTestBase {
'translation' => 'translated',
];
$this->drupalPostForm('admin/config/regional/translate', $search, 'Filter');
$this->assertText('No strings available.', 'Customized string not overwritten by imported string.');
$this->assertText('No strings available.');
// Try importing a .po file with overriding strings, and ensure existing
// customized strings are overwritten.
@ -245,7 +244,7 @@ class LocaleImportFunctionalTest extends BrowserTestBase {
'translation' => 'translated',
];
$this->drupalPostForm('admin/config/regional/translate', $search, 'Filter');
$this->assertNoText('No strings available.', 'Customized string overwritten by imported string.');
$this->assertNoText('No strings available.');
}
@ -291,8 +290,9 @@ class LocaleImportFunctionalTest extends BrowserTestBase {
'langcode' => $langcode,
'translation' => 'untranslated',
];
// Check that search finds the string as untranslated.
$this->drupalPostForm('admin/config/regional/translate', $search, 'Filter');
$this->assertText($str, 'Search found the string as untranslated.');
$this->assertText($str);
}
/**
@ -348,7 +348,7 @@ class LocaleImportFunctionalTest extends BrowserTestBase {
'translation' => 'all',
];
$this->drupalPostForm('admin/config/regional/translate', $search, 'Filter');
$this->assertText($config_string[1], new FormattableMarkup('Translation of @string found.', ['@string' => $config_string[0]]));
$this->assertText($config_string[1]);
}
// Test that translations got recorded in the config system.

View File

@ -76,7 +76,7 @@ class LocalePathTest extends BrowserTestBase {
// Check that the "xx" front page is readily available because path prefix
// negotiation is pre-configured.
$this->drupalGet($prefix);
$this->assertText('Welcome to Drupal', 'The "xx" front page is readily available.');
$this->assertText('Welcome to Drupal');
// Create a node.
$node = $this->drupalCreateNode(['type' => 'page']);
@ -102,11 +102,11 @@ class LocalePathTest extends BrowserTestBase {
// Confirm English language path alias works.
$this->drupalGet($english_path);
$this->assertText($node->label(), 'English alias works.');
$this->assertText($node->label());
// Confirm custom language path alias works.
$this->drupalGet($prefix . '/' . $custom_language_path);
$this->assertText($node->label(), 'Custom language alias works.');
$this->assertText($node->label());
// Create a custom path.
$custom_path = $this->randomMachineName(8);
@ -141,11 +141,11 @@ class LocalePathTest extends BrowserTestBase {
// Confirm that the custom path leads to the first node.
$this->drupalGet($custom_path);
$this->assertText($first_node->label(), 'Custom alias returns first node.');
$this->assertText($first_node->label());
// Confirm that the custom path with prefix leads to the second node.
$this->drupalGet($prefix . '/' . $custom_path);
$this->assertText($second_node->label(), 'Custom alias with prefix returns second node.');
$this->assertText($second_node->label());
}

View File

@ -178,7 +178,7 @@ class LocalePluralFormatTest extends BrowserTestBase {
$this->drupalGet('user');
// Member for time should be translated.
$this->assertText("seconde", "'Member for' text is translated.");
$this->assertText("seconde");
$path = 'admin/config/regional/translate/';
$search = [
@ -225,7 +225,7 @@ class LocalePluralFormatTest extends BrowserTestBase {
// second or minute.
$this->adminUser->set('created', time() - 2)->save();
$this->drupalGet('user');
$this->assertText("secondes updated", "'Member for' text is translated.");
$this->assertText("secondes updated");
}
/**

View File

@ -78,7 +78,8 @@ class LocaleTranslationUiTest extends BrowserTestBase {
// Reset locale cache.
$this->container->get('string_translation')->reset();
$this->assertRaw('"edit-languages-' . $langcode . '-weight"');
$this->assertText($name, 'Test language added.');
// Ensure that test language was added.
$this->assertText($name);
$this->drupalLogout();
// Add a whitespace at the end of string to ensure it is found.
@ -91,11 +92,12 @@ class LocaleTranslationUiTest extends BrowserTestBase {
'langcode' => $langcode,
'translation' => 'untranslated',
];
// Check that search finds the string as untranslated.
$this->drupalPostForm('admin/config/regional/translate', $search, 'Filter');
$this->assertText($name, 'Search found the string as untranslated.');
$this->assertText($name);
// No t() here, it's surely not translated yet.
$this->assertText($name, 'name found on edit screen.');
$this->assertText($name);
// Verify that there is no way to translate the string to English.
$this->assertSession()->optionNotExists('edit-langcode', 'en');
$this->drupalLogout();
@ -103,8 +105,9 @@ class LocaleTranslationUiTest extends BrowserTestBase {
$this->drupalPostForm('admin/config/regional/language/edit/en', ['locale_translate_english' => TRUE], 'Save language');
$this->drupalLogout();
$this->drupalLogin($translate_user);
// Check that search finds the string as untranslated.
$this->drupalPostForm('admin/config/regional/translate', $search, 'Filter');
$this->assertText($name, 'Search found the string as untranslated.');
$this->assertText($name);
// Assume this is the only result, given the random name.
$textarea = current($this->xpath('//textarea'));
@ -113,7 +116,7 @@ class LocaleTranslationUiTest extends BrowserTestBase {
$lid => $translation,
];
$this->drupalPostForm('admin/config/regional/translate', $edit, 'Save translations');
$this->assertText('The strings have been saved.', 'The strings have been saved.');
$this->assertText('The strings have been saved.');
$url_bits = explode('?', $this->getUrl());
$this->assertEqual($url_bits[0], Url::fromRoute('locale.translate_page', [], ['absolute' => TRUE])->toString(), 'Correct page redirection.');
$search = [
@ -161,7 +164,7 @@ class LocaleTranslationUiTest extends BrowserTestBase {
'translation' => 'untranslated',
];
$this->drupalPostForm('admin/config/regional/translate', $search, 'Filter');
$this->assertText('No strings available.', 'String is translated.');
$this->assertText('No strings available.');
// Test invalidation of 'rendered' cache tag after string translation.
$this->drupalLogout();
@ -223,7 +226,7 @@ class LocaleTranslationUiTest extends BrowserTestBase {
'translation' => 'untranslated',
];
$this->drupalPostForm('admin/config/regional/translate', $search, 'Filter');
$this->assertNoText('No strings available.', 'The translation has been removed');
$this->assertNoText('No strings available.');
}
/**
@ -347,7 +350,7 @@ class LocaleTranslationUiTest extends BrowserTestBase {
// Check for a form error on the textarea.
$form_class = $this->xpath('//form[@id="locale-translate-edit-form"]//textarea/@class');
$this->assertStringContainsString('error', $form_class[0]->getText(), 'The string was rejected as unsafe.');
$this->assertNoText('The string has been saved.', 'The string was not saved.');
$this->assertNoText('The string has been saved.');
}
}
@ -408,7 +411,7 @@ class LocaleTranslationUiTest extends BrowserTestBase {
// assertText() seems to remove the input field where $name always could be
// found, so this is not a false assert. See how assertNoText succeeds
// later.
$this->assertText($name, 'Search found the string.');
$this->assertText($name);
// Ensure untranslated string doesn't appear if searching on 'only
// translated strings'.
@ -418,7 +421,7 @@ class LocaleTranslationUiTest extends BrowserTestBase {
'translation' => 'translated',
];
$this->drupalPostForm('admin/config/regional/translate', $search, 'Filter');
$this->assertText('No strings available.', "Search didn't find the string.");
$this->assertText('No strings available.');
// Ensure untranslated string appears if searching on 'only untranslated
// strings'.
@ -428,7 +431,7 @@ class LocaleTranslationUiTest extends BrowserTestBase {
'translation' => 'untranslated',
];
$this->drupalPostForm('admin/config/regional/translate', $search, 'Filter');
$this->assertNoText('No strings available.', 'Search found the string.');
$this->assertNoText('No strings available.');
// Add translation.
// Assume this is the only result, given the random name.
@ -448,7 +451,7 @@ class LocaleTranslationUiTest extends BrowserTestBase {
'translation' => 'translated',
];
$this->drupalPostForm('admin/config/regional/translate', $search, 'Filter');
$this->assertNoText('No strings available.', 'Search found the translation.');
$this->assertNoText('No strings available.');
// Ensure translated source string doesn't appear if searching on 'only
// untranslated strings'.
@ -458,7 +461,7 @@ class LocaleTranslationUiTest extends BrowserTestBase {
'translation' => 'untranslated',
];
$this->drupalPostForm('admin/config/regional/translate', $search, 'Filter');
$this->assertText('No strings available.', "Search didn't find the source string.");
$this->assertText('No strings available.');
// Ensure translated string doesn't appear if searching on 'only
// untranslated strings'.
@ -468,7 +471,7 @@ class LocaleTranslationUiTest extends BrowserTestBase {
'translation' => 'untranslated',
];
$this->drupalPostForm('admin/config/regional/translate', $search, 'Filter');
$this->assertText('No strings available.', "Search didn't find the translation.");
$this->assertText('No strings available.');
// Ensure translated string does appear if searching on the custom language.
$search = [
@ -477,7 +480,7 @@ class LocaleTranslationUiTest extends BrowserTestBase {
'translation' => 'all',
];
$this->drupalPostForm('admin/config/regional/translate', $search, 'Filter');
$this->assertNoText('No strings available.', 'Search found the translation.');
$this->assertNoText('No strings available.');
// Ensure translated string doesn't appear if searching in System (English).
$search = [
@ -486,7 +489,7 @@ class LocaleTranslationUiTest extends BrowserTestBase {
'translation' => 'all',
];
$this->drupalPostForm('admin/config/regional/translate', $search, 'Filter');
$this->assertText('No strings available.', "Search didn't find the translation.");
$this->assertText('No strings available.');
// Search for a string that isn't in the system.
$unavailable_string = $this->randomMachineName(16);
@ -496,7 +499,7 @@ class LocaleTranslationUiTest extends BrowserTestBase {
'translation' => 'all',
];
$this->drupalPostForm('admin/config/regional/translate', $search, 'Filter');
$this->assertText('No strings available.', "Search didn't find the invalid string.");
$this->assertText('No strings available.');
}
/**
@ -538,7 +541,7 @@ class LocaleTranslationUiTest extends BrowserTestBase {
];
$this->drupalPostForm('admin/config/regional/translate', $search, 'Filter');
$this->assertText($translation->getString(), 'Translation is found in search result.');
$this->assertText($translation->getString());
// Submit the translations without changing the translation.
$textarea = current($this->xpath('//textarea'));
@ -557,7 +560,7 @@ class LocaleTranslationUiTest extends BrowserTestBase {
'customized' => '0',
];
$this->drupalPostForm('admin/config/regional/translate', $search, 'Filter');
$this->assertText($string->getString(), 'Translation is not marked as customized.');
$this->assertText($string->getString());
// Submit the translations with a new translation.
$textarea = current($this->xpath('//textarea'));
@ -576,7 +579,7 @@ class LocaleTranslationUiTest extends BrowserTestBase {
'customized' => '1',
];
$this->drupalPostForm('admin/config/regional/translate', $search, 'Filter');
$this->assertText($string->getString(), "Translation is marked as customized.");
$this->assertText($string->getString());
}
}

View File

@ -49,7 +49,7 @@ class LocaleUpdateInterfaceTest extends LocaleUpdateBase {
// No language added.
// Check status page and Available translation updates page.
$this->drupalGet('admin/reports/status');
$this->assertNoText('Translation update status', 'No status message');
$this->assertNoText('Translation update status');
$this->drupalGet('admin/reports/translations');
$this->assertRaw(t('No translatable languages available. <a href=":add_language">Add a language</a> first.', [':add_language' => Url::fromRoute('entity.configurable_language.collection')->toString()]));
@ -64,10 +64,10 @@ class LocaleUpdateInterfaceTest extends LocaleUpdateBase {
// One language added, all translations up to date.
$this->drupalGet('admin/reports/status');
$this->assertText('Translation update status', 'Status message');
$this->assertText('Up to date', 'Translations up to date');
$this->assertText('Translation update status');
$this->assertText('Up to date');
$this->drupalGet('admin/reports/translations');
$this->assertText('All translations up to date.', 'Translations up to date');
$this->assertText('All translations up to date.');
// Set locale_test_translate module to have a local translation available.
$status = locale_translation_get_status();
@ -76,10 +76,10 @@ class LocaleUpdateInterfaceTest extends LocaleUpdateBase {
// Check if updates are available for German.
$this->drupalGet('admin/reports/status');
$this->assertText('Translation update status', 'Status message');
$this->assertText('Translation update status');
$this->assertRaw(t('Updates available for: @languages. See the <a href=":updates">Available translation updates</a> page for more information.', ['@languages' => t('German'), ':updates' => Url::fromRoute('locale.translate_status')->toString()]));
$this->drupalGet('admin/reports/translations');
$this->assertText('Updates for: Locale test translate', 'Translations available');
$this->assertText('Updates for: Locale test translate');
// Set locale_test_translate module to have a dev release and no
// translation found.
@ -90,10 +90,10 @@ class LocaleUpdateInterfaceTest extends LocaleUpdateBase {
// Check if no updates were found.
$this->drupalGet('admin/reports/status');
$this->assertText('Translation update status', 'Status message');
$this->assertText('Translation update status');
$this->assertRaw(t('Missing translations for: @languages. See the <a href=":updates">Available translation updates</a> page for more information.', ['@languages' => t('German'), ':updates' => Url::fromRoute('locale.translate_status')->toString()]));
$this->drupalGet('admin/reports/translations');
$this->assertText('Missing translations for one project', 'No translations found');
$this->assertText('Missing translations for one project');
$release_details = new FormattableMarkup('@module (@version). @info', [
'@module' => 'Locale test translate',
'@version' => '1.3-dev',
@ -110,8 +110,8 @@ class LocaleUpdateInterfaceTest extends LocaleUpdateBase {
// Check if Drupal core is not translated.
$this->drupalGet('admin/reports/translations');
$this->assertText('Missing translations for 2 projects', 'No translations found');
$this->assertText('Drupal core (8.1.1).', 'Release details');
$this->assertText('Missing translations for 2 projects');
$this->assertText('Drupal core (8.1.1).');
// Override Drupal core translation status as 'translations available'.
$status = locale_translation_get_status();
@ -122,8 +122,8 @@ class LocaleUpdateInterfaceTest extends LocaleUpdateBase {
// Check if translations are available for Drupal core.
$this->drupalGet('admin/reports/translations');
$this->assertText('Updates for: Drupal core', 'Translations found');
$this->assertText('Drupal core (' . $this->container->get('date.formatter')->format(REQUEST_TIME, 'html_date') . ')', 'Core translation update');
$this->assertText('Updates for: Drupal core');
$this->assertText('Drupal core (' . $this->container->get('date.formatter')->format(REQUEST_TIME, 'html_date') . ')');
$this->assertSession()->buttonExists('Update translations');
}

View File

@ -128,11 +128,11 @@ class LocaleUpdateTest extends LocaleUpdateBase {
// Check the status on the Available translation status page.
$this->assertRaw('<label for="edit-langcodes-de" class="visually-hidden">Update German</label>');
$this->assertText('Updates for: Contributed module one, Contributed module two, Custom module one, Locale test', 'Updates found');
$this->assertText('Updates for: Contributed module one, Contributed module two, Custom module one, Locale test');
/** @var \Drupal\Core\Datetime\DateFormatterInterface $date_formatter */
$date_formatter = $this->container->get('date.formatter');
$this->assertText('Contributed module one (' . $date_formatter->format($this->timestampNew, 'html_date') . ')', 'Updates for Contrib module one');
$this->assertText('Contributed module two (' . $date_formatter->format($this->timestampNew, 'html_date') . ')', 'Updates for Contrib module two');
$this->assertText('Contributed module one (' . $date_formatter->format($this->timestampNew, 'html_date') . ')');
$this->assertText('Contributed module two (' . $date_formatter->format($this->timestampNew, 'html_date') . ')');
// Execute the translation update.
$this->drupalPostForm('admin/reports/translations', [], 'Update translations');
@ -426,8 +426,8 @@ class LocaleUpdateTest extends LocaleUpdateBase {
// Ensure the translation file is automatically imported when the language
// was added.
$this->assertText('One translation file imported.', 'Language file automatically imported.');
$this->assertText('One translation string was skipped because of disallowed or malformed HTML', 'Language file automatically imported.');
$this->assertText('One translation file imported.');
$this->assertText('One translation string was skipped because of disallowed or malformed HTML');
// Ensure the strings were successfully imported.
$search = [
@ -436,7 +436,7 @@ class LocaleUpdateTest extends LocaleUpdateBase {
'translation' => 'translated',
];
$this->drupalPostForm('admin/config/regional/translate', $search, 'Filter');
$this->assertNoText('No strings available.', 'String successfully imported.');
$this->assertNoText('No strings available.');
// Ensure the multiline string was imported.
$search = [
@ -445,7 +445,7 @@ class LocaleUpdateTest extends LocaleUpdateBase {
'translation' => 'all',
];
$this->drupalPostForm('admin/config/regional/translate', $search, 'Filter');
$this->assertText('Multiline translation string to make sure that import works with it.', 'String successfully imported.');
$this->assertText('Multiline translation string to make sure that import works with it.');
// Ensure 'Allowed HTML source string' was imported but the translation for
// 'Another allowed HTML source string' was not because it contains invalid
@ -456,8 +456,8 @@ class LocaleUpdateTest extends LocaleUpdateBase {
'translation' => 'all',
];
$this->drupalPostForm('admin/config/regional/translate', $search, 'Filter');
$this->assertText('Allowed HTML source string', 'String successfully imported.');
$this->assertNoText('Another allowed HTML source string', 'String with disallowed translation not imported.');
$this->assertText('Allowed HTML source string');
$this->assertNoText('Another allowed HTML source string');
}
}

View File

@ -230,7 +230,7 @@ class MenuUiNodeTest extends BrowserTestBase {
// Assert that disabled Administration menu is not shown on the
// node/$nid/edit page.
$this->drupalGet('node/' . $node->id() . '/edit');
$this->assertText('Provide a menu link', 'Link in not allowed menu not shown in node edit form');
$this->assertText('Provide a menu link');
// Assert that the link is still in the Administration menu after save.
$this->drupalPostForm('node/' . $node->id() . '/edit', $edit, 'Save');
$link = MenuLinkContent::load($item->id());

View File

@ -235,7 +235,7 @@ class MenuUiTest extends BrowserTestBase {
// Verify that the confirmation message is displayed.
$this->assertRaw(t('Menu %label has been added.', ['%label' => $label]));
$this->drupalGet('admin/structure/menu');
$this->assertText($label, 'Menu created');
$this->assertText($label);
// Confirm that the custom menu block is available.
$this->drupalGet('admin/structure/block/list/' . $this->config('system.theme')->get('default'));
@ -584,7 +584,7 @@ class MenuUiTest extends BrowserTestBase {
$this->drupalLogout();
$this->drupalLogin($this->adminUser);
$this->drupalGet('admin/structure/menu/manage/' . $item->getMenuName());
$this->assertNoText($item->getTitle(), "Menu link pointing to unpublished node is only visible to users with 'bypass node access' permission");
$this->assertNoText($item->getTitle());
// The cache contexts associated with the (in)accessible menu links are
// bubbled. See DefaultMenuLinkTreeManipulators::menuLinkCheckAccess().
$this->assertSession()->responseHeaderContains('X-Drupal-Cache-Contexts', 'user.permissions');
@ -774,7 +774,7 @@ class MenuUiTest extends BrowserTestBase {
$this->assertText('The menu link has been saved.');
// Verify menu link.
$this->drupalGet('admin/structure/menu/manage/' . $item->getMenuName());
$this->assertText($title, 'Menu link was edited');
$this->assertText($title);
}
/**
@ -813,7 +813,7 @@ class MenuUiTest extends BrowserTestBase {
// Verify deletion.
$this->drupalGet('');
$this->assertNoText($title, 'Menu link was deleted');
$this->assertNoText($title);
}
/**
@ -827,12 +827,12 @@ class MenuUiTest extends BrowserTestBase {
// Verify menu link is absent.
$this->drupalGet('');
$this->assertNoText($item->getTitle(), 'Menu link was not displayed');
$this->assertNoText($item->getTitle());
$this->enableMenuLink($item);
// Verify menu link is displayed.
$this->drupalGet('');
$this->assertText($item->getTitle(), 'Menu link was displayed');
$this->assertText($item->getTitle());
}
/**

View File

@ -95,12 +95,12 @@ class NodeAccessFieldTest extends NodeTestBase {
// Log in as the administrator and confirm that the field value is present.
$this->drupalLogin($this->adminUser);
$this->drupalGet('node/' . $node->id());
$this->assertText($value, 'The saved field value is visible to an administrator.');
$this->assertText($value);
// Log in as the content admin and try to view the node.
$this->drupalLogin($this->contentAdminUser);
$this->drupalGet('node/' . $node->id());
$this->assertText('Access denied', 'Access is denied for the content admin.');
$this->assertText('Access denied');
// Modify the field default as the content admin.
$edit = [];
@ -117,7 +117,7 @@ class NodeAccessFieldTest extends NodeTestBase {
// Confirm that the existing node still has the correct field value.
$this->drupalGet('node/' . $node->id());
$this->assertText($value, 'The original field value is visible to an administrator.');
$this->assertText($value);
// Confirm that the new default value appears when creating a new node.
$this->drupalGet('node/add/page');

View File

@ -52,8 +52,10 @@ class NodeActionsConfigurationTest extends BrowserTestBase {
$action_id = $edit['id'];
// Make sure that the new action was saved properly.
$this->assertText('The action has been successfully saved.', 'The node_assign_owner_action action has been successfully saved.');
$this->assertText($action_label, 'The label of the node_assign_owner_action action appears on the actions administration page after saving.');
$this->assertText('The action has been successfully saved.');
// Check that the label of the node_assign_owner_action action appears on
// the actions administration page after saving.
$this->assertText($action_label);
// Make another POST request to the action edit page.
$this->clickLink(t('Configure'));
@ -65,9 +67,13 @@ class NodeActionsConfigurationTest extends BrowserTestBase {
$this->assertSession()->statusCodeEquals(200);
// Make sure that the action updated properly.
$this->assertText('The action has been successfully saved.', 'The node_assign_owner_action action has been successfully updated.');
$this->assertNoText($action_label, 'The old label for the node_assign_owner_action action does not appear on the actions administration page after updating.');
$this->assertText($new_action_label, 'The new label for the node_assign_owner_action action appears on the actions administration page after updating.');
$this->assertText('The action has been successfully saved.');
// Check that the old label for the node_assign_owner_action action does not
// appear on the actions administration page after updating.
$this->assertNoText($action_label);
// Check that the new label for the node_assign_owner_action action appears
// on the actions administration page after updating.
$this->assertText($new_action_label);
// Make sure that deletions work properly.
$this->drupalGet('admin/config/system/actions');
@ -81,7 +87,9 @@ class NodeActionsConfigurationTest extends BrowserTestBase {
$this->assertRaw(t('The action %action has been deleted.', ['%action' => $new_action_label]));
$this->drupalGet('admin/config/system/actions');
$this->assertSession()->statusCodeEquals(200);
$this->assertNoText($new_action_label, 'The label for the node_assign_owner_action action does not appear on the actions administration page after deleting.');
// Check that the label for the node_assign_owner_action action does not
// appear on the actions administration page after deleting.
$this->assertNoText($new_action_label);
$action = Action::load($action_id);
$this->assertNull($action, 'The node_assign_owner_action action is not available after being deleted.');

View File

@ -77,7 +77,7 @@ class NodeBlockFunctionalTest extends NodeTestBase {
// Test that block is not visible without nodes.
$this->drupalGet('');
$this->assertText('No content available.', 'Block with "No content available." found.');
$this->assertText('No content available.');
// Add some test nodes.
$default_settings = ['uid' => $this->webUser->id(), 'type' => 'article'];
@ -110,13 +110,13 @@ class NodeBlockFunctionalTest extends NodeTestBase {
// see the block.
$this->drupalLogout();
$this->drupalGet('');
$this->assertNoText($block->label(), 'Block was not found.');
$this->assertNoText($block->label());
// Test that only the 2 latest nodes are shown.
$this->drupalLogin($this->webUser);
$this->assertNoText($node1->label(), 'Node not found in block.');
$this->assertText($node2->label(), 'Node found in block.');
$this->assertText($node3->label(), 'Node found in block.');
$this->assertNoText($node1->label());
$this->assertText($node2->label());
$this->assertText($node3->label());
// Check to make sure nodes are in the right order.
$this->assertNotEmpty($this->xpath('//div[@id="block-test-block"]//div[@class="item-list"]/ul/li[1]/div/span/a[text() = "' . $node3->label() . '"]'), 'Nodes were ordered correctly in block.');
@ -133,10 +133,10 @@ class NodeBlockFunctionalTest extends NodeTestBase {
// Test that all four nodes are shown.
$this->drupalGet('');
$this->assertText($node1->label(), 'Node found in block.');
$this->assertText($node2->label(), 'Node found in block.');
$this->assertText($node3->label(), 'Node found in block.');
$this->assertText($node4->label(), 'Node found in block.');
$this->assertText($node1->label());
$this->assertText($node2->label());
$this->assertText($node3->label());
$this->assertText($node4->label());
$this->assertCacheContexts(['languages:language_content', 'languages:language_interface', 'theme', 'url.query_args:' . MainContentViewSubscriber::WRAPPER_FORMAT, 'user']);
@ -162,7 +162,8 @@ class NodeBlockFunctionalTest extends NodeTestBase {
// Verify visibility rules.
$this->drupalGet('');
$label = $block->label();
$this->assertNoText($label, 'Block was not displayed on the front page.');
// Check that block is not displayed on the front page.
$this->assertNoText($label);
$this->assertCacheContexts(['languages:language_content', 'languages:language_interface', 'theme', 'url.query_args:' . MainContentViewSubscriber::WRAPPER_FORMAT, 'user', 'route']);
// Ensure that a page that does not have a node context can still be cached,
@ -171,21 +172,26 @@ class NodeBlockFunctionalTest extends NodeTestBase {
$this->assertSession()->responseHeaderEquals('X-Drupal-Dynamic-Cache', 'HIT');
$this->drupalGet('node/add/article');
$this->assertText($label, 'Block was displayed on the node/add/article page.');
// Check that block is displayed on the add article page.
$this->assertText($label);
$this->assertCacheContexts(['languages:language_content', 'languages:language_interface', 'session', 'theme', 'url.path', 'url.query_args', 'user', 'route']);
// The node/add/article page is an admin path and currently uncacheable.
$this->assertSession()->responseHeaderEquals('X-Drupal-Dynamic-Cache', 'UNCACHEABLE');
$this->drupalGet('node/' . $node1->id());
$this->assertText($label, 'Block was displayed on the node/N when node is of type article.');
// Check that block is displayed on the node page when node is of type
// 'article'.
$this->assertText($label);
$this->assertCacheContexts(['languages:language_content', 'languages:language_interface', 'theme', 'url.query_args:' . MainContentViewSubscriber::WRAPPER_FORMAT, 'url.site', 'user', 'route', 'timezone']);
$this->assertSession()->responseHeaderEquals('X-Drupal-Dynamic-Cache', 'MISS');
$this->drupalGet('node/' . $node1->id());
$this->assertSession()->responseHeaderEquals('X-Drupal-Dynamic-Cache', 'HIT');
$this->drupalGet('node/' . $node5->id());
$this->assertNoText($label, 'Block was not displayed on nodes of type page.');
// Check that block is not displayed on the node page when node is of type
// 'page'.
$this->assertNoText($label);
$this->assertCacheContexts(['languages:language_content', 'languages:language_interface', 'theme', 'url.query_args:' . MainContentViewSubscriber::WRAPPER_FORMAT, 'url.site', 'user', 'route', 'timezone']);
$this->assertSession()->responseHeaderEquals('X-Drupal-Dynamic-Cache', 'MISS');
$this->drupalGet('node/' . $node5->id());
@ -219,7 +225,8 @@ class NodeBlockFunctionalTest extends NodeTestBase {
$this->assertSession()->pageTextContains('Displaying node #' . $node1->id() . ', revision #' . $node1->getRevisionId() . ': Node revision 2 title');
$this->drupalGet('admin/structure/block');
$this->assertText($label, 'Block was displayed on the admin/structure/block page.');
// Check that block is displayed on the admin/structure/block page.
$this->assertText($label);
$this->assertSession()->linkByHrefExists($block->toUrl()->toString());
}

View File

@ -60,7 +60,7 @@ class NodeCreationTest extends NodeTestBase {
$this->drupalPostForm('node/add/page', $edit, 'Save');
// Check that the Basic page has been created.
$this->assertText('Basic page ' . $edit['title[0][value]'] . ' has been created.', 'Basic page created.');
$this->assertText('Basic page ' . $edit['title[0][value]'] . ' has been created.');
// Verify that the creation message contains a link to a node.
$this->assertSession()->elementExists('xpath', '//div[@data-drupal-messages]//a[contains(@href, "node/")]');

View File

@ -97,8 +97,8 @@ class NodeEditFormTest extends NodeTestBase {
$this->submitForm($edit, 'Save');
// Check that the title and body fields are displayed with the updated values.
$this->assertText($edit[$title_key], 'Title displayed.');
$this->assertText($edit[$body_key], 'Body displayed.');
$this->assertText($edit[$title_key]);
$this->assertText($edit[$body_key]);
// Log in as a second administrator user.
$second_web_user = $this->drupalCreateUser([

View File

@ -49,9 +49,9 @@ class NodeEntityViewModeAlterTest extends NodeTestBase {
$this->drupalGet('node/' . $node->id());
// Check that teaser mode is viewed.
$this->assertText('Extra data that should appear only in the teaser for the node.', 'Teaser text present');
$this->assertText('Extra data that should appear only in the teaser for the node.');
// Make sure body text is not present.
$this->assertNoText('Data that should appear only in the body for the node.', 'Body text not present');
$this->assertNoText('Data that should appear only in the body for the node.');
// Test that the correct build mode has been set.
$build = $this->buildEntityView($node);

View File

@ -52,12 +52,12 @@ class NodeRSSContentTest extends NodeTestBase {
// Check that content added in 'rss' view mode appear in RSS feed.
$rss_only_content = 'Extra data that should appear only in the RSS feed for node ' . $node->id() . '.';
$this->assertText($rss_only_content, 'Node content designated for RSS appear in RSS feed.');
$this->assertText($rss_only_content);
// Check that content added in view modes other than 'rss' doesn't
// appear in RSS feed.
$non_rss_content = 'Extra data that should appear everywhere except the RSS feed for node ' . $node->id() . '.';
$this->assertNoText($non_rss_content, 'Node content not designed for RSS does not appear in RSS feed.');
$this->assertNoText($non_rss_content);
// Check that extra RSS elements and namespaces are added to RSS feed.
$test_element = '<testElement>' . t('Value of testElement RSS element for node @nid.', ['@nid' => $node->id()]) . '</testElement>';
@ -68,7 +68,7 @@ class NodeRSSContentTest extends NodeTestBase {
// Check that content added in 'rss' view mode doesn't appear when
// viewing node.
$this->drupalGet('node/' . $node->id());
$this->assertNoText($rss_only_content, 'Node content designed for RSS does not appear when viewing node.');
$this->assertNoText($rss_only_content);
}
/**

View File

@ -135,13 +135,13 @@ class NodeRevisionsAllTest extends NodeTestBase {
// Confirm the correct revision text appears on "view revisions" page.
$this->drupalGet("node/" . $node->id() . "/revisions/" . $node->getRevisionId() . "/view");
$this->assertText($node->body->value, 'Correct text displays for version.');
$this->assertText($node->body->value);
// Confirm the correct revision log message appears on the "revisions
// overview" page.
$this->drupalGet("node/" . $node->id() . "/revisions");
foreach ($logs as $revision_log) {
$this->assertText($revision_log, 'Revision log message found.');
$this->assertText($revision_log);
}
// Confirm that this is the current revision.
@ -170,8 +170,8 @@ class NodeRevisionsAllTest extends NodeTestBase {
// Confirm that the node can still be updated.
$this->drupalPostForm("node/" . $reverted_node->id() . "/edit", ['body[0][value]' => 'We are Drupal.'], 'Save');
$this->assertText('Basic page ' . $reverted_node->getTitle() . ' has been updated.', 'Node was successfully saved after reverting a revision.');
$this->assertText('We are Drupal.', 'Node was correctly updated after reverting a revision.');
$this->assertText('Basic page ' . $reverted_node->getTitle() . ' has been updated.');
$this->assertText('We are Drupal.');
// Confirm revisions delete properly.
$this->drupalPostForm("node/" . $node->id() . "/revisions/" . $nodes[1]->getRevisionId() . "/delete", [], 'Delete');

View File

@ -154,12 +154,12 @@ class NodeRevisionsTest extends NodeTestBase {
// Confirm the correct revision text appears on "view revisions" page.
$this->drupalGet("node/" . $node->id() . "/revisions/" . $node->getRevisionId() . "/view");
$this->assertText($node->body->value, 'Correct text displays for version.');
$this->assertText($node->body->value);
// Confirm the correct log message appears on "revisions overview" page.
$this->drupalGet("node/" . $node->id() . "/revisions");
foreach ($logs as $revision_log) {
$this->assertText($revision_log, 'Revision log message found.');
$this->assertText($revision_log);
}
// Original author, and editor names should appear on revisions overview.
$web_user = $nodes[0]->revision_uid->entity;
@ -231,12 +231,13 @@ class NodeRevisionsTest extends NodeTestBase {
$new_node_revision->isDefaultRevision = FALSE;
$new_node_revision->save();
// Verify that revision body text is not present on default version of node.
$this->drupalGet('node/' . $node->id());
$this->assertNoText($new_body, 'Revision body text is not present on default version of node.');
$this->assertNoText($new_body);
// Verify that the new body text is present on the revision.
$this->drupalGet("node/" . $node->id() . "/revisions/" . $new_node_revision->getRevisionId() . "/view");
$this->assertText($new_body, 'Revision body text is present when loading specific revision.');
$this->assertText($new_body);
// Verify that the non-default revision vid is greater than the default
// revision vid.
@ -339,7 +340,7 @@ class NodeRevisionsTest extends NodeTestBase {
$node->save();
$this->drupalGet('node/' . $node->id());
$this->assertText($new_title, 'New node title appears on the page.');
$this->assertText($new_title);
$node_storage->resetCache([$node->id()]);
$node_revision = $node_storage->load($node->id());
$this->assertEqual($node_revision->revision_log->value, $revision_log, 'After an existing node revision is re-saved without a log message, the original log message is preserved.');
@ -358,7 +359,7 @@ class NodeRevisionsTest extends NodeTestBase {
$node->save();
$this->drupalGet('node/' . $node->id());
$this->assertText($new_title, 'New node title appears on the page.');
$this->assertText($new_title);
$node_storage->resetCache([$node->id()]);
$node_revision = $node_storage->load($node->id());
$this->assertTrue(empty($node_revision->revision_log->value), 'After a new node revision is saved with an empty log message, the log message for the node is empty.');

View File

@ -2,7 +2,6 @@
namespace Drupal\Tests\node\Functional;
use Drupal\Component\Render\FormattableMarkup;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Tests\content_translation\Functional\ContentTranslationUITestBase;
use Drupal\Core\Language\LanguageInterface;
@ -393,7 +392,7 @@ class NodeTranslationUITest extends ContentTranslationUITestBase {
$languages = $this->container->get('language_manager')->getLanguages();
foreach ($this->langcodes as $langcode) {
$this->drupalGet($path, ['language' => $languages[$langcode]]);
$this->assertText($values[$langcode]['title'][0]['value'], new FormattableMarkup('The %langcode node translation is correctly displayed.', ['%langcode' => $langcode]));
$this->assertText($values[$langcode]['title'][0]['value']);
}
}

View File

@ -188,7 +188,7 @@ class NodeTypeTest extends NodeTestBase {
$this->assertRaw(
t('%type is used by 1 piece of content on your site. You can not remove this content type until you have removed all of the %type content.', ['%type' => $type->label()])
);
$this->assertNoText('This action cannot be undone.', 'The node type deletion confirmation form is not available.');
$this->assertNoText('This action cannot be undone.');
// Delete the node.
$node->delete();
@ -197,7 +197,7 @@ class NodeTypeTest extends NodeTestBase {
$this->assertRaw(
t('Are you sure you want to delete the content type %type?', ['%type' => $type->label()])
);
$this->assertText('This action cannot be undone.', 'The node type deletion confirmation form is available.');
$this->assertText('This action cannot be undone.');
// Test that a locked node type could not be deleted.
$this->container->get('module_installer')->install(['node_test_config']);

View File

@ -40,7 +40,7 @@ class NodeViewLanguageTest extends NodeTestBase {
$node = $this->drupalCreateNode(['langcode' => 'es']);
$this->drupalGet($node->toUrl());
$this->assertText('Spanish', 'The language field is displayed properly.');
$this->assertText('Spanish');
}
}

View File

@ -205,8 +205,8 @@ class PagePreviewTest extends NodeTestBase {
$expected_title = $edit[$title_key] . ' | Drupal';
$this->assertSession()->titleEquals($expected_title);
$this->assertSession()->assertEscaped($edit[$title_key]);
$this->assertText($edit[$body_key], 'Body displayed.');
$this->assertText($edit[$term_key], 'Term displayed.');
$this->assertText($edit[$body_key]);
$this->assertText($edit[$term_key]);
$this->assertSession()->linkExists('Back to content editing');
// Check that we see the class of the node type on the body element.
@ -228,7 +228,7 @@ class PagePreviewTest extends NodeTestBase {
$view_mode_edit = ['view_mode' => 'teaser'];
$this->drupalPostForm('node/preview/' . $uuid . '/full', $view_mode_edit, 'Switch');
$this->assertRaw('view-mode-teaser');
$this->assertNoText($edit[$body_key], 'Body not displayed.');
$this->assertNoText($edit[$body_key]);
// Check that the title, body and term fields are displayed with the
// values after going back to the content edit page.
@ -245,8 +245,8 @@ class PagePreviewTest extends NodeTestBase {
$this->submitForm([], 'Preview');
$this->assertSession()->titleEquals($expected_title);
$this->assertSession()->assertEscaped($edit[$title_key]);
$this->assertText($edit[$body_key], 'Body displayed.');
$this->assertText($edit[$term_key], 'Term displayed.');
$this->assertText($edit[$body_key]);
$this->assertText($edit[$term_key]);
$this->assertSession()->linkExists('Back to content editing');
// Assert the content is kept when reloading the page.
@ -262,7 +262,7 @@ class PagePreviewTest extends NodeTestBase {
// Check the term was displayed on the saved node.
$this->drupalGet('node/' . $node->id());
$this->assertText($edit[$term_key], 'Term displayed.');
$this->assertText($edit[$term_key]);
// Check the term appears again on the edit form.
$this->drupalGet('node/' . $node->id() . '/edit');
@ -304,7 +304,7 @@ class PagePreviewTest extends NodeTestBase {
$title_key => $this->randomMachineName(8),
];
$this->drupalPostForm('node/' . $node->id() . '/edit', $edit, 'Preview');
$this->assertText($edit[$title_key], 'New title displayed.');
$this->assertText($edit[$title_key]);
$this->clickLink(t('Back to content editing'));
$this->assertSession()->fieldValueEquals($title_key, $edit[$title_key]);
// Navigate away from the node without saving.
@ -445,9 +445,9 @@ class PagePreviewTest extends NodeTestBase {
// Check that the preview is displaying the title, body and term.
$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.');
$this->assertText($edit[$title_key]);
$this->assertText($edit[$body_key]);
$this->assertText($edit[$term_key]);
// Check that the title and body fields are displayed with the correct
// values after going back to the content edit page.

View File

@ -121,18 +121,18 @@ class NodeLanguageTest extends NodeTestBase {
foreach ($this->nodeTitles as $langcode => $list) {
foreach ($list as $title) {
if ($langcode == 'en') {
$this->assertNoText($title, $title . ' does not appear on ' . $message);
$this->assertNoText($title);
}
else {
$this->assertText($title, $title . ' does appear on ' . $message);
$this->assertText($title);
}
}
}
// Test that the language field value is shown.
$this->assertNoText('English', 'English language is not shown on ' . $message);
$this->assertText('French', 'French language is shown on ' . $message);
$this->assertText('Spanish', 'Spanish language is shown on ' . $message);
$this->assertNoText('English');
$this->assertText('French');
$this->assertText('Spanish');
// Test page sorting, which is by language code, ascending. So the
// Spanish nodes should appear before the French nodes.
@ -151,9 +151,9 @@ class NodeLanguageTest extends NodeTestBase {
$this->drupalGet('test-language/es');
// This time, test just the language field.
$message = 'Spanish argument page';
$this->assertNoText('English', 'English language is not shown on ' . $message);
$this->assertNoText('French', 'French language is not shown on ' . $message);
$this->assertText('Spanish', 'Spanish language is shown on ' . $message);
$this->assertNoText('English');
$this->assertNoText('French');
$this->assertText('Spanish');
// Test the front page view filter. Only node titles in the current language
// should be displayed on the front page by default.
@ -211,10 +211,10 @@ class NodeLanguageTest extends NodeTestBase {
foreach ($this->nodeTitles as $control_langcode => $control_titles) {
foreach ($control_titles as $title) {
if ($control_langcode == 'en') {
$this->assertText($title, 'English title is shown when filtering is site default');
$this->assertText($title);
}
else {
$this->assertNoText($title, 'Non-English title is not shown when filtering is site default');
$this->assertNoText($title);
}
}
}
@ -239,10 +239,10 @@ class NodeLanguageTest extends NodeTestBase {
foreach ($this->nodeTitles as $control_langcode => $control_titles) {
foreach ($control_titles as $title) {
if ($control_langcode == 'es') {
$this->assertText($title, 'Spanish title is shown when filtering is fixed UI language');
$this->assertText($title);
}
else {
$this->assertNoText($title, 'Non-Spanish title is not shown when filtering is fixed UI language');
$this->assertNoText($title);
}
}
}
@ -285,16 +285,16 @@ class NodeLanguageTest extends NodeTestBase {
protected function assertLanguageNames($native = FALSE) {
$this->drupalGet('test-language');
if ($native) {
$this->assertText('Français', 'French language shown in native form.');
$this->assertText('Español', 'Spanish language shown in native form.');
$this->assertNoText('French', 'French language not shown in English.');
$this->assertNoText('Spanish', 'Spanish language not shown in English.');
$this->assertText('Français');
$this->assertText('Español');
$this->assertNoText('French');
$this->assertNoText('Spanish');
}
else {
$this->assertNoText('Français', 'French language not shown in native form.');
$this->assertNoText('Español', 'Spanish language not shown in native form.');
$this->assertText('French', 'French language shown in English.');
$this->assertText('Spanish', 'Spanish language shown in English.');
$this->assertNoText('Français');
$this->assertNoText('Español');
$this->assertText('French');
$this->assertText('Spanish');
}
}

View File

@ -322,7 +322,7 @@ class OptionsFieldUITest extends FieldTestBase {
$this->assertNoRaw('&amp;lt;');
if (is_string($result)) {
$this->assertText($result, $message);
$this->assertText($result);
}
else {
$field_storage = FieldStorageConfig::loadByName('node', $this->fieldName);
@ -347,7 +347,7 @@ class OptionsFieldUITest extends FieldTestBase {
];
$this->drupalPostForm($this->adminPath, $edit, 'Save field settings');
$this->assertText('Updated field ' . $this->fieldName . ' field settings.', "The 'On' and 'Off' form fields work for boolean fields.");
$this->assertText('Updated field ' . $this->fieldName . ' field settings.');
// Select a default value.
$edit = [

View File

@ -245,7 +245,7 @@ class OptionsWidgetsTest extends FieldTestBase {
'card_2[2]' => TRUE,
];
$this->submitForm($edit, 'Save');
$this->assertText('this field cannot hold more than 2 values', 'Validation error was displayed.');
$this->assertText('this field cannot hold more than 2 values');
// Submit form: uncheck all options.
$edit = [
@ -425,7 +425,7 @@ class OptionsWidgetsTest extends FieldTestBase {
// Submit form: select the three options while the field accepts only 2.
$edit = ['card_2[]' => [0 => 0, 1 => 1, 2 => 2]];
$this->submitForm($edit, 'Save');
$this->assertText('this field cannot hold more than 2 values', 'Validation error was displayed.');
$this->assertText('this field cannot hold more than 2 values');
// Submit form: uncheck all options.
$edit = ['card_2[]' => []];

View File

@ -480,7 +480,7 @@ class PageCacheTest extends BrowserTestBase {
$this->drupalGet('page_cache_form_test_immutability');
$this->assertText("Immutable: TRUE", "Form is immutable.");
$this->assertText("Immutable: TRUE");
// The immutable flag is set unconditionally by system_form_alter(), set
// a flag to tell page_cache_form_test_module_implements_alter() to disable
@ -491,7 +491,7 @@ class PageCacheTest extends BrowserTestBase {
$this->drupalGet('page_cache_form_test_immutability');
$this->assertText("Immutable: FALSE", "Form is not immutable,");
$this->assertText("Immutable: FALSE");
}
/**

View File

@ -88,15 +88,17 @@ class PathAliasTest extends PathTestBase {
// Confirm that the alias works.
$this->drupalGet($edit['alias[0][value]']);
$this->assertText($node1->label(), 'Alias works.');
$this->assertText($node1->label());
$this->assertSession()->statusCodeEquals(200);
// Confirm that the alias works in a case-insensitive way.
$this->assertTrue(ctype_lower(ltrim($edit['alias[0][value]'], '/')));
$this->drupalGet($edit['alias[0][value]']);
$this->assertText($node1->label(), 'Alias works lower case.');
// Lower case.
$this->assertText($node1->label());
$this->assertSession()->statusCodeEquals(200);
$this->drupalGet(mb_strtoupper($edit['alias[0][value]']));
$this->assertText($node1->label(), 'Alias works upper case.');
// Upper case.
$this->assertText($node1->label());
$this->assertSession()->statusCodeEquals(200);
// Change alias to one containing "exotic" characters.
@ -124,13 +126,13 @@ class PathAliasTest extends PathTestBase {
// Confirm that the alias works.
$this->drupalGet(mb_strtoupper($edit['alias[0][value]']));
$this->assertText($node1->label(), 'Changed alias works.');
$this->assertText($node1->label());
$this->assertSession()->statusCodeEquals(200);
$this->container->get('path_alias.manager')->cacheClear();
// Confirm that previous alias no longer works.
$this->drupalGet($previous);
$this->assertNoText($node1->label(), 'Previous alias no longer works.');
$this->assertNoText($node1->label());
$this->assertSession()->statusCodeEquals(404);
// Create second test node.
@ -160,7 +162,7 @@ class PathAliasTest extends PathTestBase {
// Confirm that the alias no longer works.
$this->drupalGet($edit['alias[0][value]']);
$this->assertNoText($node1->label(), 'Alias was successfully deleted.');
$this->assertNoText($node1->label());
$this->assertSession()->statusCodeEquals(404);
// Create a really long alias.
@ -171,9 +173,10 @@ class PathAliasTest extends PathTestBase {
// The alias is shortened to 50 characters counting the ellipsis.
$truncated_alias = substr($alias, 0, 47);
$this->drupalPostForm('admin/config/search/path/add', $edit, 'Save');
$this->assertNoText($alias, 'The untruncated alias was not found.');
// The untruncated alias should not be found.
$this->assertNoText($alias);
// The 'truncated' alias will always be found.
$this->assertText($truncated_alias, 'The truncated alias was found.');
$this->assertText($truncated_alias);
// Create third test node.
$node3 = $this->drupalCreateNode();
@ -196,9 +199,9 @@ class PathAliasTest extends PathTestBase {
$this->drupalPostForm('admin/config/search/path/add', $edit, 'Save');
// Confirm that the alias with trailing slash is not found.
$this->assertNoText($edit['alias[0][value]'], 'The absolute alias was not found.');
$this->assertNoText($edit['alias[0][value]']);
// The alias without trailing flash is found.
$this->assertText(trim($edit['alias[0][value]'], '/'), 'The alias without trailing slash was found.');
$this->assertText(trim($edit['alias[0][value]'], '/'));
// Update an existing alias to point to a different source.
$pid = $this->getPID($node4_alias);
@ -208,8 +211,10 @@ class PathAliasTest extends PathTestBase {
$this->drupalPostForm('admin/config/search/path/edit/' . $pid, $edit, 'Save');
$this->assertText('The alias has been saved.');
$this->drupalGet($edit['alias[0][value]']);
$this->assertNoText($node4->label(), 'Previous alias no longer works.');
$this->assertText($node2->label(), 'Alias works.');
// Previous alias should no longer work.
$this->assertNoText($node4->label());
// Alias should work.
$this->assertText($node2->label());
$this->assertSession()->statusCodeEquals(200);
// Update an existing alias to use a duplicate alias.
@ -248,7 +253,7 @@ class PathAliasTest extends PathTestBase {
// Confirm that the alias works.
$this->drupalGet($edit['path[0][alias]']);
$this->assertText($node1->label(), 'Alias works.');
$this->assertText($node1->label());
$this->assertSession()->statusCodeEquals(200);
// Confirm the 'canonical' and 'shortlink' URLs.
@ -280,12 +285,12 @@ class PathAliasTest extends PathTestBase {
// Confirm that the alias works.
$this->drupalGet(mb_strtoupper($edit['path[0][alias]']));
$this->assertText($node1->label(), 'Changed alias works.');
$this->assertText($node1->label());
$this->assertSession()->statusCodeEquals(200);
// Make sure that previous alias no longer works.
$this->drupalGet($previous);
$this->assertNoText($node1->label(), 'Previous alias no longer works.');
$this->assertNoText($node1->label());
$this->assertSession()->statusCodeEquals(404);
// Create second test node.
@ -303,7 +308,7 @@ class PathAliasTest extends PathTestBase {
// Confirm that the alias no longer works.
$this->drupalGet($edit['path[0][alias]']);
$this->assertNoText($node1->label(), 'Alias was successfully deleted.');
$this->assertNoText($node1->label());
$this->assertSession()->statusCodeEquals(404);
// Create third test node.
@ -315,7 +320,7 @@ class PathAliasTest extends PathTestBase {
// Confirm that the alias was converted to a relative path.
$this->drupalGet(trim($edit['path[0][alias]'], '/'));
$this->assertText($node3->label(), 'Alias became relative.');
$this->assertText($node3->label());
$this->assertSession()->statusCodeEquals(200);
// Create fourth test node.
@ -327,7 +332,7 @@ class PathAliasTest extends PathTestBase {
// Confirm that the alias was converted to a relative path.
$this->drupalGet(trim($edit['path[0][alias]'], '/'));
$this->assertText($node4->label(), 'Alias trimmed trailing slash.');
$this->assertText($node4->label());
$this->assertSession()->statusCodeEquals(200);
// Create fifth test node.

View File

@ -92,7 +92,7 @@ class PathLanguageTest extends PathTestBase {
// Confirm that the alias works.
$this->drupalGet($english_alias);
$this->assertText($english_node->body->value, 'Alias works.');
$this->assertText($english_node->body->value);
// Translate the node into French.
$this->drupalGet('node/' . $english_node->id() . '/translations');
@ -121,7 +121,7 @@ class PathLanguageTest extends PathTestBase {
// Confirm that the alias works.
$this->drupalGet('fr' . $edit['path[0][alias]']);
$this->assertText($english_node_french_translation->body->value, 'Alias for French translation works.');
$this->assertText($english_node_french_translation->body->value);
// Confirm that the alias is returned for the URL. Languages are cached on
// many levels, and we need to clear those caches.
@ -154,11 +154,11 @@ class PathLanguageTest extends PathTestBase {
// path alias for French matching the english alias. So the alias manager
// needs to use the URL language to check whether the alias is valid.
$this->drupalGet($english_alias);
$this->assertText($english_node_french_translation->body->value, 'English alias, but French preferred by the user: French translation.');
$this->assertText($english_node_french_translation->body->value);
// Check that the French alias works.
$this->drupalGet("fr/$french_alias");
$this->assertText($english_node_french_translation->body->value, 'Alias for French translation works.');
$this->assertText($english_node_french_translation->body->value);
// Disable URL language negotiation.
$edit = ['language_interface[enabled][language-url]' => FALSE];
@ -166,7 +166,7 @@ class PathLanguageTest extends PathTestBase {
// Check that the English alias still works.
$this->drupalGet($english_alias);
$this->assertText($english_node_french_translation->body->value, 'English alias, but French preferred by the user: French translation.');
$this->assertText($english_node_french_translation->body->value);
// Check that the French alias is not available. We check the unprefixed
// alias because we disabled URL language negotiation above. In this
@ -199,7 +199,7 @@ class PathLanguageTest extends PathTestBase {
// Check that the English alias still works.
$this->drupalGet($english_alias);
$this->assertPathAliasExists('/' . $english_alias, 'en', NULL, 'English alias is not deleted when French translation is removed.');
$this->assertText($english_node->body->value, 'English alias still works');
$this->assertText($english_node->body->value);
}
}

View File

@ -59,7 +59,7 @@ class PathLanguageUiTest extends PathTestBase {
$this->drupalPostForm('admin/config/search/path/add', $edit, 'Save');
$this->drupalGet($name);
$this->assertText('Filter aliases', 'Language-neutral URL alias works');
$this->assertText('Filter aliases');
}
/**
@ -74,7 +74,7 @@ class PathLanguageUiTest extends PathTestBase {
$this->drupalPostForm('admin/config/search/path/add', $edit, 'Save');
$this->drupalGet($name);
$this->assertText('Filter aliases', 'English URL alias works');
$this->assertText('Filter aliases');
}
/**
@ -89,7 +89,7 @@ class PathLanguageUiTest extends PathTestBase {
$this->drupalPostForm('admin/config/search/path/add', $edit, 'Save');
$this->drupalGet('fr/' . $name);
$this->assertText('Filter aliases', 'Foreign URL alias works');
$this->assertText('Filter aliases');
}
/**

View File

@ -64,7 +64,7 @@ class PathTaxonomyTermTest extends PathTestBase {
// Confirm that the alias works.
$this->drupalGet($edit['path[0][alias]']);
$this->assertText($description, 'Term can be accessed on URL alias.');
$this->assertText($description);
// Confirm the 'canonical' and 'shortlink' URLs.
$elements = $this->xpath("//link[contains(@rel, 'canonical') and contains(@href, '" . $edit['path[0][alias]'] . "')]");
@ -79,11 +79,11 @@ class PathTaxonomyTermTest extends PathTestBase {
// Confirm that the changed alias works.
$this->drupalGet(trim($edit2['path[0][alias]'], '/'));
$this->assertText($description, 'Term can be accessed on changed URL alias.');
$this->assertText($description);
// Confirm that the old alias no longer works.
$this->drupalGet(trim($edit['path[0][alias]'], '/'));
$this->assertNoText($description, 'Old URL alias has been removed after altering.');
$this->assertNoText($description);
$this->assertSession()->statusCodeEquals(404);
// Remove the term's URL alias.
@ -93,7 +93,7 @@ class PathTaxonomyTermTest extends PathTestBase {
// Confirm that the alias no longer works.
$this->drupalGet(trim($edit2['path[0][alias]'], '/'));
$this->assertNoText($description, 'Old URL alias has been removed after altering.');
$this->assertNoText($description);
$this->assertSession()->statusCodeEquals(404);
}

View File

@ -71,7 +71,7 @@ class UrlAlterFunctionalTest extends BrowserTestBase {
// Test that 'forum' is altered to 'community' correctly, both at the root
// level and for a specific existing forum.
$this->drupalGet('community');
$this->assertText('General discussion', 'The community path gets resolved correctly');
$this->assertText('General discussion');
$this->assertUrlOutboundAlter('/forum', '/community');
$forum_vid = $this->config('forum.settings')->get('vocabulary');
$term_name = $this->randomMachineName();
@ -81,7 +81,7 @@ class UrlAlterFunctionalTest extends BrowserTestBase {
]);
$term->save();
$this->drupalGet("community/" . $term->id());
$this->assertText($term_name, 'The community/{tid} path gets resolved correctly');
$this->assertText($term_name);
$this->assertUrlOutboundAlter("/forum/" . $term->id(), "/community/" . $term->id());
// Test outbound query string altering.

Some files were not shown because too many files have changed in this diff Show More