Issue #3139404 by mondrake, munish.kumar, pavnish, longwave: [May 25, 2021] Replace usages of AssertLegacyTrait::assertText, that is deprecated
parent
4a72cc3169
commit
3872f1a8ed
|
@ -52,9 +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.');
|
||||
$this->assertSession()->pageTextContains('The action has been successfully saved.');
|
||||
// The action label appears on the configuration page.
|
||||
$this->assertText($action_label);
|
||||
$this->assertSession()->pageTextContains($action_label);
|
||||
|
||||
// Make another POST request to the action edit page.
|
||||
$this->clickLink(t('Configure'));
|
||||
|
@ -67,12 +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.');
|
||||
$this->assertSession()->pageTextContains('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->assertSession()->pageTextContains($new_action_label);
|
||||
|
||||
// Make sure the URL appears when re-editing the action.
|
||||
$this->clickLink(t('Configure'));
|
||||
|
|
|
@ -37,7 +37,7 @@ class AddFeedTest extends AggregatorTestBase {
|
|||
$this->drupalGet('aggregator/sources/' . $feed->id());
|
||||
$this->assertSession()->statusCodeEquals(200);
|
||||
// Verify that the feed label is present in the page title.
|
||||
$this->assertText($feed->label());
|
||||
$this->assertSession()->pageTextContains($feed->label());
|
||||
$this->assertRaw($feed->getWebsiteUrl());
|
||||
|
||||
// Try to add a duplicate.
|
||||
|
@ -94,7 +94,7 @@ class AddFeedTest extends AggregatorTestBase {
|
|||
$this->drupalGet('aggregator/sources/' . $feed->id());
|
||||
$this->assertSession()->statusCodeEquals(200);
|
||||
// Verify that the feed label is present in the page title.
|
||||
$this->assertText($feed->label());
|
||||
$this->assertSession()->pageTextContains($feed->label());
|
||||
|
||||
// Delete feeds.
|
||||
$this->deleteFeed($feed);
|
||||
|
|
|
@ -22,9 +22,9 @@ class AggregatorAdminTest extends AggregatorTestBase {
|
|||
$this->clickLink('Aggregator');
|
||||
$this->clickLink('Settings');
|
||||
// Make sure that test plugins are present.
|
||||
$this->assertText('Test fetcher');
|
||||
$this->assertText('Test parser');
|
||||
$this->assertText('Test processor');
|
||||
$this->assertSession()->pageTextContains('Test fetcher');
|
||||
$this->assertSession()->pageTextContains('Test parser');
|
||||
$this->assertSession()->pageTextContains('Test processor');
|
||||
|
||||
// Set new values and enable test plugins.
|
||||
$edit = [
|
||||
|
@ -37,7 +37,7 @@ class AggregatorAdminTest extends AggregatorTestBase {
|
|||
'aggregator_processors[aggregator_test_processor]' => 'aggregator_test_processor',
|
||||
];
|
||||
$this->drupalPostForm('admin/config/services/aggregator/settings', $edit, 'Save configuration');
|
||||
$this->assertText('The configuration options have been saved.');
|
||||
$this->assertSession()->pageTextContains('The configuration options have been saved.');
|
||||
|
||||
// Check that settings have the correct default value.
|
||||
foreach ($edit as $name => $value) {
|
||||
|
@ -45,13 +45,13 @@ class AggregatorAdminTest extends AggregatorTestBase {
|
|||
}
|
||||
|
||||
// Check for our test processor settings form.
|
||||
$this->assertText('Dummy length setting');
|
||||
$this->assertSession()->pageTextContains('Dummy length setting');
|
||||
// Change its value to ensure that settingsSubmit is called.
|
||||
$edit = [
|
||||
'dummy_length' => 100,
|
||||
];
|
||||
$this->drupalPostForm('admin/config/services/aggregator/settings', $edit, 'Save configuration');
|
||||
$this->assertText('The configuration options have been saved.');
|
||||
$this->assertSession()->pageTextContains('The configuration options have been saved.');
|
||||
$this->assertSession()->fieldValueEquals('dummy_length', 100);
|
||||
|
||||
// Make sure settings form is still accessible even after uninstalling a module
|
||||
|
|
|
@ -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());
|
||||
$this->assertSession()->pageTextContains($block->label());
|
||||
|
||||
// Confirm items appear as links.
|
||||
$items = $this->container->get('entity_type.manager')->getStorage('aggregator_item')->loadByFeed($feed->id(), 1);
|
||||
|
|
|
@ -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.');
|
||||
$this->assertSession()->pageTextContains('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/")]');
|
||||
|
|
|
@ -38,7 +38,7 @@ class DeleteFeedTest extends AggregatorTestBase {
|
|||
|
||||
// Delete feed.
|
||||
$this->deleteFeed($feed1);
|
||||
$this->assertText($feed2->label());
|
||||
$this->assertSession()->pageTextContains($feed2->label());
|
||||
$block_storage = $this->container->get('entity_type.manager')->getStorage('block');
|
||||
$this->assertNull($block_storage->load($block->id()), 'Block for the deleted feed was deleted.');
|
||||
$this->assertEquals($block2->id(), $block_storage->load($block2->id())->id(), 'Block for not deleted feed still exists.');
|
||||
|
|
|
@ -26,8 +26,8 @@ class FeedAdminDisplayTest extends AggregatorTestBase {
|
|||
|
||||
// The scheduled feed shows that it has not been updated yet and is
|
||||
// scheduled.
|
||||
$this->assertText('never');
|
||||
$this->assertText('imminently');
|
||||
$this->assertSession()->pageTextContains('never');
|
||||
$this->assertSession()->pageTextContains('imminently');
|
||||
$this->assertNoText('ago');
|
||||
$this->assertNoText('left');
|
||||
|
||||
|
@ -38,8 +38,8 @@ class FeedAdminDisplayTest extends AggregatorTestBase {
|
|||
// and next update.
|
||||
$this->assertNoText('never');
|
||||
$this->assertNoText('imminently');
|
||||
$this->assertText('ago');
|
||||
$this->assertText('left');
|
||||
$this->assertSession()->pageTextContains('ago');
|
||||
$this->assertSession()->pageTextContains('left');
|
||||
|
||||
// Delete scheduled feed.
|
||||
$this->deleteFeed($scheduled_feed);
|
||||
|
@ -49,7 +49,7 @@ 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');
|
||||
$this->assertSession()->pageTextContains('never');
|
||||
$this->assertNoText('imminently');
|
||||
$this->assertNoText('ago');
|
||||
$this->assertNoText('left');
|
||||
|
@ -59,9 +59,9 @@ class FeedAdminDisplayTest extends AggregatorTestBase {
|
|||
|
||||
// After the feed update, we still need to see "never" as next update label.
|
||||
// Last update will show an interval.
|
||||
$this->assertText('never');
|
||||
$this->assertSession()->pageTextContains('never');
|
||||
$this->assertNoText('imminently');
|
||||
$this->assertText('ago');
|
||||
$this->assertSession()->pageTextContains('ago');
|
||||
$this->assertNoText('left');
|
||||
}
|
||||
|
||||
|
|
|
@ -38,18 +38,18 @@ class FeedParserTest extends AggregatorTestBase {
|
|||
$feed->refreshItems();
|
||||
$this->drupalGet('aggregator/sources/' . $feed->id());
|
||||
$this->assertSession()->statusCodeEquals(200);
|
||||
$this->assertText('First example feed item title');
|
||||
$this->assertSession()->pageTextContains('First example feed item title');
|
||||
$this->assertSession()->linkByHrefExists('http://example.com/example-turns-one');
|
||||
$this->assertText('First example feed item description.');
|
||||
$this->assertSession()->pageTextContains('First example feed item description.');
|
||||
$this->assertRaw('<img src="http://example.com/images/druplicon.png"');
|
||||
|
||||
// Several additional items that include elements over 255 characters.
|
||||
$this->assertRaw("Second example feed item title.");
|
||||
$this->assertText('Long link feed item title');
|
||||
$this->assertText('Long link feed item description');
|
||||
$this->assertSession()->pageTextContains('Long link feed item title');
|
||||
$this->assertSession()->pageTextContains('Long link feed item description');
|
||||
$this->assertSession()->linkByHrefExists('http://example.com/tomorrow/and/tomorrow/and/tomorrow/creeps/in/this/petty/pace/from/day/to/day/to/the/last/syllable/of/recorded/time/and/all/our/yesterdays/have/lighted/fools/the/way/to/dusty/death/out/out/brief/candle/life/is/but/a/walking/shadow/a/poor/player/that/struts/and/frets/his/hour/upon/the/stage/and/is/heard/no/more/it/is/a/tale/told/by/an/idiot/full/of/sound/and/fury/signifying/nothing');
|
||||
$this->assertText('Long author feed item title');
|
||||
$this->assertText('Long author feed item description');
|
||||
$this->assertSession()->pageTextContains('Long author feed item title');
|
||||
$this->assertSession()->pageTextContains('Long author feed item description');
|
||||
$this->assertSession()->linkByHrefExists('http://example.com/long/author');
|
||||
}
|
||||
|
||||
|
@ -61,9 +61,9 @@ class FeedParserTest extends AggregatorTestBase {
|
|||
$feed->refreshItems();
|
||||
$this->drupalGet('aggregator/sources/' . $feed->id());
|
||||
$this->assertSession()->statusCodeEquals(200);
|
||||
$this->assertText('Atom-Powered Robots Run Amok');
|
||||
$this->assertSession()->pageTextContains('Atom-Powered Robots Run Amok');
|
||||
$this->assertSession()->linkByHrefExists('http://example.org/2003/12/13/atom03');
|
||||
$this->assertText('Some text.');
|
||||
$this->assertSession()->pageTextContains('Some text.');
|
||||
$item_ids = \Drupal::entityQuery('aggregator_item')
|
||||
->accessCheck(FALSE)
|
||||
->condition('link', 'http://example.org/2003/12/13/atom03')
|
||||
|
@ -72,9 +72,9 @@ class FeedParserTest extends AggregatorTestBase {
|
|||
$this->assertEquals('urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a', $item->getGuid(), 'Atom entry id element is parsed correctly.');
|
||||
|
||||
// Check for second feed entry.
|
||||
$this->assertText('We tried to stop them, but we failed.');
|
||||
$this->assertSession()->pageTextContains('We tried to stop them, but we failed.');
|
||||
$this->assertSession()->linkByHrefExists('http://example.org/2003/12/14/atom03');
|
||||
$this->assertText('Some other text.');
|
||||
$this->assertSession()->pageTextContains('Some other text.');
|
||||
$item_ids = \Drupal::entityQuery('aggregator_item')
|
||||
->accessCheck(FALSE)
|
||||
->condition('link', 'http://example.org/2003/12/14/atom03')
|
||||
|
|
|
@ -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.');
|
||||
$this->assertSession()->pageTextContains('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');
|
||||
|
@ -75,7 +75,7 @@ class ImportOpmlTest extends AggregatorTestBase {
|
|||
// 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.');
|
||||
$this->assertSession()->pageTextContains('The URL invalidUrl://empty is not valid.');
|
||||
|
||||
$after = $count_query->execute();
|
||||
$this->assertEquals($before, $after, 'No feeds were added during the three last form submissions.');
|
||||
|
@ -91,12 +91,12 @@ class ImportOpmlTest extends AggregatorTestBase {
|
|||
// 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.');
|
||||
$this->assertSession()->pageTextContains('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.');
|
||||
$this->assertSession()->pageTextContains('No new feed has been added.');
|
||||
|
||||
$after = $count_query->execute();
|
||||
$this->assertEquals($before, $after, 'No feeds were added during the two last form submissions.');
|
||||
|
|
|
@ -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.');
|
||||
$this->assertSession()->pageTextContains('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/")]');
|
||||
|
|
|
@ -30,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.');
|
||||
$this->assertSession()->pageTextContains('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/")]');
|
||||
|
@ -42,7 +42,7 @@ class UpdateFeedTest extends AggregatorTestBase {
|
|||
// 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]']);
|
||||
$this->assertSession()->pageTextContains($edit['title[0][value]']);
|
||||
|
||||
// Set correct title so deleteFeed() will work.
|
||||
$feed->title = $edit['title[0][value]'];
|
||||
|
|
|
@ -47,25 +47,25 @@ class IpAddressBlockingTest extends BrowserTestBase {
|
|||
$edit = [];
|
||||
$edit['ip'] = '1.2.3.3';
|
||||
$this->drupalPostForm('admin/config/people/ban', $edit, 'Add');
|
||||
$this->assertText('This IP address is already banned.');
|
||||
$this->assertSession()->pageTextContains('This IP address is already banned.');
|
||||
|
||||
// Try to block a reserved IP address.
|
||||
$edit = [];
|
||||
$edit['ip'] = '255.255.255.255';
|
||||
$this->drupalPostForm('admin/config/people/ban', $edit, 'Add');
|
||||
$this->assertText('Enter a valid IP address.');
|
||||
$this->assertSession()->pageTextContains('Enter a valid IP address.');
|
||||
|
||||
// Try to block a reserved IP address.
|
||||
$edit = [];
|
||||
$edit['ip'] = 'test.example.com';
|
||||
$this->drupalPostForm('admin/config/people/ban', $edit, 'Add');
|
||||
$this->assertText('Enter a valid IP address.');
|
||||
$this->assertSession()->pageTextContains('Enter a valid IP address.');
|
||||
|
||||
// Submit an empty form.
|
||||
$edit = [];
|
||||
$edit['ip'] = '';
|
||||
$this->drupalPostForm('admin/config/people/ban', $edit, 'Add');
|
||||
$this->assertText('Enter a valid IP address.');
|
||||
$this->assertSession()->pageTextContains('Enter a valid IP address.');
|
||||
|
||||
// Pass an IP address as a URL parameter and submit it.
|
||||
$submit_ip = '1.2.3.4';
|
||||
|
@ -80,7 +80,7 @@ class IpAddressBlockingTest extends BrowserTestBase {
|
|||
// $edit = array();
|
||||
// $edit['ip'] = \Drupal::request()->getClientIP();
|
||||
// $this->drupalPostForm('admin/config/people/ban', $edit, 'Save');
|
||||
// $this->assertText('You may not ban your own IP address.');
|
||||
// $this->assertSession()->pageTextContains('You may not ban your own IP address.');
|
||||
|
||||
// Test duplicate ip address are not present in the 'blocked_ips' table.
|
||||
// when they are entered programmatically.
|
||||
|
|
|
@ -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());
|
||||
$this->assertSession()->pageTextContains($account->getAccountName());
|
||||
$this->assertSession()->statusCodeEquals(200);
|
||||
$this->mink->resetSessions();
|
||||
$this->assertSession()->responseHeaderDoesNotExist('X-Drupal-Cache');
|
||||
|
@ -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());
|
||||
$this->assertSession()->pageTextContains($account->getAccountName());
|
||||
$this->assertSession()->statusCodeEquals(200);
|
||||
}
|
||||
|
||||
|
@ -180,26 +180,26 @@ class BasicAuthTest extends BrowserTestBase {
|
|||
$this->drupalGet($url);
|
||||
$this->assertSession()->statusCodeEquals(401);
|
||||
$this->assertNoText('Exception');
|
||||
$this->assertText('Please log in to access this page.');
|
||||
$this->assertSession()->pageTextContains('Please log in to access this page.');
|
||||
|
||||
// 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');
|
||||
$this->assertSession()->pageTextContains('Access denied');
|
||||
|
||||
// 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');
|
||||
$this->assertSession()->pageTextContains('Access denied');
|
||||
|
||||
// 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');
|
||||
$this->assertSession()->pageTextContains('Access denied');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -85,21 +85,21 @@ class BlockCacheTest extends BrowserTestBase {
|
|||
\Drupal::state()->set('block_test.content', $current_content);
|
||||
$this->drupalLogin($this->normalUser);
|
||||
$this->drupalGet('');
|
||||
$this->assertText($current_content);
|
||||
$this->assertSession()->pageTextContains($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);
|
||||
$this->assertSession()->pageTextContains($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);
|
||||
// Fresh block content is displayed after clearing the cache.
|
||||
$this->assertText($current_content);
|
||||
$this->assertSession()->pageTextContains($current_content);
|
||||
|
||||
// Test whether the cached data is served for the correct users.
|
||||
$old_content = $current_content;
|
||||
|
@ -113,7 +113,7 @@ class BlockCacheTest extends BrowserTestBase {
|
|||
// User with the same roles sees per-role cached content.
|
||||
$this->drupalLogin($this->normalUserAlt);
|
||||
$this->drupalGet('');
|
||||
$this->assertText($old_content);
|
||||
$this->assertSession()->pageTextContains($old_content);
|
||||
|
||||
// Admin user does not see content cached per-role for normal user.
|
||||
$this->drupalLogin($this->adminUser);
|
||||
|
@ -123,7 +123,7 @@ class BlockCacheTest extends BrowserTestBase {
|
|||
// Block is served from the per-role cache.
|
||||
$this->drupalLogin($this->normalUser);
|
||||
$this->drupalGet('');
|
||||
$this->assertText($old_content);
|
||||
$this->assertSession()->pageTextContains($old_content);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -138,7 +138,7 @@ class BlockCacheTest extends BrowserTestBase {
|
|||
\Drupal::state()->set('block_test.content', $current_content);
|
||||
|
||||
$this->drupalGet('');
|
||||
$this->assertText($current_content);
|
||||
$this->assertSession()->pageTextContains($current_content);
|
||||
|
||||
$old_content = $current_content;
|
||||
$current_content = $this->randomMachineName();
|
||||
|
@ -146,12 +146,12 @@ class BlockCacheTest extends BrowserTestBase {
|
|||
|
||||
// Block content served from cache.
|
||||
$this->drupalGet('user');
|
||||
$this->assertText($old_content);
|
||||
$this->assertSession()->pageTextContains($old_content);
|
||||
|
||||
// Block content not served from cache.
|
||||
$this->drupalLogout();
|
||||
$this->drupalGet('user');
|
||||
$this->assertText($current_content);
|
||||
$this->assertSession()->pageTextContains($current_content);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -165,14 +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);
|
||||
$this->assertSession()->pageTextContains($current_content);
|
||||
|
||||
// A cached copy should not be served.
|
||||
$current_content = $this->randomMachineName();
|
||||
\Drupal::state()->set('block_test.content', $current_content);
|
||||
$this->drupalGet('');
|
||||
// Maximum age of zero prevents blocks from being cached.
|
||||
$this->assertText($current_content);
|
||||
$this->assertSession()->pageTextContains($current_content);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -186,7 +186,7 @@ class BlockCacheTest extends BrowserTestBase {
|
|||
$this->drupalLogin($this->normalUser);
|
||||
|
||||
$this->drupalGet('');
|
||||
$this->assertText($current_content);
|
||||
$this->assertSession()->pageTextContains($current_content);
|
||||
|
||||
$old_content = $current_content;
|
||||
$current_content = $this->randomMachineName();
|
||||
|
@ -194,17 +194,17 @@ class BlockCacheTest extends BrowserTestBase {
|
|||
|
||||
// Block is served from per-user cache.
|
||||
$this->drupalGet('');
|
||||
$this->assertText($old_content);
|
||||
$this->assertSession()->pageTextContains($old_content);
|
||||
|
||||
// Per-user block cache is not served for other users.
|
||||
$this->drupalLogin($this->normalUserAlt);
|
||||
$this->drupalGet('');
|
||||
$this->assertText($current_content);
|
||||
$this->assertSession()->pageTextContains($current_content);
|
||||
|
||||
// Per-user block cache is persistent.
|
||||
$this->drupalLogin($this->normalUser);
|
||||
$this->drupalGet('');
|
||||
$this->assertText($old_content);
|
||||
$this->assertSession()->pageTextContains($old_content);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -217,7 +217,7 @@ class BlockCacheTest extends BrowserTestBase {
|
|||
\Drupal::state()->set('block_test.content', $current_content);
|
||||
|
||||
$this->drupalGet('test-page');
|
||||
$this->assertText($current_content);
|
||||
$this->assertSession()->pageTextContains($current_content);
|
||||
|
||||
$old_content = $current_content;
|
||||
$current_content = $this->randomMachineName();
|
||||
|
@ -231,7 +231,7 @@ class BlockCacheTest extends BrowserTestBase {
|
|||
$this->drupalGet('test-page');
|
||||
$this->assertSession()->statusCodeEquals(200);
|
||||
// Verify that the block content is cached for the test page.
|
||||
$this->assertText($old_content);
|
||||
$this->assertSession()->pageTextContains($old_content);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -43,25 +43,25 @@ 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.');
|
||||
$this->assertSession()->pageTextContains('Your .com email address.');
|
||||
|
||||
// Make sure that we're currently still on /test-page after submitting the
|
||||
// form.
|
||||
$this->submitForm($form_values, 'Submit');
|
||||
$this->assertSession()->addressEquals('test-page');
|
||||
$this->assertText('Your email address is test@example.com');
|
||||
$this->assertSession()->pageTextContains('Your email address is test@example.com');
|
||||
|
||||
// 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.');
|
||||
$this->assertSession()->pageTextContains('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
|
||||
// /test-render-title.
|
||||
$this->submitForm($form_values, 'Submit');
|
||||
$this->assertSession()->addressEquals('test-render-title');
|
||||
$this->assertText('Your email address is test@example.com');
|
||||
$this->assertSession()->pageTextContains('Your email address is test@example.com');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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);
|
||||
$this->assertSession()->pageTextContains('Form action: ' . $placeholder);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ class BlockHiddenRegionTest extends BrowserTestBase {
|
|||
|
||||
// Ensure that the search form block is displayed.
|
||||
$this->drupalGet('');
|
||||
$this->assertText('Search');
|
||||
$this->assertSession()->pageTextContains('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');
|
||||
$this->assertSession()->pageTextContains('Search');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ class BlockInstallTest extends BrowserTestBase {
|
|||
// invalidated the 'rendered' cache tag to make blocks show up.
|
||||
$this->drupalGet('');
|
||||
$this->assertSession()->responseHeaderContains('X-Drupal-Cache-Tags', 'config:block_list');
|
||||
$this->assertText('Powered by Drupal');
|
||||
$this->assertSession()->pageTextContains('Powered by Drupal');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -68,13 +68,13 @@ class BlockLanguageCacheTest extends BrowserTestBase {
|
|||
$edit['label'] = $this->randomMachineName();
|
||||
$edit['id'] = mb_strtolower($edit['label']);
|
||||
$this->drupalPostForm('admin/structure/menu/add', $edit, 'Save');
|
||||
$this->assertText('Menu ' . $edit['label'] . ' has been added.');
|
||||
$this->assertSession()->pageTextContains('Menu ' . $edit['label'] . ' has been added.');
|
||||
|
||||
// Check that the block is listed for all languages.
|
||||
foreach ($this->langcodes as $langcode) {
|
||||
$this->drupalGet('admin/structure/block', ['language' => $langcode]);
|
||||
$this->clickLink('Place block');
|
||||
$this->assertText($edit['label']);
|
||||
$this->assertSession()->pageTextContains($edit['label']);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ class BlockLanguageTest extends BrowserTestBase {
|
|||
$this->drupalPostForm('admin/config/regional/language/add', $edit, 'Add language');
|
||||
|
||||
// Verify that language was added successfully.
|
||||
$this->assertText('French');
|
||||
$this->assertSession()->pageTextContains('French');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -77,7 +77,7 @@ class BlockLanguageTest extends BrowserTestBase {
|
|||
|
||||
// Check that a page has a block.
|
||||
$this->drupalGet('en');
|
||||
$this->assertText('Powered by Drupal');
|
||||
$this->assertSession()->pageTextContains('Powered by Drupal');
|
||||
|
||||
// Check that a page doesn't has a block for the current language anymore.
|
||||
$this->drupalGet('fr');
|
||||
|
@ -158,7 +158,7 @@ class BlockLanguageTest extends BrowserTestBase {
|
|||
$this->drupalGet('node', ['query' => ['language' => 'en']]);
|
||||
$this->assertNoText('Powered by Drupal');
|
||||
$this->drupalGet('node', ['query' => ['language' => 'fr']]);
|
||||
$this->assertText('Powered by Drupal');
|
||||
$this->assertSession()->pageTextContains('Powered by Drupal');
|
||||
|
||||
// Log in again in order to clear the interface language stored in the
|
||||
// session.
|
||||
|
@ -189,7 +189,7 @@ class BlockLanguageTest extends BrowserTestBase {
|
|||
$this->drupalGet('en');
|
||||
$this->assertNoText('Powered by Drupal');
|
||||
$this->drupalGet('fr');
|
||||
$this->assertText('Powered by Drupal');
|
||||
$this->assertSession()->pageTextContains('Powered by Drupal');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -44,14 +44,14 @@ 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.');
|
||||
$this->assertSession()->pageTextContains('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);
|
||||
$this->assertSession()->pageTextContains($title);
|
||||
|
||||
// Confirm that the block is not displayed according to block visibility
|
||||
// rules.
|
||||
|
@ -122,7 +122,7 @@ 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.');
|
||||
$this->assertSession()->pageTextContains('The block configuration has been saved.');
|
||||
|
||||
// Confirm that block was not displayed according to block visibility
|
||||
// rules.
|
||||
|
@ -206,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.');
|
||||
$this->assertSession()->pageTextContains('The block configuration has been saved.');
|
||||
// Check to see if the block was created by checking its configuration.
|
||||
$instance = Block::load($block['id']);
|
||||
|
||||
|
@ -222,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.');
|
||||
$this->assertSession()->pageTextContains('The block settings have been updated.');
|
||||
|
||||
// Confirm that the block instance title and markup are not displayed.
|
||||
$this->drupalGet('node');
|
||||
|
@ -266,7 +266,7 @@ class BlockTest extends BlockTestBase {
|
|||
$block['theme'] = $theme;
|
||||
$block['region'] = 'content';
|
||||
$this->drupalPostForm('admin/structure/block/add/system_powered_by_block', $block, 'Save block');
|
||||
$this->assertText('The block configuration has been saved.');
|
||||
$this->assertSession()->pageTextContains('The block configuration has been saved.');
|
||||
$this->assertSession()->addressEquals('admin/structure/block/list/' . $theme . '?block-placement=' . Html::getClass($block['id']));
|
||||
|
||||
// Set the default theme and ensure the block is placed.
|
||||
|
@ -309,7 +309,7 @@ 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.');
|
||||
$this->assertSession()->pageTextContains('The block configuration has been saved.');
|
||||
|
||||
// Confirm that the block is not displayed by default.
|
||||
$this->drupalGet('user');
|
||||
|
@ -319,14 +319,14 @@ class BlockTest extends BlockTestBase {
|
|||
'settings[label_display]' => TRUE,
|
||||
];
|
||||
$this->drupalPostForm('admin/structure/block/manage/' . $id, $edit, 'Save block');
|
||||
$this->assertText('The block configuration has been saved.');
|
||||
$this->assertSession()->pageTextContains('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);
|
||||
$this->assertSession()->pageTextContains($title);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -349,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.');
|
||||
$this->assertSession()->pageTextContains('The block settings have been updated.');
|
||||
|
||||
// Confirm that the block is being displayed.
|
||||
$this->drupalGet('');
|
||||
$this->assertText($block['settings[label]']);
|
||||
$this->assertSession()->pageTextContains($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]/*', [
|
||||
|
@ -488,7 +488,7 @@ class BlockTest extends BlockTestBase {
|
|||
]);
|
||||
$this->drupalLogin($theme_admin);
|
||||
$this->drupalGet('admin/appearance');
|
||||
$this->assertText('You can place blocks for each theme on the block layout page');
|
||||
$this->assertSession()->pageTextContains('You can place blocks for each theme on the block layout page');
|
||||
$this->assertSession()->linkByHrefExists('admin/structure/block');
|
||||
}
|
||||
|
||||
|
@ -503,7 +503,7 @@ class BlockTest extends BlockTestBase {
|
|||
$this->config('system.theme')->set('default', 'seven')->save();
|
||||
$block = $this->drupalPlaceBlock('system_powered_by_block', ['theme' => 'seven', 'region' => 'help']);
|
||||
$this->drupalGet('<front>');
|
||||
$this->assertText('Powered by Drupal');
|
||||
$this->assertSession()->pageTextContains('Powered by Drupal');
|
||||
|
||||
$this->config('system.theme')->set('default', 'classy')->save();
|
||||
$theme_installer->uninstall(['seven']);
|
||||
|
@ -523,7 +523,7 @@ class BlockTest extends BlockTestBase {
|
|||
|
||||
\Drupal::state()->set('test_block_access', TRUE);
|
||||
$this->drupalGet('<front>');
|
||||
$this->assertText('Hello test world');
|
||||
$this->assertSession()->pageTextContains('Hello test world');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -239,8 +239,8 @@ class BlockUiTest extends BrowserTestBase {
|
|||
$this->drupalPostForm($block_url, $edit, 'Save block');
|
||||
|
||||
$this->drupalGet('');
|
||||
$this->assertText('Test context-aware block');
|
||||
$this->assertText('User context found.');
|
||||
$this->assertSession()->pageTextContains('Test context-aware block');
|
||||
$this->assertSession()->pageTextContains('User context found.');
|
||||
$this->assertRaw($expected_text);
|
||||
|
||||
// Test context mapping form element is not visible if there are no valid
|
||||
|
@ -257,7 +257,7 @@ class BlockUiTest extends BrowserTestBase {
|
|||
];
|
||||
$this->submitForm($edit, 'Save block');
|
||||
$this->drupalGet('');
|
||||
$this->assertText('No context mapping selected.');
|
||||
$this->assertSession()->pageTextContains('No context mapping selected.');
|
||||
$this->assertNoText('User context found.');
|
||||
|
||||
// Tests that conditions with missing context are not displayed.
|
||||
|
@ -277,13 +277,13 @@ class BlockUiTest extends BrowserTestBase {
|
|||
$this->assertSession()->fieldValueEquals('id', 'displaymessage');
|
||||
$edit = ['region' => 'content'];
|
||||
$this->drupalPostForm($url, $edit, 'Save block');
|
||||
$this->assertText('The block configuration has been saved.');
|
||||
$this->assertSession()->pageTextContains('The block configuration has been saved.');
|
||||
|
||||
// Now, check to make sure the form starts by autoincrementing correctly.
|
||||
$this->drupalGet($url);
|
||||
$this->assertSession()->fieldValueEquals('id', 'displaymessage_2');
|
||||
$this->drupalPostForm($url, $edit, 'Save block');
|
||||
$this->assertText('The block configuration has been saved.');
|
||||
$this->assertSession()->pageTextContains('The block configuration has been saved.');
|
||||
|
||||
// And verify that it continues working beyond just the first two.
|
||||
$this->drupalGet($url);
|
||||
|
|
|
@ -248,11 +248,11 @@ class BlockContentCreationTest extends BlockContentTestBase {
|
|||
|
||||
// Navigate to home page.
|
||||
$this->drupalGet('');
|
||||
$this->assertText($body);
|
||||
$this->assertSession()->pageTextContains($body);
|
||||
|
||||
// Delete the block.
|
||||
$this->drupalGet('block/1/delete');
|
||||
$this->assertText('This will also remove 1 placed block instance.');
|
||||
$this->assertSession()->pageTextContains('This will also remove 1 placed block instance.');
|
||||
|
||||
$this->submitForm([], 'Delete');
|
||||
$this->assertRaw(t('The custom block %name has been deleted.', ['%name' => $edit['info[0][value]']]));
|
||||
|
|
|
@ -107,7 +107,7 @@ class BlockContentListTest extends BlockContentTestBase {
|
|||
$this->assertSession()->elementTextNotContains('xpath', '//td', $new_label);
|
||||
|
||||
// Confirm that the empty text is displayed.
|
||||
$this->assertText('There are no custom blocks yet.');
|
||||
$this->assertSession()->pageTextContains('There are no custom blocks yet.');
|
||||
|
||||
$block_content = BlockContent::create([
|
||||
'info' => 'Non-reusable block',
|
||||
|
|
|
@ -116,7 +116,7 @@ class BlockContentListViewsTest extends BlockContentTestBase {
|
|||
$this->assertSession()->elementTextNotContains('xpath', '//td', $new_label);
|
||||
|
||||
// Confirm that the empty text is displayed.
|
||||
$this->assertText('There are no custom blocks available.');
|
||||
$this->assertSession()->pageTextContains('There are no custom blocks available.');
|
||||
$this->assertSession()->linkExists('custom block');
|
||||
|
||||
$block_content = BlockContent::create([
|
||||
|
|
|
@ -71,7 +71,7 @@ class BlockContentTypeTest extends BlockContentTestBase {
|
|||
// Test the page with no block-types.
|
||||
$this->drupalGet('block/add');
|
||||
$this->assertSession()->statusCodeEquals(200);
|
||||
$this->assertText('You have not created any block types yet');
|
||||
$this->assertSession()->pageTextContains('You have not created any block types yet');
|
||||
$this->clickLink('block type creation page');
|
||||
|
||||
// Create a block type via the user interface.
|
||||
|
@ -185,7 +185,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.');
|
||||
$this->assertSession()->pageTextContains('This action cannot be undone.');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -72,7 +72,7 @@ class PageEditTest extends BlockContentTestBase {
|
|||
// Test deleting the block.
|
||||
$this->drupalGet("block/" . $revised_block->id());
|
||||
$this->clickLink(t('Delete'));
|
||||
$this->assertText('Are you sure you want to delete the custom block ' . $revised_block->label() . '?');
|
||||
$this->assertSession()->pageTextContains('Are you sure you want to delete the custom block ' . $revised_block->label() . '?');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ class BlockContentRedirectTest extends BlockContentTestBase {
|
|||
|
||||
// Check the block content is present in the view redirect destination.
|
||||
$this->drupalGet('admin/content/redirect_destination');
|
||||
$this->assertText('Test redirect destination');
|
||||
$this->assertSession()->pageTextContains('Test redirect destination');
|
||||
|
||||
// Edit the created block and save.
|
||||
$this->clickLink('Edit');
|
||||
|
|
|
@ -161,7 +161,7 @@ class BookTest extends BrowserTestBase {
|
|||
// Log in as a user with access to the book outline and save the form.
|
||||
$this->drupalLogin($this->adminUser);
|
||||
$this->drupalPostForm('admin/structure/book/' . $book->id(), [], 'Save book pages');
|
||||
$this->assertText('Updated book ' . $book->label() . '.');
|
||||
$this->assertSession()->pageTextContains('Updated book ' . $book->label() . '.');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -253,7 +253,7 @@ class BookTest extends BrowserTestBase {
|
|||
|
||||
// Make sure each part of the book is there.
|
||||
foreach ($nodes as $node) {
|
||||
$this->assertText($node->label());
|
||||
$this->assertSession()->pageTextContains($node->label());
|
||||
$this->assertRaw($node->body->processed);
|
||||
}
|
||||
|
||||
|
@ -297,15 +297,15 @@ 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.');
|
||||
$this->assertSession()->pageTextContains('The changes have been saved.');
|
||||
|
||||
// Test correct display of the block.
|
||||
$nodes = $this->createBook();
|
||||
$this->drupalGet('<front>');
|
||||
// Book navigation block.
|
||||
$this->assertText($block->label());
|
||||
$this->assertSession()->pageTextContains($block->label());
|
||||
// Link to book root.
|
||||
$this->assertText($this->book->label());
|
||||
$this->assertSession()->pageTextContains($this->book->label());
|
||||
// No links to individual book pages.
|
||||
$this->assertNoText($nodes[0]->label());
|
||||
|
||||
|
@ -398,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.');
|
||||
$this->assertSession()->pageTextContains('The changes have been saved.');
|
||||
|
||||
// Create a book.
|
||||
$this->createBook();
|
||||
|
@ -406,12 +406,12 @@ 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());
|
||||
$this->assertSession()->pageTextContains($block->label());
|
||||
$this->drupalLogout();
|
||||
|
||||
// Test correct display of the block to anonymous users.
|
||||
$this->drupalGet('node/' . $this->book->id());
|
||||
$this->assertText($block->label());
|
||||
$this->assertSession()->pageTextContains($block->label());
|
||||
|
||||
// Test the 'book pages' block_mode setting.
|
||||
$this->drupalGet('<front>');
|
||||
|
@ -458,7 +458,7 @@ class BookTest extends BrowserTestBase {
|
|||
$this->drupalPostForm($this->book->toUrl('delete-form'), [], 'Delete');
|
||||
$this->drupalGet($nodes[0]->toUrl());
|
||||
$this->assertSession()->statusCodeEquals(200);
|
||||
$this->assertText($nodes[0]->label());
|
||||
$this->assertSession()->pageTextContains($nodes[0]->label());
|
||||
// The book parents should be updated.
|
||||
$node_storage = \Drupal::entityTypeManager()->getStorage('node');
|
||||
$node_storage->resetCache();
|
||||
|
@ -559,7 +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());
|
||||
$this->assertSession()->pageTextContains($this->book->label());
|
||||
|
||||
// Unpublish the top book page and confirm that the created book title is
|
||||
// not displayed for anonymous.
|
||||
|
@ -610,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());
|
||||
$this->assertSession()->pageTextContains($this->book->label());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -624,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());
|
||||
$this->assertSession()->pageTextContains($this->book->label());
|
||||
|
||||
$elements = $this->xpath('//table//ul[@class="dropbutton"]/li/a');
|
||||
$this->assertEquals('View', $elements[0]->getText(), 'View link is found from the list.');
|
||||
|
@ -712,7 +712,7 @@ class BookTest extends BrowserTestBase {
|
|||
$this->drupalGet('node/' . $this->book->id());
|
||||
// Unpublished book with "Show block only on book pages" book navigation
|
||||
// settings.
|
||||
$this->assertText($this->book->label());
|
||||
$this->assertSession()->pageTextContains($this->book->label());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -141,7 +141,7 @@ trait BookTestTrait {
|
|||
|
||||
// Check printer friendly version.
|
||||
$this->drupalGet('book/export/html/' . $node->id());
|
||||
$this->assertText($node->label());
|
||||
$this->assertSession()->pageTextContains($node->label());
|
||||
$this->assertRaw($node->body->processed);
|
||||
|
||||
$number++;
|
||||
|
|
|
@ -227,7 +227,7 @@ class CKEditorAdminTest extends BrowserTestBase {
|
|||
$this->submitForm($edit, 'editor_configure');
|
||||
$this->submitForm($edit, 'Save configuration');
|
||||
$this->assertSession()->statusCodeEquals(200);
|
||||
$this->assertText('The machine-readable name is already in use. It must be unique.');
|
||||
$this->assertSession()->pageTextContains('The machine-readable name is already in use. It must be unique.');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -53,7 +53,7 @@ class ColorSafePreviewTest extends BrowserTestBase {
|
|||
// core/modules/color/tests/modules/color_test/themes/color_test_theme/color/preview.html
|
||||
$url = Url::fromRoute('system.theme_settings_theme', ['theme' => 'color_test_theme']);
|
||||
$this->drupalGet($url);
|
||||
$this->assertText('TEST COLOR PREVIEW');
|
||||
$this->assertSession()->pageTextContains('TEST COLOR PREVIEW');
|
||||
|
||||
$this->assertNoRaw('<script>alert("security filter test");</script>');
|
||||
$this->assertRaw('<h2>TEST COLOR PREVIEW</h2>');
|
||||
|
|
|
@ -171,10 +171,10 @@ class ColorTest extends BrowserTestBase {
|
|||
$this->drupalPostForm($settings_path, $edit, 'Save configuration');
|
||||
|
||||
if ($is_valid) {
|
||||
$this->assertText('The configuration options have been saved.');
|
||||
$this->assertSession()->pageTextContains('The configuration options have been saved.');
|
||||
}
|
||||
else {
|
||||
$this->assertText('You must enter a valid hexadecimal color value for Main background.');
|
||||
$this->assertSession()->pageTextContains('You must enter a valid hexadecimal color value for Main background.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ class CommentAdminTest extends CommentTestBase {
|
|||
|
||||
// Test that the comments page loads correctly when there are no comments
|
||||
$this->drupalGet('admin/content/comment');
|
||||
$this->assertText('No comments available.');
|
||||
$this->assertSession()->pageTextContains('No comments available.');
|
||||
|
||||
$this->drupalLogout();
|
||||
|
||||
|
@ -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.');
|
||||
$this->assertSession()->pageTextContains('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)');
|
||||
$this->assertSession()->pageTextContains('Unapproved comments (2)');
|
||||
$edit = [
|
||||
"comments[{$comments[0]->id()}]" => 1,
|
||||
"comments[{$comments[1]->id()}]" => 1,
|
||||
];
|
||||
$this->submitForm($edit, 'Update');
|
||||
$this->assertText('Unapproved comments (0)');
|
||||
$this->assertSession()->pageTextContains('Unapproved comments (0)');
|
||||
|
||||
// Delete multiple comments in one operation.
|
||||
$edit = [
|
||||
|
@ -99,21 +99,21 @@ 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?');
|
||||
$this->assertSession()->pageTextContains('Are you sure you want to delete these comments and all their children?');
|
||||
$this->submitForm([], 'Delete');
|
||||
$this->assertText('No comments available.');
|
||||
$this->assertSession()->pageTextContains('No comments available.');
|
||||
// Test message when no comments selected.
|
||||
$edit = [
|
||||
'operation' => 'delete',
|
||||
];
|
||||
$this->submitForm($edit, 'Update');
|
||||
$this->assertText('Select one or more comments to perform the update on.');
|
||||
$this->assertSession()->pageTextContains('Select one or more comments to perform the update on.');
|
||||
|
||||
// Make sure the label of unpublished node is not visible on listing page.
|
||||
$this->drupalGet('admin/content/comment');
|
||||
$this->postComment($this->node, $this->randomMachineName());
|
||||
$this->drupalGet('admin/content/comment');
|
||||
$this->assertText(Html::escape($this->node->label()));
|
||||
$this->assertSession()->pageTextContains(Html::escape($this->node->label()));
|
||||
$this->node->setUnpublished()->save();
|
||||
$this->drupalGet('admin/content/comment');
|
||||
$this->assertNoText(Html::escape($this->node->label()));
|
||||
|
@ -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.');
|
||||
$this->assertSession()->pageTextContains('Your comment has been queued for review by site administrators and will be published after approval.');
|
||||
|
||||
// Get unapproved comment id.
|
||||
$this->drupalLogin($this->adminUser);
|
||||
|
@ -184,15 +184,15 @@ class CommentAdminTest extends CommentTestBase {
|
|||
$this->drupalGet('admin/structure/comment');
|
||||
$this->assertSession()->statusCodeEquals(200);
|
||||
// Make sure titles visible.
|
||||
$this->assertText('Comment type');
|
||||
$this->assertText('Description');
|
||||
$this->assertSession()->pageTextContains('Comment type');
|
||||
$this->assertSession()->pageTextContains('Description');
|
||||
// Make sure the description is present.
|
||||
$this->assertText('Default comment field');
|
||||
$this->assertSession()->pageTextContains('Default comment field');
|
||||
// Manage fields.
|
||||
$this->clickLink('Manage fields');
|
||||
$this->assertSession()->statusCodeEquals(200);
|
||||
// Make sure comment_body field is shown.
|
||||
$this->assertText('comment_body');
|
||||
$this->assertSession()->pageTextContains('comment_body');
|
||||
// Rest from here on in is field_ui.
|
||||
}
|
||||
|
||||
|
@ -280,8 +280,8 @@ class CommentAdminTest extends CommentTestBase {
|
|||
$this->drupalPostForm('admin/content/comment', $edit, 'Update');
|
||||
$this->assertRaw(new FormattableMarkup('@label (Original translation) - <em>The following comment translations will be deleted:</em>', ['@label' => $comment1->label()]));
|
||||
$this->assertRaw(new FormattableMarkup('@label (Original translation) - <em>The following comment translations will be deleted:</em>', ['@label' => $comment2->label()]));
|
||||
$this->assertText('English');
|
||||
$this->assertText('Urdu');
|
||||
$this->assertSession()->pageTextContains('English');
|
||||
$this->assertSession()->pageTextContains('Urdu');
|
||||
$this->submitForm([], 'Delete');
|
||||
$after_count = $count_query->execute();
|
||||
$this->assertEquals($before_count, $after_count, 'No comment or translation found.');
|
||||
|
|
|
@ -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.');
|
||||
$this->assertSession()->pageTextContains('Email field is required.');
|
||||
$this->assertFalse($this->commentExists($anonymous_comment3), 'Anonymous comment with contact info (required) not found.');
|
||||
|
||||
// Post comment with contact info (required).
|
||||
|
|
|
@ -67,12 +67,12 @@ class CommentBlockTest extends CommentTestBase {
|
|||
// block.
|
||||
$this->drupalLogin($this->webUser);
|
||||
$this->drupalGet('');
|
||||
$this->assertText('Recent comments');
|
||||
$this->assertSession()->pageTextContains('Recent comments');
|
||||
|
||||
// Test the only the 10 latest comments are shown and in the proper order.
|
||||
$this->assertNoText($comments[10]->getSubject());
|
||||
for ($i = 0; $i < 10; $i++) {
|
||||
$this->assertText($comments[$i]->getSubject());
|
||||
$this->assertSession()->pageTextContains($comments[$i]->getSubject());
|
||||
if ($i > 1) {
|
||||
$previous_position = $position;
|
||||
$position = strpos($this->getSession()->getPage()->getContent(), $comments[$i]->getSubject());
|
||||
|
@ -86,7 +86,7 @@ class CommentBlockTest extends CommentTestBase {
|
|||
|
||||
for ($i = 0; $i < 10; $i++) {
|
||||
$this->clickLink($comments[$i]->getSubject());
|
||||
$this->assertText($comments[$i]->getSubject());
|
||||
$this->assertSession()->pageTextContains($comments[$i]->getSubject());
|
||||
$this->assertRaw('<link rel="canonical"');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -69,17 +69,17 @@ class CommentBookTest extends BrowserTestBase {
|
|||
|
||||
$this->drupalGet('node/' . $book_node->id());
|
||||
|
||||
$this->assertText($comment_subject);
|
||||
$this->assertText($comment_body);
|
||||
$this->assertText('Add new comment');
|
||||
$this->assertSession()->pageTextContains($comment_subject);
|
||||
$this->assertSession()->pageTextContains($comment_body);
|
||||
$this->assertSession()->pageTextContains('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');
|
||||
$this->assertText($comment_subject);
|
||||
$this->assertText($comment_body);
|
||||
$this->assertSession()->pageTextContains('Comments');
|
||||
$this->assertSession()->pageTextContains($comment_subject);
|
||||
$this->assertSession()->pageTextContains($comment_body);
|
||||
|
||||
$this->assertNoText('Add new comment');
|
||||
// Verify that the comment form subject field is not found.
|
||||
|
|
|
@ -128,7 +128,7 @@ class CommentCacheTagsTest extends EntityWithUriCacheTagsTestBase {
|
|||
// Ensure that a new comment only invalidates the commented entity.
|
||||
$this->verifyPageCache($this->entityTestCamelid->toUrl(), 'HIT');
|
||||
$this->verifyPageCache($this->entityTestHippopotamidae->toUrl(), 'MISS');
|
||||
$this->assertText($hippo_comment->getSubject());
|
||||
$this->assertSession()->pageTextContains($hippo_comment->getSubject());
|
||||
|
||||
// Ensure that updating an existing comment only invalidates the commented
|
||||
// entity.
|
||||
|
|
|
@ -163,7 +163,7 @@ class CommentFieldsTest extends CommentTestBase {
|
|||
$edit = [];
|
||||
$this->drupalPostForm('admin/config/people/accounts/fields/user.user.field_user_comment/storage', $edit, 'Save field settings');
|
||||
// We should get an error message.
|
||||
$this->assertText('An illegal choice has been detected. Please contact the site administrator.');
|
||||
$this->assertSession()->pageTextContains('An illegal choice has been detected. Please contact the site administrator.');
|
||||
|
||||
// Create a comment type for users.
|
||||
$bundle = CommentType::create([
|
||||
|
|
|
@ -85,8 +85,8 @@ class CommentInterfaceTest extends CommentTestBase {
|
|||
// Check comment display.
|
||||
$this->drupalLogin($this->webUser);
|
||||
$this->drupalGet('node/' . $this->node->id());
|
||||
$this->assertText($subject_text);
|
||||
$this->assertText($comment_text);
|
||||
$this->assertSession()->pageTextContains($subject_text);
|
||||
$this->assertSession()->pageTextContains($comment_text);
|
||||
$arguments = [
|
||||
':link' => base_path() . 'comment/' . $comment->id() . '#comment-' . $comment->id(),
|
||||
];
|
||||
|
@ -132,8 +132,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);
|
||||
$this->assertText($comment_text);
|
||||
$this->assertSession()->pageTextContains($subject_text);
|
||||
$this->assertSession()->pageTextContains($comment_text);
|
||||
$reply = $this->postComment(NULL, $this->randomMachineName(), '', TRUE);
|
||||
$reply_loaded = Comment::load($reply->id());
|
||||
$this->assertTrue($this->commentExists($reply, TRUE), 'Reply found.');
|
||||
|
@ -143,8 +143,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());
|
||||
$this->assertText($comment->comment_body->value);
|
||||
$this->assertSession()->pageTextContains($comment->getSubject());
|
||||
$this->assertSession()->pageTextContains($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.');
|
||||
|
@ -153,8 +153,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());
|
||||
$this->assertText($reply_loaded->comment_body->value);
|
||||
$this->assertSession()->pageTextContains($reply_loaded->getSubject());
|
||||
$this->assertSession()->pageTextContains($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.');
|
||||
|
|
|
@ -138,7 +138,7 @@ class CommentLinksTest extends CommentTestBase {
|
|||
|
||||
// Visit the full node, make sure there are links for the comment.
|
||||
$this->drupalGet('node/' . $this->node->id());
|
||||
$this->assertText($comment->getSubject());
|
||||
$this->assertSession()->pageTextContains($comment->getSubject());
|
||||
$this->assertSession()->linkExists('Reply');
|
||||
|
||||
// Make sure we can hide comment links.
|
||||
|
@ -146,7 +146,7 @@ class CommentLinksTest extends CommentTestBase {
|
|||
->removeComponent('links')
|
||||
->save();
|
||||
$this->drupalGet('node/' . $this->node->id());
|
||||
$this->assertText($comment->getSubject());
|
||||
$this->assertSession()->pageTextContains($comment->getSubject());
|
||||
$this->assertSession()->linkNotExists('Reply');
|
||||
}
|
||||
|
||||
|
|
|
@ -66,8 +66,8 @@ class CommentNodeAccessTest extends CommentTestBase {
|
|||
|
||||
// Check comment display.
|
||||
$this->drupalGet('node/' . $this->node->id());
|
||||
$this->assertText($comment_subject);
|
||||
$this->assertText($comment_text);
|
||||
$this->assertSession()->pageTextContains($comment_subject);
|
||||
$this->assertSession()->pageTextContains($comment_text);
|
||||
|
||||
// Reply to comment, creating second comment.
|
||||
$this->drupalGet('comment/reply/node/' . $this->node->id() . '/comment/' . $comment->id());
|
||||
|
@ -78,10 +78,10 @@ class CommentNodeAccessTest extends CommentTestBase {
|
|||
|
||||
// Go to the node page and verify comment and reply are visible.
|
||||
$this->drupalGet('node/' . $this->node->id());
|
||||
$this->assertText($comment_text);
|
||||
$this->assertText($comment_subject);
|
||||
$this->assertText($reply_text);
|
||||
$this->assertText($reply_subject);
|
||||
$this->assertSession()->pageTextContains($comment_text);
|
||||
$this->assertSession()->pageTextContains($comment_subject);
|
||||
$this->assertSession()->pageTextContains($reply_text);
|
||||
$this->assertSession()->pageTextContains($reply_subject);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -172,9 +172,9 @@ class CommentNonNodeTest extends BrowserTestBase {
|
|||
if ($contact !== TRUE) {
|
||||
// If true then attempting to find error message.
|
||||
if ($subject) {
|
||||
$this->assertText($subject);
|
||||
$this->assertSession()->pageTextContains($subject);
|
||||
}
|
||||
$this->assertText($comment);
|
||||
$this->assertSession()->pageTextContains($comment);
|
||||
// Check the comment ID was extracted.
|
||||
$this->assertArrayHasKey(1, $match);
|
||||
}
|
||||
|
@ -241,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.');
|
||||
$this->assertSession()->pageTextContains('The update has been performed.');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -271,7 +271,7 @@ class CommentNonNodeTest extends BrowserTestBase {
|
|||
$this->drupalLogin($limited_user);
|
||||
// Test that default field exists.
|
||||
$this->drupalGet('entity_test/structure/entity_test/fields');
|
||||
$this->assertText('Comments');
|
||||
$this->assertSession()->pageTextContains('Comments');
|
||||
$this->assertSession()->linkByHrefExists('entity_test/structure/entity_test/fields/entity_test.entity_test.comment');
|
||||
// Test widget hidden option is not visible when there's no comments.
|
||||
$this->drupalGet('entity_test/structure/entity_test/fields/entity_test.entity_test.comment');
|
||||
|
@ -334,7 +334,7 @@ class CommentNonNodeTest extends BrowserTestBase {
|
|||
$this->assertRaw('comments[' . $comment1->id() . ']');
|
||||
|
||||
// Check that entity access applies to administrative page.
|
||||
$this->assertText($this->entity->label());
|
||||
$this->assertSession()->pageTextContains($this->entity->label());
|
||||
$limited_user = $this->drupalCreateUser([
|
||||
'administer comments',
|
||||
]);
|
||||
|
|
|
@ -345,11 +345,11 @@ class CommentPagerTest extends CommentTestBase {
|
|||
$this->drupalGet('admin/structure/types/manage/article/display');
|
||||
// No summary for standard pager.
|
||||
$this->assertNoText('Pager ID: 0');
|
||||
$this->assertText('Pager ID: 1');
|
||||
$this->assertSession()->pageTextContains('Pager ID: 1');
|
||||
$this->submitForm([], 'comment_settings_edit');
|
||||
// Change default pager to 2.
|
||||
$this->submitForm(['fields[comment][settings_edit_form][settings][pager_id]' => 2], 'Save');
|
||||
$this->assertText('Pager ID: 2');
|
||||
$this->assertSession()->pageTextContains('Pager ID: 2');
|
||||
// Revert the changes.
|
||||
$this->submitForm([], 'comment_settings_edit');
|
||||
$this->submitForm(['fields[comment][settings_edit_form][settings][pager_id]' => 0], 'Save');
|
||||
|
|
|
@ -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]']);
|
||||
$this->assertText($edit['comment_body[0][value]']);
|
||||
$this->assertSession()->pageTextContains($edit['subject[0][value]']);
|
||||
$this->assertSession()->pageTextContains($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]']);
|
||||
$this->assertText($edit['comment_body[0][value]']);
|
||||
$this->assertSession()->pageTextContains($edit['subject[0][value]']);
|
||||
$this->assertSession()->pageTextContains($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]']);
|
||||
|
@ -111,7 +111,7 @@ class CommentPreviewTest extends CommentTestBase {
|
|||
|
||||
// Store the content of this page.
|
||||
$this->submitForm([], 'Save');
|
||||
$this->assertText('Your comment has been posted.');
|
||||
$this->assertSession()->pageTextContains('Your comment has been posted.');
|
||||
$elements = $this->xpath('//section[contains(@class, "comment-wrapper")]/article');
|
||||
$this->assertCount(1, $elements);
|
||||
|
||||
|
@ -119,7 +119,7 @@ class CommentPreviewTest extends CommentTestBase {
|
|||
$this->getSession()->getDriver()->back();
|
||||
$submit_button = $this->assertSession()->buttonExists('Save');
|
||||
$submit_button->click();
|
||||
$this->assertText('Your comment has been posted.');
|
||||
$this->assertSession()->pageTextContains('Your comment has been posted.');
|
||||
$elements = $this->xpath('//section[contains(@class, "comment-wrapper")]/article');
|
||||
$this->assertCount(2, $elements);
|
||||
}
|
||||
|
@ -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]']);
|
||||
$this->assertText($edit['comment_body[0][value]']);
|
||||
$this->assertText($web_user->getAccountName());
|
||||
$this->assertText($expected_text_date);
|
||||
$this->assertSession()->pageTextContains($edit['subject[0][value]']);
|
||||
$this->assertSession()->pageTextContains($edit['comment_body[0][value]']);
|
||||
$this->assertSession()->pageTextContains($web_user->getAccountName());
|
||||
$this->assertSession()->pageTextContains($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.');
|
||||
$this->assertSession()->pageTextContains('Your comment has been posted.');
|
||||
|
||||
// Check that the comment fields are correct after loading the saved comment.
|
||||
$this->drupalGet('comment/' . $comment->id() . '/edit');
|
||||
|
|
|
@ -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);
|
||||
$this->assertSession()->pageTextContains($subject);
|
||||
}
|
||||
$this->assertText($comment);
|
||||
$this->assertSession()->pageTextContains($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.');
|
||||
$this->assertSession()->pageTextContains('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.');
|
||||
$this->assertSession()->pageTextContains('The update has been performed.');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ class CommentTypeTest extends CommentTestBase {
|
|||
// Edit the comment-type and ensure that we cannot change the entity-type.
|
||||
$this->drupalGet('admin/structure/comment/manage/foo');
|
||||
$this->assertSession()->fieldNotExists('target_entity_type_id');
|
||||
$this->assertText('Target entity type');
|
||||
$this->assertSession()->pageTextContains('Target entity type');
|
||||
// Save the form and ensure the entity-type value is preserved even though
|
||||
// the field isn't present.
|
||||
$this->submitForm([], 'Save');
|
||||
|
@ -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.');
|
||||
$this->assertSession()->pageTextContains('This action cannot be undone.');
|
||||
|
||||
// Test exception thrown when re-using an existing comment type.
|
||||
try {
|
||||
|
|
|
@ -52,7 +52,7 @@ class CommentAdminTest extends CommentBrowserTestBase {
|
|||
|
||||
// Test that the comments page loads correctly when there are no comments.
|
||||
$this->drupalGet('admin/content/comment');
|
||||
$this->assertText('No comments available.');
|
||||
$this->assertSession()->pageTextContains('No comments available.');
|
||||
|
||||
// Assert the expose filters on the admin page.
|
||||
$this->assertSession()->fieldExists('subject');
|
||||
|
@ -69,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.');
|
||||
$this->assertSession()->pageTextContains('Your comment has been queued for review by site administrators and will be published after approval.');
|
||||
|
||||
// Get unapproved comment id.
|
||||
$this->drupalLogin($this->adminUser);
|
||||
|
@ -93,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.');
|
||||
$this->assertSession()->pageTextContains('Publish comment was applied to 1 item.');
|
||||
$this->drupalLogout();
|
||||
|
||||
$this->drupalGet('node/' . $this->node->id());
|
||||
|
@ -106,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)');
|
||||
$this->assertSession()->pageTextContains('Unapproved comments (2)');
|
||||
|
||||
// Assert the expose filters on the admin page.
|
||||
$this->assertSession()->fieldExists('subject');
|
||||
|
@ -119,11 +119,11 @@ class CommentAdminTest extends CommentBrowserTestBase {
|
|||
"comment_bulk_form[0]" => $comments[1]->id(),
|
||||
];
|
||||
$this->submitForm($edit, 'Apply to selected items');
|
||||
$this->assertText('Unapproved comments (0)');
|
||||
$this->assertSession()->pageTextContains('Unapproved comments (0)');
|
||||
|
||||
// Test message when no comments selected.
|
||||
$this->drupalPostForm('admin/content/comment', [], 'Apply to selected items');
|
||||
$this->assertText('Select one or more comments to perform the update on.');
|
||||
$this->assertSession()->pageTextContains('Select one or more comments to perform the update on.');
|
||||
|
||||
$subject_link = $this->xpath('//table/tbody/tr/td/a[contains(@href, :href) and contains(@title, :title) and text()=:text]', [
|
||||
':href' => $comments[0]->permalink()->toString(),
|
||||
|
@ -132,7 +132,7 @@ class CommentAdminTest extends CommentBrowserTestBase {
|
|||
]);
|
||||
$this->assertTrue(!empty($subject_link), 'Comment listing shows the correct subject link.');
|
||||
// Verify that anonymous author name is displayed correctly.
|
||||
$this->assertText($author_name . ' (not verified)');
|
||||
$this->assertSession()->pageTextContains($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(),
|
||||
|
@ -141,7 +141,7 @@ class CommentAdminTest extends CommentBrowserTestBase {
|
|||
]);
|
||||
$this->assertTrue(!empty($subject_link), 'Comment listing shows the correct subject link.');
|
||||
// Verify that anonymous author name is displayed correctly.
|
||||
$this->assertText($author_name . ' (not verified)');
|
||||
$this->assertSession()->pageTextContains($author_name . ' (not verified)');
|
||||
|
||||
// Delete multiple comments in one operation.
|
||||
$edit = [
|
||||
|
@ -151,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?');
|
||||
$this->assertSession()->pageTextContains('Are you sure you want to delete these comments and all their children?');
|
||||
$this->submitForm([], 'Delete');
|
||||
$this->assertText('No comments available.');
|
||||
$this->assertSession()->pageTextContains('No comments available.');
|
||||
|
||||
// Make sure the label of unpublished node is not visible on listing page.
|
||||
$this->drupalGet('admin/content/comment');
|
||||
|
@ -162,7 +162,7 @@ class CommentAdminTest extends CommentBrowserTestBase {
|
|||
$this->drupalLogin($this->adminUser);
|
||||
$this->drupalGet('admin/content/comment');
|
||||
// Verify that comment admin can see the title of a published node.
|
||||
$this->assertText(Html::escape($this->node->label()));
|
||||
$this->assertSession()->pageTextContains(Html::escape($this->node->label()));
|
||||
$this->node->setUnpublished()->save();
|
||||
$this->assertFalse($this->node->isPublished(), 'Node is unpublished now.');
|
||||
$this->drupalGet('admin/content/comment');
|
||||
|
@ -177,7 +177,7 @@ class CommentAdminTest extends CommentBrowserTestBase {
|
|||
$this->drupalGet('admin/content/comment');
|
||||
// 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()));
|
||||
$this->assertSession()->pageTextContains(Html::escape($this->node->label()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -222,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()));
|
||||
$this->assertText(Html::escape($block_content->label()));
|
||||
$this->assertSession()->pageTextContains(Html::escape($this->node->label()));
|
||||
$this->assertSession()->pageTextContains(Html::escape($block_content->label()));
|
||||
// Admin page contains subject of both entities.
|
||||
$this->assertText(Html::escape($node_comment->label()));
|
||||
$this->assertText(Html::escape($block_content_comment->label()));
|
||||
$this->assertSession()->pageTextContains(Html::escape($node_comment->label()));
|
||||
$this->assertSession()->pageTextContains(Html::escape($block_content_comment->label()));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -24,14 +24,14 @@ class CommentEditTest extends CommentBrowserTestBase {
|
|||
// Post a comment to node.
|
||||
$node_comment = $this->postComment($this->node, $this->randomMachineName(), $this->randomMachineName(), TRUE);
|
||||
$this->drupalGet('admin/content/comment');
|
||||
$this->assertText($this->adminUser->label());
|
||||
$this->assertSession()->pageTextContains($this->adminUser->label());
|
||||
$this->drupalGet($node_comment->toUrl('edit-form'));
|
||||
$edit = [
|
||||
'comment_body[0][value]' => $this->randomMachineName(),
|
||||
];
|
||||
$this->submitForm($edit, 'Save');
|
||||
$this->drupalGet('admin/content/comment');
|
||||
$this->assertText($this->adminUser->label());
|
||||
$this->assertSession()->pageTextContains($this->adminUser->label());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ class CacheabilityMetadataConfigOverrideIntegrationTest extends BrowserTestBase
|
|||
// overridden.
|
||||
\Drupal::state()->set('config_override_integration_test.enabled', TRUE);
|
||||
$this->drupalGet('<front>');
|
||||
$this->assertText('Overridden block label');
|
||||
$this->assertSession()->pageTextContains('Overridden block label');
|
||||
|
||||
// Both the cache context and tag should still be present.
|
||||
$this->assertCacheContext('config_override_integration_test');
|
||||
|
|
|
@ -70,8 +70,8 @@ class ConfigDependencyWebTest extends BrowserTestBase {
|
|||
$this->assertNoText('Configuration deletions');
|
||||
$this->drupalGet($entity1->toUrl('delete-form'));
|
||||
$this->assertNoText('Configuration updates');
|
||||
$this->assertText('Configuration deletions');
|
||||
$this->assertText($entity2->id());
|
||||
$this->assertSession()->pageTextContains('Configuration deletions');
|
||||
$this->assertSession()->pageTextContains($entity2->id());
|
||||
$this->drupalPostForm($entity1->toUrl('delete-form'), [], 'Delete');
|
||||
$storage->resetCache();
|
||||
$this->assertEmpty($storage->loadMultiple([$entity1->id(), $entity2->id()]), 'Test entities deleted');
|
||||
|
@ -117,10 +117,10 @@ class ConfigDependencyWebTest extends BrowserTestBase {
|
|||
$entity3->save();
|
||||
|
||||
$this->drupalGet($entity1->toUrl('delete-form'));
|
||||
$this->assertText('Configuration updates');
|
||||
$this->assertSession()->pageTextContains('Configuration updates');
|
||||
$this->assertNoText('Configuration deletions');
|
||||
$this->assertNoText($entity2->id());
|
||||
$this->assertText($entity2->label());
|
||||
$this->assertSession()->pageTextContains($entity2->label());
|
||||
$this->assertNoText($entity3->id());
|
||||
$this->drupalPostForm($entity1->toUrl('delete-form'), [], 'Delete');
|
||||
$storage->resetCache();
|
||||
|
|
|
@ -47,7 +47,7 @@ class ConfigEntityFormOverrideTest extends BrowserTestBase {
|
|||
|
||||
// Test that the original label on the listing page is intact.
|
||||
$this->drupalGet('admin/structure/config_test');
|
||||
$this->assertText($original_label);
|
||||
$this->assertSession()->pageTextContains($original_label);
|
||||
$this->assertNoText($overridden_label);
|
||||
|
||||
// Test that the original label on the editing page is intact.
|
||||
|
@ -62,7 +62,7 @@ class ConfigEntityFormOverrideTest extends BrowserTestBase {
|
|||
$this->submitForm($edit, 'Save');
|
||||
$this->drupalGet('admin/structure/config_test');
|
||||
$this->assertNoText($overridden_label);
|
||||
$this->assertText($edited_label);
|
||||
$this->assertSession()->pageTextContains($edited_label);
|
||||
|
||||
// Test that the editing page now has the edited label.
|
||||
$this->drupalGet('admin/structure/config_test/manage/dotted.default');
|
||||
|
|
|
@ -246,7 +246,7 @@ class ConfigEntityListTest extends BrowserTestBase {
|
|||
$this->assertSession()->elementNotExists('xpath', '//td[text() = "dotted.default"]');
|
||||
|
||||
// Confirm that the empty text is displayed.
|
||||
$this->assertText('There are no test configuration entities yet.');
|
||||
$this->assertSession()->pageTextContains('There are no test configuration entities yet.');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -282,7 +282,7 @@ class ConfigEntityTest extends BrowserTestBase {
|
|||
$this->drupalPostForm('admin/structure/config_test/add', $edit, 'Save');
|
||||
$this->assertSession()->addressEquals('admin/structure/config_test');
|
||||
$this->assertSession()->statusCodeEquals(200);
|
||||
$this->assertText($label1);
|
||||
$this->assertSession()->pageTextContains($label1);
|
||||
$this->assertSession()->linkByHrefExists("admin/structure/config_test/manage/$id");
|
||||
|
||||
// Rename the configuration entity's ID/machine name.
|
||||
|
@ -295,7 +295,7 @@ class ConfigEntityTest extends BrowserTestBase {
|
|||
$this->assertSession()->statusCodeEquals(200);
|
||||
$this->assertNoText($label1);
|
||||
$this->assertNoText($label2);
|
||||
$this->assertText($label3);
|
||||
$this->assertSession()->pageTextContains($label3);
|
||||
$this->assertSession()->linkByHrefNotExists("admin/structure/config_test/manage/$id");
|
||||
$id = $edit['id'];
|
||||
$this->assertSession()->linkByHrefExists("admin/structure/config_test/manage/$id");
|
||||
|
|
|
@ -92,7 +92,7 @@ class ConfigExportImportUITest extends BrowserTestBase {
|
|||
// After installation there is no snapshot and nothing to import.
|
||||
$this->drupalGet('admin/config/development/configuration');
|
||||
$this->assertNoText('Warning message');
|
||||
$this->assertText('There are no configuration changes to import.');
|
||||
$this->assertSession()->pageTextContains('There are no configuration changes to import.');
|
||||
|
||||
$this->originalSlogan = $this->config('system.site')->get('slogan');
|
||||
$this->newSlogan = $this->randomString(16);
|
||||
|
@ -170,12 +170,12 @@ class ConfigExportImportUITest extends BrowserTestBase {
|
|||
// There is no snapshot yet because an import has never run.
|
||||
$this->assertNoText('Warning message');
|
||||
$this->assertNoText('There are no configuration changes to import.');
|
||||
$this->assertText($this->contentType->label());
|
||||
$this->assertSession()->pageTextContains($this->contentType->label());
|
||||
|
||||
$this->submitForm([], 'Import all');
|
||||
// After importing the snapshot has been updated and there are no warnings.
|
||||
$this->assertNoText('Warning message');
|
||||
$this->assertText('There are no configuration changes to import.');
|
||||
$this->assertSession()->pageTextContains('There are no configuration changes to import.');
|
||||
|
||||
$this->assertEquals($this->newSlogan, $this->config('system.site')->get('slogan'));
|
||||
|
||||
|
@ -186,8 +186,8 @@ class ConfigExportImportUITest extends BrowserTestBase {
|
|||
->set('slogan', $this->originalSlogan)
|
||||
->save();
|
||||
$this->drupalGet('admin/config/development/configuration');
|
||||
$this->assertText('Warning message');
|
||||
$this->assertText('The following items in your active configuration have changes since the last import that may be lost on the next import.');
|
||||
$this->assertSession()->pageTextContains('Warning message');
|
||||
$this->assertSession()->pageTextContains('The following items in your active configuration have changes since the last import that may be lost on the next import.');
|
||||
// Ensure the item is displayed as part of a list (to avoid false matches
|
||||
// on the rest of the page) and that the list markup is not escaped.
|
||||
$this->assertRaw('<li>system.site</li>');
|
||||
|
@ -197,7 +197,7 @@ class ConfigExportImportUITest extends BrowserTestBase {
|
|||
$this->drupalGet('admin/config/development/configuration');
|
||||
$this->assertNoText('Warning message');
|
||||
$this->assertNoText('The following items in your active configuration have changes since the last import that may be lost on the next import.');
|
||||
$this->assertText('There are no configuration changes to import.');
|
||||
$this->assertSession()->pageTextContains('There are no configuration changes to import.');
|
||||
// Write a file to sync. The warning about differences between the active
|
||||
// and snapshot should now exist.
|
||||
/** @var \Drupal\Core\Config\StorageInterface $sync */
|
||||
|
@ -207,8 +207,8 @@ class ConfigExportImportUITest extends BrowserTestBase {
|
|||
$this->copyConfig($this->container->get('config.storage'), $sync);
|
||||
$sync->write('system.site', $data);
|
||||
$this->drupalGet('admin/config/development/configuration');
|
||||
$this->assertText('Warning message');
|
||||
$this->assertText('The following items in your active configuration have changes since the last import that may be lost on the next import.');
|
||||
$this->assertSession()->pageTextContains('Warning message');
|
||||
$this->assertSession()->pageTextContains('The following items in your active configuration have changes since the last import that may be lost on the next import.');
|
||||
// Ensure the item is displayed as part of a list (to avoid false matches
|
||||
// on the rest of the page) and that the list markup is not escaped.
|
||||
$this->assertRaw('<li>system.site</li>');
|
||||
|
@ -279,23 +279,23 @@ class ConfigExportImportUITest extends BrowserTestBase {
|
|||
// Verify that there are configuration differences to import.
|
||||
$this->drupalGet('admin/config/development/configuration');
|
||||
$this->assertNoText('There are no configuration changes to import.');
|
||||
$this->assertText('collection.test1 configuration collection');
|
||||
$this->assertText('collection.test2 configuration collection');
|
||||
$this->assertText('config_test.create');
|
||||
$this->assertSession()->pageTextContains('collection.test1 configuration collection');
|
||||
$this->assertSession()->pageTextContains('collection.test2 configuration collection');
|
||||
$this->assertSession()->pageTextContains('config_test.create');
|
||||
$this->assertSession()->linkByHrefExists('admin/config/development/configuration/sync/diff_collection/collection.test1/config_test.create');
|
||||
$this->assertText('config_test.update');
|
||||
$this->assertSession()->pageTextContains('config_test.update');
|
||||
$this->assertSession()->linkByHrefExists('admin/config/development/configuration/sync/diff_collection/collection.test1/config_test.update');
|
||||
$this->assertText('config_test.delete');
|
||||
$this->assertSession()->pageTextContains('config_test.delete');
|
||||
$this->assertSession()->linkByHrefExists('admin/config/development/configuration/sync/diff_collection/collection.test1/config_test.delete');
|
||||
$this->assertText('config_test.another_create');
|
||||
$this->assertSession()->pageTextContains('config_test.another_create');
|
||||
$this->assertSession()->linkByHrefExists('admin/config/development/configuration/sync/diff_collection/collection.test2/config_test.another_create');
|
||||
$this->assertText('config_test.another_update');
|
||||
$this->assertSession()->pageTextContains('config_test.another_update');
|
||||
$this->assertSession()->linkByHrefExists('admin/config/development/configuration/sync/diff_collection/collection.test2/config_test.another_update');
|
||||
$this->assertText('config_test.another_delete');
|
||||
$this->assertSession()->pageTextContains('config_test.another_delete');
|
||||
$this->assertSession()->linkByHrefExists('admin/config/development/configuration/sync/diff_collection/collection.test2/config_test.another_delete');
|
||||
|
||||
$this->submitForm([], 'Import all');
|
||||
$this->assertText('There are no configuration changes to import.');
|
||||
$this->assertSession()->pageTextContains('There are no configuration changes to import.');
|
||||
|
||||
// Test data in collections.
|
||||
$data = $test1_storage->read('config_test.create');
|
||||
|
|
|
@ -60,8 +60,8 @@ class ConfigImportInstallProfileTest extends BrowserTestBase {
|
|||
$sync->write('core.extension', $core);
|
||||
|
||||
$this->drupalPostForm('admin/config/development/configuration', [], 'Import all');
|
||||
$this->assertText('The configuration cannot be imported because it failed validation for the following reasons:');
|
||||
$this->assertText('Unable to uninstall the Testing config import profile since it is the install profile.');
|
||||
$this->assertSession()->pageTextContains('The configuration cannot be imported because it failed validation for the following reasons:');
|
||||
$this->assertSession()->pageTextContains('Unable to uninstall the Testing config import profile since it is the install profile.');
|
||||
|
||||
// Uninstall dependencies of testing_config_import.
|
||||
$core['module']['testing_config_import'] = 0;
|
||||
|
@ -75,7 +75,7 @@ class ConfigImportInstallProfileTest extends BrowserTestBase {
|
|||
$theme['default'] = 'classy';
|
||||
$sync->write('system.theme', $theme);
|
||||
$this->drupalPostForm('admin/config/development/configuration', [], 'Import all');
|
||||
$this->assertText('The configuration was imported successfully.');
|
||||
$this->assertSession()->pageTextContains('The configuration was imported successfully.');
|
||||
$this->rebuildContainer();
|
||||
$this->assertFalse(\Drupal::moduleHandler()->moduleExists('syslog'), 'The syslog module has been uninstalled.');
|
||||
$this->assertFalse(\Drupal::service('theme_handler')->themeExists('stark'), 'The stark theme has been uninstalled.');
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
namespace Drupal\Tests\config\Functional;
|
||||
|
||||
use Drupal\Component\Utility\Html;
|
||||
use Drupal\Core\Config\InstallStorage;
|
||||
use Drupal\Tests\BrowserTestBase;
|
||||
|
||||
|
@ -56,7 +55,7 @@ class ConfigImportUITest extends BrowserTestBase {
|
|||
$sync = $this->container->get('config.storage.sync');
|
||||
|
||||
$this->drupalGet('admin/config/development/configuration');
|
||||
$this->assertText('There are no configuration changes to import.');
|
||||
$this->assertSession()->pageTextContains('There are no configuration changes to import.');
|
||||
$this->assertSession()->buttonNotExists('Import all');
|
||||
|
||||
// Create updated configuration object.
|
||||
|
@ -138,7 +137,7 @@ class ConfigImportUITest extends BrowserTestBase {
|
|||
$this->assertSession()->buttonNotExists('Import all');
|
||||
|
||||
// Verify that there are no further changes to import.
|
||||
$this->assertText('There are no configuration changes to import.');
|
||||
$this->assertSession()->pageTextContains('There are no configuration changes to import.');
|
||||
|
||||
$this->rebuildContainer();
|
||||
// Verify site name has changed.
|
||||
|
@ -245,7 +244,7 @@ class ConfigImportUITest extends BrowserTestBase {
|
|||
|
||||
// Attempt to import configuration and verify that an error message appears.
|
||||
$this->submitForm([], 'Import all');
|
||||
$this->assertText('Another request may be synchronizing configuration already.');
|
||||
$this->assertSession()->pageTextContains('Another request may be synchronizing configuration already.');
|
||||
|
||||
// Release the lock, just to keep testing sane.
|
||||
$this->container->get('lock.persistent')->release($config_importer::LOCK_NAME);
|
||||
|
@ -267,7 +266,7 @@ class ConfigImportUITest extends BrowserTestBase {
|
|||
|
||||
// Verify that there are configuration differences to import.
|
||||
$this->drupalGet('admin/config/development/configuration');
|
||||
$this->assertText('The staged configuration cannot be imported, because it originates from a different site than this site. You can only synchronize configuration between cloned instances of this site.');
|
||||
$this->assertSession()->pageTextContains('The staged configuration cannot be imported, because it originates from a different site than this site. You can only synchronize configuration between cloned instances of this site.');
|
||||
$this->assertSession()->buttonNotExists('Import all');
|
||||
}
|
||||
|
||||
|
@ -308,14 +307,14 @@ class ConfigImportUITest extends BrowserTestBase {
|
|||
// changed.
|
||||
|
||||
// Changed values are escaped.
|
||||
$this->assertText(Html::escape("foo: '<p><em>foobar</em></p>'"));
|
||||
$this->assertText(Html::escape("foo: '<p>foobar</p>'"));
|
||||
$this->assertSession()->pageTextContains("foo: '<p><em>foobar</em></p>'");
|
||||
$this->assertSession()->pageTextContains("foo: '<p>foobar</p>'");
|
||||
// The no change values are escaped.
|
||||
$this->assertText(Html::escape("baz: '<strong>no change</strong>'"));
|
||||
$this->assertSession()->pageTextContains("baz: '<strong>no change</strong>'");
|
||||
// Added value is escaped.
|
||||
$this->assertText(Html::escape("biff: '<em>bangpow</em>'"));
|
||||
$this->assertSession()->pageTextContains("biff: '<em>bangpow</em>'");
|
||||
// Deleted value is escaped.
|
||||
$this->assertText(Html::escape("404: '<em>herp</em>'"));
|
||||
$this->assertSession()->pageTextContains("404: '<em>herp</em>'");
|
||||
|
||||
// Verify diff colors are displayed.
|
||||
$result = $this->xpath('//table[contains(@class, :class)]', [':class' => 'diff']);
|
||||
|
@ -329,10 +328,10 @@ class ConfigImportUITest extends BrowserTestBase {
|
|||
// Load the diff UI and verify that the diff reflects a removed key.
|
||||
$this->drupalGet('admin/config/development/configuration/sync/diff/' . $config_name);
|
||||
// The no change values are escaped.
|
||||
$this->assertText(Html::escape("foo: '<p>foobar</p>'"));
|
||||
$this->assertText(Html::escape("baz: '<strong>no change</strong>'"));
|
||||
$this->assertSession()->pageTextContains("foo: '<p>foobar</p>'");
|
||||
$this->assertSession()->pageTextContains("baz: '<strong>no change</strong>'");
|
||||
// Removed key is escaped.
|
||||
$this->assertText(Html::escape("404: '<em>herp</em>'"));
|
||||
$this->assertSession()->pageTextContains("404: '<em>herp</em>'");
|
||||
|
||||
// Reset data back to original and add a key
|
||||
$sync_data = $original_data;
|
||||
|
@ -342,10 +341,10 @@ class ConfigImportUITest extends BrowserTestBase {
|
|||
// Load the diff UI and verify that the diff reflects an added key.
|
||||
$this->drupalGet('admin/config/development/configuration/sync/diff/' . $config_name);
|
||||
// The no change values are escaped.
|
||||
$this->assertText(Html::escape("baz: '<strong>no change</strong>'"));
|
||||
$this->assertText(Html::escape("404: '<em>herp</em>'"));
|
||||
$this->assertSession()->pageTextContains("baz: '<strong>no change</strong>'");
|
||||
$this->assertSession()->pageTextContains("404: '<em>herp</em>'");
|
||||
// Added key is escaped.
|
||||
$this->assertText(Html::escape("biff: '<em>bangpow</em>'"));
|
||||
$this->assertSession()->pageTextContains("biff: '<em>bangpow</em>'");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -365,9 +364,9 @@ class ConfigImportUITest extends BrowserTestBase {
|
|||
$this->submitForm([], 'Import all');
|
||||
|
||||
// Verify that the validation messages appear.
|
||||
$this->assertText('The configuration cannot be imported because it failed validation for the following reasons:');
|
||||
$this->assertText('Config import validate error 1.');
|
||||
$this->assertText('Config import validate error 2.');
|
||||
$this->assertSession()->pageTextContains('The configuration cannot be imported because it failed validation for the following reasons:');
|
||||
$this->assertSession()->pageTextContains('Config import validate error 1.');
|
||||
$this->assertSession()->pageTextContains('Config import validate error 2.');
|
||||
|
||||
// Verify site name has not changed.
|
||||
$this->assertNotEquals($this->config('system.site')->get('name'), $new_site_name);
|
||||
|
@ -381,11 +380,11 @@ class ConfigImportUITest extends BrowserTestBase {
|
|||
$sync->write('core.extension', $core_extension);
|
||||
|
||||
$this->drupalGet('admin/config/development/configuration');
|
||||
$this->assertText('core.extension');
|
||||
$this->assertSession()->pageTextContains('core.extension');
|
||||
|
||||
// Import and verify that both do not appear anymore.
|
||||
$this->submitForm([], 'Import all');
|
||||
$this->assertText('Can not uninstall the Configuration module as part of a configuration synchronization through the user interface.');
|
||||
$this->assertSession()->pageTextContains('Can not uninstall the Configuration module as part of a configuration synchronization through the user interface.');
|
||||
}
|
||||
|
||||
public function prepareSiteNameUpdate($new_site_name) {
|
||||
|
@ -442,10 +441,10 @@ class ConfigImportUITest extends BrowserTestBase {
|
|||
|
||||
// Attempt to import configuration and verify that an error message appears.
|
||||
$this->submitForm([], 'Import all');
|
||||
$this->assertText('Deleted and replaced configuration entity "' . $name_secondary . '"');
|
||||
$this->assertText('The configuration was imported with errors.');
|
||||
$this->assertSession()->pageTextContains('Deleted and replaced configuration entity "' . $name_secondary . '"');
|
||||
$this->assertSession()->pageTextContains('The configuration was imported with errors.');
|
||||
$this->assertNoText('The configuration was imported successfully.');
|
||||
$this->assertText('There are no configuration changes to import.');
|
||||
$this->assertSession()->pageTextContains('There are no configuration changes to import.');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -462,11 +461,11 @@ class ConfigImportUITest extends BrowserTestBase {
|
|||
$this->drupalGet('admin/config/development/configuration');
|
||||
// The node type, body field and entity displays will be scheduled for
|
||||
// removal.
|
||||
$this->assertText('node.type.' . $node_type->id());
|
||||
$this->assertText('field.field.node.' . $node_type->id() . '.body');
|
||||
$this->assertText('core.entity_view_display.node.' . $node_type->id() . '.teaser');
|
||||
$this->assertText('core.entity_view_display.node.' . $node_type->id() . '.default');
|
||||
$this->assertText('core.entity_form_display.node.' . $node_type->id() . '.default');
|
||||
$this->assertSession()->pageTextContains('node.type.' . $node_type->id());
|
||||
$this->assertSession()->pageTextContains('field.field.node.' . $node_type->id() . '.body');
|
||||
$this->assertSession()->pageTextContains('core.entity_view_display.node.' . $node_type->id() . '.teaser');
|
||||
$this->assertSession()->pageTextContains('core.entity_view_display.node.' . $node_type->id() . '.default');
|
||||
$this->assertSession()->pageTextContains('core.entity_form_display.node.' . $node_type->id() . '.default');
|
||||
|
||||
// Attempt to import configuration and verify that an error message appears
|
||||
// and the node type, body field and entity displays are still scheduled for
|
||||
|
@ -474,17 +473,17 @@ class ConfigImportUITest extends BrowserTestBase {
|
|||
$this->submitForm([], 'Import all');
|
||||
$validation_message = t('Entities exist of type %entity_type and %bundle_label %bundle. These entities need to be deleted before importing.', ['%entity_type' => $node->getEntityType()->getLabel(), '%bundle_label' => $node->getEntityType()->getBundleLabel(), '%bundle' => $node_type->label()]);
|
||||
$this->assertRaw($validation_message);
|
||||
$this->assertText('node.type.' . $node_type->id());
|
||||
$this->assertText('field.field.node.' . $node_type->id() . '.body');
|
||||
$this->assertText('core.entity_view_display.node.' . $node_type->id() . '.teaser');
|
||||
$this->assertText('core.entity_view_display.node.' . $node_type->id() . '.default');
|
||||
$this->assertText('core.entity_form_display.node.' . $node_type->id() . '.default');
|
||||
$this->assertSession()->pageTextContains('node.type.' . $node_type->id());
|
||||
$this->assertSession()->pageTextContains('field.field.node.' . $node_type->id() . '.body');
|
||||
$this->assertSession()->pageTextContains('core.entity_view_display.node.' . $node_type->id() . '.teaser');
|
||||
$this->assertSession()->pageTextContains('core.entity_view_display.node.' . $node_type->id() . '.default');
|
||||
$this->assertSession()->pageTextContains('core.entity_form_display.node.' . $node_type->id() . '.default');
|
||||
|
||||
// Delete the node and try to import again.
|
||||
$node->delete();
|
||||
$this->submitForm([], 'Import all');
|
||||
$this->assertNoRaw($validation_message);
|
||||
$this->assertText('There are no configuration changes to import.');
|
||||
$this->assertSession()->pageTextContains('There are no configuration changes to import.');
|
||||
$this->assertNoText('node.type.' . $node_type->id());
|
||||
$this->assertNoText('field.field.node.' . $node_type->id() . '.body');
|
||||
$this->assertNoText('core.entity_view_display.node.' . $node_type->id() . '.teaser');
|
||||
|
@ -520,11 +519,11 @@ class ConfigImportUITest extends BrowserTestBase {
|
|||
$sync->write('core.extension', $core);
|
||||
|
||||
$this->drupalPostForm('admin/config/development/configuration', [], 'Import all');
|
||||
$this->assertText('The configuration cannot be imported because it failed validation for the following reasons:');
|
||||
$this->assertText('Unable to uninstall the Text module since the Node module is installed.');
|
||||
$this->assertText('Unable to uninstall the Theme test base theme theme since the Theme test subtheme theme is installed.');
|
||||
$this->assertText('Unable to install the does_not_exist module since it does not exist.');
|
||||
$this->assertText('Unable to install the does_not_exist theme since it does not exist.');
|
||||
$this->assertSession()->pageTextContains('The configuration cannot be imported because it failed validation for the following reasons:');
|
||||
$this->assertSession()->pageTextContains('Unable to uninstall the Text module since the Node module is installed.');
|
||||
$this->assertSession()->pageTextContains('Unable to uninstall the Theme test base theme theme since the Theme test subtheme theme is installed.');
|
||||
$this->assertSession()->pageTextContains('Unable to install the does_not_exist module since it does not exist.');
|
||||
$this->assertSession()->pageTextContains('Unable to install the does_not_exist theme since it does not exist.');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -53,7 +53,7 @@ class ConfigImportUploadTest extends BrowserTestBase {
|
|||
$text_file = $this->getTestFiles('text')[0];
|
||||
$edit = ['files[import_tarball]' => \Drupal::service('file_system')->realpath($text_file->uri)];
|
||||
$this->drupalPostForm('admin/config/development/configuration/full/import', $edit, 'Upload');
|
||||
$this->assertText('Could not extract the contents of the tar file');
|
||||
$this->assertSession()->pageTextContains('Could not extract the contents of the tar file');
|
||||
|
||||
// Make the sync directory read-only.
|
||||
$directory = Settings::get('config_sync_directory');
|
||||
|
|
|
@ -78,7 +78,7 @@ class ConfigLanguageOverrideWebTest extends BrowserTestBase {
|
|||
// we access the XX front page.
|
||||
// @see \Drupal\Core\PathProcessor::processInbound()
|
||||
$this->drupalGet('xx');
|
||||
$this->assertText('XX site name');
|
||||
$this->assertSession()->pageTextContains('XX site name');
|
||||
|
||||
// Set the xx language to be the default language and delete the English
|
||||
// language so the site is no longer multilingual and confirm configuration
|
||||
|
@ -91,7 +91,7 @@ class ConfigLanguageOverrideWebTest extends BrowserTestBase {
|
|||
$this->assertFalse($language_manager->isMultilingual(), 'The test site is monolingual.');
|
||||
|
||||
$this->drupalGet('xx');
|
||||
$this->assertText('XX site name');
|
||||
$this->assertSession()->pageTextContains('XX site name');
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ class ConfigSingleImportExportTest extends BrowserTestBase {
|
|||
|
||||
$this->drupalPostForm('admin/config/development/configuration/single/import', $edit, 'Import');
|
||||
// Assert the static portion of the error since different parsers could give different text in their error.
|
||||
$this->assertText('The import failed with the following message: ');
|
||||
$this->assertSession()->pageTextContains('The import failed with the following message: ');
|
||||
|
||||
$import = <<<EOD
|
||||
label: First
|
||||
|
@ -68,7 +68,7 @@ EOD;
|
|||
];
|
||||
// Attempt an import with a missing ID.
|
||||
$this->drupalPostForm('admin/config/development/configuration/single/import', $edit, 'Import');
|
||||
$this->assertText('Missing ID key "id" for this Test configuration import.');
|
||||
$this->assertSession()->pageTextContains('Missing ID key "id" for this Test configuration import.');
|
||||
|
||||
// Perform an import with no specified UUID and a unique ID.
|
||||
$this->assertNull($storage->load('first'));
|
||||
|
@ -84,12 +84,12 @@ EOD;
|
|||
|
||||
// Attempt an import with an existing ID but missing UUID.
|
||||
$this->drupalPostForm('admin/config/development/configuration/single/import', $edit, 'Import');
|
||||
$this->assertText('An entity with this machine name already exists but the import did not specify a UUID.');
|
||||
$this->assertSession()->pageTextContains('An entity with this machine name already exists but the import did not specify a UUID.');
|
||||
|
||||
// Attempt an import with a mismatched UUID and existing ID.
|
||||
$edit['import'] .= "\nuuid: " . $uuid->generate();
|
||||
$this->drupalPostForm('admin/config/development/configuration/single/import', $edit, 'Import');
|
||||
$this->assertText('An entity with this machine name already exists but the UUID does not match.');
|
||||
$this->assertSession()->pageTextContains('An entity with this machine name already exists but the UUID does not match.');
|
||||
|
||||
// Attempt an import with a custom ID.
|
||||
$edit['custom_entity_id'] = 'custom_id';
|
||||
|
@ -216,7 +216,7 @@ EOD;
|
|||
$this->assertRaw(t('Are you sure you want to update the %name @type?', ['%name' => $config->getName(), '@type' => 'simple configuration']));
|
||||
$this->submitForm([], 'Confirm');
|
||||
$this->drupalGet('');
|
||||
$this->assertText('Test simple import');
|
||||
$this->assertSession()->pageTextContains('Test simple import');
|
||||
|
||||
// Ensure that ConfigImporter validation is running when importing simple
|
||||
// configuration.
|
||||
|
@ -229,12 +229,12 @@ EOD;
|
|||
'import' => Yaml::encode($config_data),
|
||||
];
|
||||
$this->drupalPostForm('admin/config/development/configuration/single/import', $edit, 'Import');
|
||||
$this->assertText('Can not uninstall the Configuration module as part of a configuration synchronization through the user interface.');
|
||||
$this->assertSession()->pageTextContains('Can not uninstall the Configuration module as part of a configuration synchronization through the user interface.');
|
||||
|
||||
// Try to import without any values.
|
||||
$this->drupalPostForm('admin/config/development/configuration/single/import', [], 'Import');
|
||||
$this->assertText('Configuration type field is required.');
|
||||
$this->assertText('Paste your configuration here field is required.');
|
||||
$this->assertSession()->pageTextContains('Configuration type field is required.');
|
||||
$this->assertSession()->pageTextContains('Paste your configuration here field is required.');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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');
|
||||
$this->assertSession()->pageTextContains('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');
|
||||
$this->assertSession()->pageTextContains('Path prefix configuration');
|
||||
|
||||
// The Spanish override should not be found.
|
||||
$this->assertSession()->fieldValueNotEquals('prefix[es]', $overridden_value_es);
|
||||
|
|
|
@ -60,7 +60,7 @@ class SchemaConfigListenerWebTest extends BrowserTestBase {
|
|||
|
||||
// Test that the config event listener is working in the child site.
|
||||
$this->drupalGet('config_test/schema_listener');
|
||||
$this->assertText('No schema for config_schema_test.schemaless');
|
||||
$this->assertSession()->pageTextContains('No schema for config_schema_test.schemaless');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
namespace Drupal\Tests\config\Functional;
|
||||
|
||||
use Drupal\Component\Utility\Html;
|
||||
use Drupal\Tests\BrowserTestBase;
|
||||
|
||||
/**
|
||||
|
@ -54,8 +53,8 @@ class TransformedConfigExportImportUITest extends BrowserTestBase {
|
|||
|
||||
// Tests changes of system.site.
|
||||
$this->drupalGet('admin/config/development/configuration/sync/diff/system.site');
|
||||
$this->assertText('name: Drupal');
|
||||
$this->assertText(Html::escape("name: 'Drupal Arrr'"));
|
||||
$this->assertSession()->pageTextContains('name: Drupal');
|
||||
$this->assertSession()->pageTextContains("name: 'Drupal Arrr'");
|
||||
|
||||
// Add a slogan.
|
||||
$originalSlogan = $this->config('system.site')->get('slogan');
|
||||
|
@ -69,8 +68,8 @@ class TransformedConfigExportImportUITest extends BrowserTestBase {
|
|||
|
||||
// Tests changes of system.site.
|
||||
$this->drupalGet('admin/config/development/configuration/sync/diff/system.site');
|
||||
$this->assertText(Html::escape("slogan: ''"));
|
||||
$this->assertText(Html::escape("slogan: $newSlogan"));
|
||||
$this->assertSession()->pageTextContains("slogan: ''");
|
||||
$this->assertSession()->pageTextContains("slogan: $newSlogan");
|
||||
|
||||
// Export the configuration.
|
||||
$this->drupalPostForm('admin/config/development/configuration/full/export', [], 'Export');
|
||||
|
@ -83,8 +82,8 @@ class TransformedConfigExportImportUITest extends BrowserTestBase {
|
|||
|
||||
// Assert the new name and slogan.
|
||||
$this->drupalGet('admin/config/development/configuration/sync/diff/system.site');
|
||||
$this->assertText(Html::escape("name: 'Drupal Arrr'"));
|
||||
$this->assertText(Html::escape("slogan: '$originalSlogan Arrr'"));
|
||||
$this->assertSession()->pageTextContains("name: 'Drupal Arrr'");
|
||||
$this->assertSession()->pageTextContains("slogan: '$originalSlogan Arrr'");
|
||||
$this->assertEquals('Drupal', $this->config('system.site')->get('name'));
|
||||
$this->assertEquals($newSlogan, $this->config('system.site')->get('slogan'));
|
||||
|
||||
|
@ -95,7 +94,7 @@ class TransformedConfigExportImportUITest extends BrowserTestBase {
|
|||
|
||||
// Assert that the event was dispatched again on the new config.
|
||||
$this->drupalGet('admin/config/development/configuration/sync/diff/system.site');
|
||||
$this->assertText(Html::escape("name: 'Drupal Arrr Arrr'"));
|
||||
$this->assertSession()->pageTextContains("name: 'Drupal Arrr Arrr'");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -147,9 +147,9 @@ class ConfigTranslationCacheTest extends BrowserTestBase {
|
|||
$this->drupalGet("/entity_test/structure/$bundle/fields/entity_test.$bundle.$field_name/translate");
|
||||
$this->clickLink('Add');
|
||||
|
||||
$this->assertText('Translatable field setting');
|
||||
$this->assertSession()->pageTextContains('Translatable field setting');
|
||||
$this->assertSession()->assertEscaped($translatable_field_setting);
|
||||
$this->assertText('Translatable storage setting');
|
||||
$this->assertSession()->pageTextContains('Translatable storage setting');
|
||||
$this->assertSession()->assertEscaped($translatable_storage_setting);
|
||||
|
||||
// Add translation for label.
|
||||
|
|
|
@ -137,17 +137,17 @@ class ConfigTranslationOverviewTest extends BrowserTestBase {
|
|||
// Hidden languages are only available to translate through the
|
||||
// configuration translation listings.
|
||||
$this->drupalGet('admin/config/regional/config-translation/configurable_language');
|
||||
$this->assertText('Not applicable');
|
||||
$this->assertSession()->pageTextContains('Not applicable');
|
||||
$this->assertSession()->linkByHrefExists('admin/config/regional/language/edit/zxx/translate');
|
||||
$this->assertText('Not specified');
|
||||
$this->assertSession()->pageTextContains('Not specified');
|
||||
$this->assertSession()->linkByHrefExists('admin/config/regional/language/edit/und/translate');
|
||||
|
||||
// Hidden date formats are only available to translate through the
|
||||
// configuration translation listings. Test a couple of them.
|
||||
$this->drupalGet('admin/config/regional/config-translation/date_format');
|
||||
$this->assertText('HTML Date');
|
||||
$this->assertSession()->pageTextContains('HTML Date');
|
||||
$this->assertSession()->linkByHrefExists('admin/config/regional/date-time/formats/manage/html_date/translate');
|
||||
$this->assertText('HTML Year');
|
||||
$this->assertSession()->pageTextContains('HTML Year');
|
||||
$this->assertSession()->linkByHrefExists('admin/config/regional/date-time/formats/manage/html_year/translate');
|
||||
}
|
||||
|
||||
|
@ -172,7 +172,7 @@ class ConfigTranslationOverviewTest extends BrowserTestBase {
|
|||
|
||||
// Test that the original label on the listing page is intact.
|
||||
$this->drupalGet('admin/config/regional/config-translation/config_test');
|
||||
$this->assertText($original_label);
|
||||
$this->assertSession()->pageTextContains($original_label);
|
||||
$this->assertNoText($overridden_label);
|
||||
}
|
||||
|
||||
|
@ -198,8 +198,8 @@ class ConfigTranslationOverviewTest extends BrowserTestBase {
|
|||
$field->save();
|
||||
|
||||
$this->drupalGet('admin/config/regional/config-translation/node_fields');
|
||||
$this->assertText('Body');
|
||||
$this->assertText('Basic');
|
||||
$this->assertSession()->pageTextContains('Body');
|
||||
$this->assertSession()->pageTextContains('Basic');
|
||||
$this->assertSession()->linkByHrefExists('admin/structure/types/manage/basic/fields/node.basic.body/translate');
|
||||
}
|
||||
|
||||
|
|
|
@ -193,8 +193,8 @@ class ConfigTranslationUiTest extends BrowserTestBase {
|
|||
|
||||
// Visit French site to ensure base language string present as source.
|
||||
$this->drupalGet("fr/$translation_base_url/fr/edit");
|
||||
$this->assertText($site_name);
|
||||
$this->assertText($site_slogan);
|
||||
$this->assertSession()->pageTextContains($site_name);
|
||||
$this->assertSession()->pageTextContains($site_slogan);
|
||||
|
||||
// Translate 'Site name' label in French.
|
||||
$search = [
|
||||
|
@ -213,18 +213,18 @@ class ConfigTranslationUiTest extends BrowserTestBase {
|
|||
|
||||
// Ensure that the label is in French (and not in English).
|
||||
$this->drupalGet("fr/$translation_base_url/fr/edit");
|
||||
$this->assertText($fr_site_name_label);
|
||||
$this->assertSession()->pageTextContains($fr_site_name_label);
|
||||
$this->assertNoText($site_name_label);
|
||||
|
||||
// Ensure that the label is also in French (and not in English)
|
||||
// when editing another language with the interface in French.
|
||||
$this->drupalGet("fr/$translation_base_url/ta/edit");
|
||||
$this->assertText($fr_site_name_label);
|
||||
$this->assertSession()->pageTextContains($fr_site_name_label);
|
||||
$this->assertNoText($site_name_label);
|
||||
|
||||
// Ensure that the label is not translated when the interface is in English.
|
||||
$this->drupalGet("$translation_base_url/fr/edit");
|
||||
$this->assertText($site_name_label);
|
||||
$this->assertSession()->pageTextContains($site_name_label);
|
||||
$this->assertNoText($fr_site_name_label);
|
||||
}
|
||||
|
||||
|
@ -335,7 +335,7 @@ class ConfigTranslationUiTest extends BrowserTestBase {
|
|||
|
||||
// Visit the form to confirm the changes.
|
||||
$this->drupalGet('contact/feedback');
|
||||
$this->assertText($label);
|
||||
$this->assertSession()->pageTextContains($label);
|
||||
|
||||
foreach ($this->langcodes as $langcode) {
|
||||
$this->drupalGet($translation_base_url);
|
||||
|
@ -347,7 +347,7 @@ class ConfigTranslationUiTest extends BrowserTestBase {
|
|||
|
||||
// Make sure original text is present on this page.
|
||||
$this->drupalGet($translation_page_url);
|
||||
$this->assertText($label);
|
||||
$this->assertSession()->pageTextContains($label);
|
||||
|
||||
// Update translatable fields.
|
||||
$edit = [
|
||||
|
@ -373,7 +373,7 @@ class ConfigTranslationUiTest extends BrowserTestBase {
|
|||
|
||||
// Visit language specific version of form to check label.
|
||||
$this->drupalGet($langcode . '/contact/feedback');
|
||||
$this->assertText('Website feedback - ' . $langcode);
|
||||
$this->assertSession()->pageTextContains('Website feedback - ' . $langcode);
|
||||
|
||||
// Submit feedback.
|
||||
$edit = [
|
||||
|
@ -391,7 +391,7 @@ class ConfigTranslationUiTest extends BrowserTestBase {
|
|||
foreach ($langcode_prefixes as $langcode_prefix) {
|
||||
$this->drupalGet(ltrim("$langcode_prefix/$translation_base_url/$langcode/edit", '/'));
|
||||
$this->assertSession()->fieldValueEquals('translation[config_names][contact.form.feedback][label]', 'Website feedback - ' . $langcode);
|
||||
$this->assertText($label);
|
||||
$this->assertSession()->pageTextContains($label);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -476,7 +476,7 @@ class ConfigTranslationUiTest extends BrowserTestBase {
|
|||
|
||||
// Make sure original text is present on this page.
|
||||
$this->drupalGet($translation_page_url);
|
||||
$this->assertText($label);
|
||||
$this->assertSession()->pageTextContains($label);
|
||||
|
||||
// Make sure that the date library is added.
|
||||
$this->assertRaw('core/modules/system/js/system.date.js');
|
||||
|
@ -538,8 +538,8 @@ class ConfigTranslationUiTest extends BrowserTestBase {
|
|||
$this->assertSession()->fieldValueEquals($key, $value);
|
||||
}
|
||||
// Check that labels for email settings appear.
|
||||
$this->assertText('Account cancellation confirmation');
|
||||
$this->assertText('Password recovery');
|
||||
$this->assertSession()->pageTextContains('Account cancellation confirmation');
|
||||
$this->assertSession()->pageTextContains('Password recovery');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -757,9 +757,9 @@ class ConfigTranslationUiTest extends BrowserTestBase {
|
|||
$this->drupalGet("/entity_test/structure/$bundle/fields/entity_test.$bundle.$field_name/translate");
|
||||
$this->clickLink('Add');
|
||||
|
||||
$this->assertText('Translatable field setting');
|
||||
$this->assertSession()->pageTextContains('Translatable field setting');
|
||||
$this->assertSession()->assertEscaped($translatable_field_setting);
|
||||
$this->assertText('Translatable storage setting');
|
||||
$this->assertSession()->pageTextContains('Translatable storage setting');
|
||||
$this->assertSession()->assertEscaped($translatable_storage_setting);
|
||||
}
|
||||
|
||||
|
@ -796,7 +796,7 @@ class ConfigTranslationUiTest extends BrowserTestBase {
|
|||
|
||||
// Checks the text of details summary element that surrounds the translation
|
||||
// options.
|
||||
$this->assertText(Html::escape(strip_tags($on_label)) . ' Boolean settings');
|
||||
$this->assertSession()->responseContains(Html::escape(strip_tags($on_label)) . ' Boolean settings');
|
||||
|
||||
// Checks that the correct on and off labels appear on the form.
|
||||
$this->assertSession()->assertEscaped($on_label);
|
||||
|
@ -890,7 +890,7 @@ class ConfigTranslationUiTest extends BrowserTestBase {
|
|||
|
||||
// Check if the translation page does not have the altered out settings.
|
||||
$this->drupalGet('admin/config/people/accounts/translate/fr/add');
|
||||
$this->assertText('Name');
|
||||
$this->assertSession()->pageTextContains('Name');
|
||||
$this->assertNoText('Account cancellation confirmation');
|
||||
$this->assertNoText('Password recovery');
|
||||
}
|
||||
|
@ -1061,7 +1061,7 @@ class ConfigTranslationUiTest extends BrowserTestBase {
|
|||
'translation[config_names][field.field.node.article.translatable_field][label]' => 'FR label',
|
||||
];
|
||||
$this->submitForm($form_values, 'Save translation');
|
||||
$this->assertText('Successfully saved French translation.');
|
||||
$this->assertSession()->pageTextContains('Successfully saved French translation.');
|
||||
|
||||
// Check that the translations are saved.
|
||||
$this->clickLink('Add');
|
||||
|
|
|
@ -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.');
|
||||
$this->assertSession()->pageTextContains('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.');
|
||||
$this->assertSession()->pageTextContains('Your message has been sent.');
|
||||
}
|
||||
|
||||
// Submit contact form one over limit.
|
||||
|
|
|
@ -108,7 +108,7 @@ class ContactSitewideTest extends BrowserTestBase {
|
|||
$edit = [];
|
||||
$edit['contact_default_status'] = TRUE;
|
||||
$this->drupalPostForm('admin/config/people/accounts', $edit, 'Save configuration');
|
||||
$this->assertText('The configuration options have been saved.');
|
||||
$this->assertSession()->pageTextContains('The configuration options have been saved.');
|
||||
|
||||
$this->drupalGet('admin/structure/contact');
|
||||
// Default form exists.
|
||||
|
@ -131,7 +131,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');
|
||||
$this->assertSession()->pageTextContains('Personal');
|
||||
$this->assertSession()->linkByHrefNotExists('admin/structure/contact/manage/feedback');
|
||||
|
||||
// Ensure that the contact form won't be shown without forms.
|
||||
|
@ -143,7 +143,7 @@ class ContactSitewideTest extends BrowserTestBase {
|
|||
$this->drupalLogin($admin_user);
|
||||
$this->drupalGet('contact');
|
||||
$this->assertSession()->statusCodeEquals(200);
|
||||
$this->assertText('The contact form has not been configured.');
|
||||
$this->assertSession()->pageTextContains('The contact form has not been configured.');
|
||||
// Test access personal form via site-wide contact page.
|
||||
$this->drupalGet('contact/personal');
|
||||
$this->assertSession()->statusCodeEquals(403);
|
||||
|
@ -158,25 +158,25 @@ class ContactSitewideTest extends BrowserTestBase {
|
|||
|
||||
// Test validation of empty form and recipients fields.
|
||||
$this->addContactForm('', '', '', '', TRUE);
|
||||
$this->assertText('Label field is required.');
|
||||
$this->assertText('Machine-readable name field is required.');
|
||||
$this->assertText('Recipients field is required.');
|
||||
$this->assertSession()->pageTextContains('Label field is required.');
|
||||
$this->assertSession()->pageTextContains('Machine-readable name field is required.');
|
||||
$this->assertSession()->pageTextContains('Recipients field is required.');
|
||||
|
||||
// Test validation of max_length machine name.
|
||||
$recipients = ['simpletest&@example.com', 'simpletest2@example.com', 'simpletest3@example.com'];
|
||||
$max_length = EntityTypeInterface::BUNDLE_MAX_LENGTH;
|
||||
$max_length_exceeded = $max_length + 1;
|
||||
$this->addContactForm($id = mb_strtolower($this->randomMachineName($max_length_exceeded)), $label = $this->randomMachineName($max_length_exceeded), implode(',', [$recipients[0]]), '', TRUE);
|
||||
$this->assertText('Machine-readable name cannot be longer than ' . $max_length . ' characters but is currently ' . $max_length_exceeded . ' characters long.');
|
||||
$this->assertSession()->pageTextContains('Machine-readable name cannot be longer than ' . $max_length . ' characters but is currently ' . $max_length_exceeded . ' characters long.');
|
||||
$this->addContactForm($id = mb_strtolower($this->randomMachineName($max_length)), $label = $this->randomMachineName($max_length), implode(',', [$recipients[0]]), '', TRUE);
|
||||
$this->assertText('Contact form ' . $label . ' has been added.');
|
||||
$this->assertSession()->pageTextContains('Contact form ' . $label . ' has been added.');
|
||||
|
||||
// Verify that the creation message contains a link to a contact form.
|
||||
$this->assertSession()->elementExists('xpath', '//div[@data-drupal-messages]//a[contains(@href, "contact/")]');
|
||||
|
||||
// Create first valid form.
|
||||
$this->addContactForm($id = mb_strtolower($this->randomMachineName(16)), $label = $this->randomMachineName(16), implode(',', [$recipients[0]]), '', TRUE);
|
||||
$this->assertText('Contact form ' . $label . ' has been added.');
|
||||
$this->assertSession()->pageTextContains('Contact form ' . $label . ' has been added.');
|
||||
|
||||
// Verify that the creation message contains a link to a contact form.
|
||||
$this->assertSession()->elementExists('xpath', '//div[@data-drupal-messages]//a[contains(@href, "contact/")]');
|
||||
|
@ -200,10 +200,10 @@ class ContactSitewideTest extends BrowserTestBase {
|
|||
$this->assertEquals([$recipients[0], $recipients[1]], $config['recipients']);
|
||||
$this->assertEquals($reply, $config['reply']);
|
||||
$this->assertNotEquals($this->config('contact.settings')->get('default_form'), $id);
|
||||
$this->assertText('Contact form ' . $label . ' has been updated.');
|
||||
$this->assertSession()->pageTextContains('Contact form ' . $label . ' has been updated.');
|
||||
// Ensure the label is displayed on the contact page for this form.
|
||||
$this->drupalGet('contact/' . $id);
|
||||
$this->assertText($label);
|
||||
$this->assertSession()->pageTextContains($label);
|
||||
|
||||
// Reset the form back to be the default form.
|
||||
$this->config('contact.settings')->set('default_form', $id)->save();
|
||||
|
@ -212,16 +212,16 @@ class ContactSitewideTest extends BrowserTestBase {
|
|||
user_role_grant_permissions(RoleInterface::ANONYMOUS_ID, ['access site-wide contact form']);
|
||||
$this->drupalLogout();
|
||||
$this->drupalGet('contact');
|
||||
$this->assertText('Your email address');
|
||||
$this->assertSession()->pageTextContains('Your email address');
|
||||
$this->assertNoText('Form');
|
||||
$this->drupalLogin($admin_user);
|
||||
|
||||
// Add more forms.
|
||||
$this->addContactForm(mb_strtolower($this->randomMachineName(16)), $label = $this->randomMachineName(16), implode(',', [$recipients[0], $recipients[1]]), '', FALSE);
|
||||
$this->assertText('Contact form ' . $label . ' has been added.');
|
||||
$this->assertSession()->pageTextContains('Contact form ' . $label . ' has been added.');
|
||||
|
||||
$this->addContactForm($name = mb_strtolower($this->randomMachineName(16)), $label = $this->randomMachineName(16), implode(',', [$recipients[0], $recipients[1], $recipients[2]]), '', FALSE);
|
||||
$this->assertText('Contact form ' . $label . ' has been added.');
|
||||
$this->assertSession()->pageTextContains('Contact form ' . $label . ' has been added.');
|
||||
|
||||
// Try adding a form that already exists.
|
||||
$this->addContactForm($name, $label, '', '', FALSE);
|
||||
|
@ -242,19 +242,19 @@ class ContactSitewideTest extends BrowserTestBase {
|
|||
|
||||
// Submit contact form with invalid values.
|
||||
$this->submitContact('', $recipients[0], $this->randomMachineName(16), $id, $this->randomMachineName(64));
|
||||
$this->assertText('Your name field is required.');
|
||||
$this->assertSession()->pageTextContains('Your name field is required.');
|
||||
|
||||
$this->submitContact($this->randomMachineName(16), '', $this->randomMachineName(16), $id, $this->randomMachineName(64));
|
||||
$this->assertText('Your email address field is required.');
|
||||
$this->assertSession()->pageTextContains('Your email address field is required.');
|
||||
|
||||
$this->submitContact($this->randomMachineName(16), $invalid_recipients[0], $this->randomMachineName(16), $id, $this->randomMachineName(64));
|
||||
$this->assertRaw(t('The email address %mail is not valid.', ['%mail' => 'invalid']));
|
||||
|
||||
$this->submitContact($this->randomMachineName(16), $recipients[0], '', $id, $this->randomMachineName(64));
|
||||
$this->assertText('Subject field is required.');
|
||||
$this->assertSession()->pageTextContains('Subject field is required.');
|
||||
|
||||
$this->submitContact($this->randomMachineName(16), $recipients[0], $this->randomMachineName(16), $id, '');
|
||||
$this->assertText('Message field is required.');
|
||||
$this->assertSession()->pageTextContains('Message field is required.');
|
||||
|
||||
// Test contact form with no default form selected.
|
||||
$this->config('contact.settings')
|
||||
|
@ -272,7 +272,7 @@ class ContactSitewideTest extends BrowserTestBase {
|
|||
// Submit contact form with correct values and check flood interval.
|
||||
for ($i = 0; $i < $flood_limit; $i++) {
|
||||
$this->submitContact($this->randomMachineName(16), $recipients[0], $this->randomMachineName(16), $id, $this->randomMachineName(64));
|
||||
$this->assertText('Your message has been sent.');
|
||||
$this->assertSession()->pageTextContains('Your message has been sent.');
|
||||
}
|
||||
// Submit contact form one over limit.
|
||||
$this->submitContact($this->randomMachineName(16), $recipients[0], $this->randomMachineName(16), $id, $this->randomMachineName(64));
|
||||
|
@ -325,11 +325,11 @@ class ContactSitewideTest extends BrowserTestBase {
|
|||
|
||||
// Check preview field can be ordered.
|
||||
$this->drupalGet('admin/structure/contact/manage/' . $contact_form . '/form-display');
|
||||
$this->assertText('Preview');
|
||||
$this->assertSession()->pageTextContains('Preview');
|
||||
|
||||
// Check that the field is displayed.
|
||||
$this->drupalGet('contact/' . $contact_form);
|
||||
$this->assertText($field_label);
|
||||
$this->assertSession()->pageTextContains($field_label);
|
||||
|
||||
// Submit the contact form and verify the content.
|
||||
$edit = [
|
||||
|
@ -360,7 +360,7 @@ class ContactSitewideTest extends BrowserTestBase {
|
|||
$field_name . '[0][value]' => $this->randomMachineName(),
|
||||
];
|
||||
$this->submitForm($edit, 'Send message');
|
||||
$this->assertText('Thanks for your submission.');
|
||||
$this->assertSession()->pageTextContains('Thanks for your submission.');
|
||||
$this->assertSession()->addressEquals('user/' . $admin_user->id());
|
||||
|
||||
// Test Empty message.
|
||||
|
|
|
@ -54,16 +54,16 @@ class ContactStorageTest extends ContactSitewideTest {
|
|||
$this->addContactForm($id = mb_strtolower($this->randomMachineName(16)), $label = $this->randomMachineName(16), implode(',', [$mail]), '', TRUE, 'Your message has been sent.', [
|
||||
'send_a_pony' => 1,
|
||||
]);
|
||||
$this->assertText('Contact form ' . $label . ' has been added.');
|
||||
$this->assertSession()->pageTextContains('Contact form ' . $label . ' has been added.');
|
||||
|
||||
// Ensure that anonymous can submit site-wide contact form.
|
||||
user_role_grant_permissions(RoleInterface::ANONYMOUS_ID, ['access site-wide contact form']);
|
||||
$this->drupalLogout();
|
||||
$this->drupalGet('contact');
|
||||
$this->assertText('Your email address');
|
||||
$this->assertSession()->pageTextContains('Your email address');
|
||||
$this->assertNoText('Form');
|
||||
$this->submitContact($name = $this->randomMachineName(16), $mail, $subject = $this->randomMachineName(16), $id, $message = $this->randomMachineName(64));
|
||||
$this->assertText('Your message has been sent.');
|
||||
$this->assertSession()->pageTextContains('Your message has been sent.');
|
||||
|
||||
$messages = Message::loadMultiple();
|
||||
/** @var \Drupal\contact\Entity\Message $message */
|
||||
|
|
|
@ -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');
|
||||
$this->assertSession()->pageTextContains('Draft');
|
||||
|
||||
// Submit the moderation form to change status to published.
|
||||
$this->drupalPostForm($latest_version_path, [
|
||||
|
@ -229,8 +229,8 @@ class ModerationFormTest extends ModerationStateTestBase {
|
|||
// status, because the pending revision is in "Draft".
|
||||
$this->drupalGet('entity_test_mulrevpub/manage/1/latest');
|
||||
$this->assertSession()->statusCodeEquals(200);
|
||||
$this->assertText('Moderation state');
|
||||
$this->assertText('Draft');
|
||||
$this->assertSession()->pageTextContains('Moderation state');
|
||||
$this->assertSession()->pageTextContains('Draft');
|
||||
|
||||
// Submit the moderation form to change status to published.
|
||||
$this->drupalPostForm('entity_test_mulrevpub/manage/1/latest', [
|
||||
|
@ -263,7 +263,7 @@ class ModerationFormTest extends ModerationStateTestBase {
|
|||
], 'Apply');
|
||||
|
||||
$this->drupalGet(sprintf('node/%d/revisions', $node->id()));
|
||||
$this->assertText('by ' . $another_user->getAccountName());
|
||||
$this->assertSession()->pageTextContains('by ' . $another_user->getAccountName());
|
||||
|
||||
// Verify the revision creation time has been updated.
|
||||
$node = $node->load($node->id());
|
||||
|
|
|
@ -72,7 +72,7 @@ class ModerationLocaleTest extends ModerationStateTestBase {
|
|||
'moderation_state[0][state]' => 'published',
|
||||
];
|
||||
$this->drupalPostForm('node/add/article', $edit, 'Save');
|
||||
$this->assertText('Article Published English node has been created.');
|
||||
$this->assertSession()->pageTextContains('Article Published English node has been created.');
|
||||
$english_node = $this->drupalGetNodeByTitle('Published English node');
|
||||
|
||||
// Add a French translation.
|
||||
|
@ -86,7 +86,7 @@ class ModerationLocaleTest extends ModerationStateTestBase {
|
|||
// Here the error has occurred "The website encountered an unexpected error.
|
||||
// Please try again later."
|
||||
// If the translation has got lost.
|
||||
$this->assertText('Article French node Draft has been updated.');
|
||||
$this->assertSession()->pageTextContains('Article French node Draft has been updated.');
|
||||
|
||||
// Create an article in English.
|
||||
$edit = [
|
||||
|
@ -95,7 +95,7 @@ class ModerationLocaleTest extends ModerationStateTestBase {
|
|||
'moderation_state[0][state]' => 'draft',
|
||||
];
|
||||
$this->drupalPostForm('node/add/article', $edit, 'Save');
|
||||
$this->assertText('Article English node has been created.');
|
||||
$this->assertSession()->pageTextContains('Article English node has been created.');
|
||||
$english_node = $this->drupalGetNodeByTitle('English node');
|
||||
|
||||
// Add a French translation.
|
||||
|
@ -106,7 +106,7 @@ class ModerationLocaleTest extends ModerationStateTestBase {
|
|||
'moderation_state[0][state]' => 'draft',
|
||||
];
|
||||
$this->submitForm($edit, 'Save (this translation)');
|
||||
$this->assertText('Article French node has been updated.');
|
||||
$this->assertSession()->pageTextContains('Article French node has been updated.');
|
||||
$english_node = $this->drupalGetNodeByTitle('English node', TRUE);
|
||||
|
||||
// Publish the English article and check that the translation stays
|
||||
|
@ -114,7 +114,7 @@ class ModerationLocaleTest extends ModerationStateTestBase {
|
|||
$this->drupalPostForm('node/' . $english_node->id() . '/edit', [
|
||||
'moderation_state[0][state]' => 'published',
|
||||
], 'Save (this translation)');
|
||||
$this->assertText('Article English node has been updated.');
|
||||
$this->assertSession()->pageTextContains('Article English node has been updated.');
|
||||
$english_node = $this->drupalGetNodeByTitle('English node', TRUE);
|
||||
$french_node = $english_node->getTranslation('fr');
|
||||
$this->assertEquals('French node', $french_node->label());
|
||||
|
@ -131,7 +131,7 @@ class ModerationLocaleTest extends ModerationStateTestBase {
|
|||
'moderation_state[0][state]' => 'draft',
|
||||
];
|
||||
$this->drupalPostForm('node/add/article', $edit, 'Save');
|
||||
$this->assertText('Article Another node has been created.');
|
||||
$this->assertSession()->pageTextContains('Article Another node has been created.');
|
||||
$english_node = $this->drupalGetNodeByTitle('Another node');
|
||||
|
||||
// Add a French translation.
|
||||
|
@ -142,7 +142,7 @@ class ModerationLocaleTest extends ModerationStateTestBase {
|
|||
'moderation_state[0][state]' => 'draft',
|
||||
];
|
||||
$this->submitForm($edit, 'Save (this translation)');
|
||||
$this->assertText('Article Translated node has been updated.');
|
||||
$this->assertSession()->pageTextContains('Article Translated node has been updated.');
|
||||
$english_node = $this->drupalGetNodeByTitle('Another node', TRUE);
|
||||
|
||||
// Publish the translation and check that the source language version stays
|
||||
|
@ -150,7 +150,7 @@ class ModerationLocaleTest extends ModerationStateTestBase {
|
|||
$this->drupalPostForm('fr/node/' . $english_node->id() . '/edit', [
|
||||
'moderation_state[0][state]' => 'published',
|
||||
], 'Save (this translation)');
|
||||
$this->assertText('Article Translated node has been updated.');
|
||||
$this->assertSession()->pageTextContains('Article Translated node has been updated.');
|
||||
$english_node = $this->drupalGetNodeByTitle('Another node', TRUE);
|
||||
$french_node = $english_node->getTranslation('fr');
|
||||
$this->assertEquals('published', $french_node->moderation_state->value);
|
||||
|
@ -164,7 +164,7 @@ class ModerationLocaleTest extends ModerationStateTestBase {
|
|||
'moderation_state[0][state]' => 'draft',
|
||||
];
|
||||
$this->drupalPostForm('fr/node/' . $english_node->id() . '/edit', $edit, 'Save (this translation)');
|
||||
$this->assertText('Article New draft of translated node has been updated.');
|
||||
$this->assertSession()->pageTextContains('Article New draft of translated node has been updated.');
|
||||
$english_node = $this->drupalGetNodeByTitle('Another node', TRUE);
|
||||
$french_node = $english_node->getTranslation('fr');
|
||||
$this->assertEquals('published', $french_node->moderation_state->value);
|
||||
|
@ -175,7 +175,7 @@ class ModerationLocaleTest extends ModerationStateTestBase {
|
|||
$this->drupalPostForm('fr/node/' . $english_node->id() . '/edit', [
|
||||
'moderation_state[0][state]' => 'published',
|
||||
], 'Save (this translation)');
|
||||
$this->assertText('Article New draft of translated node has been updated.');
|
||||
$this->assertSession()->pageTextContains('Article New draft of translated node has been updated.');
|
||||
$english_node = $this->drupalGetNodeByTitle('Another node', TRUE);
|
||||
$french_node = $english_node->getTranslation('fr');
|
||||
$this->assertEquals('published', $french_node->moderation_state->value);
|
||||
|
@ -186,7 +186,7 @@ class ModerationLocaleTest extends ModerationStateTestBase {
|
|||
$this->drupalPostForm('node/' . $english_node->id() . '/edit', [
|
||||
'moderation_state[0][state]' => 'published',
|
||||
], 'Save (this translation)');
|
||||
$this->assertText('Article Another node has been updated.');
|
||||
$this->assertSession()->pageTextContains('Article Another node has been updated.');
|
||||
$english_node = $this->drupalGetNodeByTitle('Another node', TRUE);
|
||||
$this->assertEquals('published', $english_node->moderation_state->value);
|
||||
|
||||
|
@ -194,11 +194,11 @@ class ModerationLocaleTest extends ModerationStateTestBase {
|
|||
$this->drupalPostForm('node/' . $english_node->id() . '/edit', [
|
||||
'moderation_state[0][state]' => 'archived',
|
||||
], 'Save (this translation)');
|
||||
$this->assertText('Article Another node has been updated.');
|
||||
$this->assertSession()->pageTextContains('Article Another node has been updated.');
|
||||
$this->drupalPostForm('fr/node/' . $english_node->id() . '/edit', [
|
||||
'moderation_state[0][state]' => 'archived',
|
||||
], 'Save (this translation)');
|
||||
$this->assertText('Article New draft of translated node has been updated.');
|
||||
$this->assertSession()->pageTextContains('Article New draft of translated node has been updated.');
|
||||
$english_node = $this->drupalGetNodeByTitle('Another node', TRUE);
|
||||
$french_node = $english_node->getTranslation('fr');
|
||||
$this->assertEquals('archived', $english_node->moderation_state->value);
|
||||
|
|
|
@ -68,7 +68,7 @@ class ModerationStateBlockTest extends ModerationStateTestBase {
|
|||
'body[0][value]' => $body,
|
||||
];
|
||||
$this->drupalPostForm('block/add', $edit, 'Save');
|
||||
$this->assertText('basic Moderated block has been created.');
|
||||
$this->assertSession()->pageTextContains('basic Moderated block has been created.');
|
||||
|
||||
// Place the block in the Sidebar First region.
|
||||
$instance = [
|
||||
|
@ -83,7 +83,7 @@ class ModerationStateBlockTest extends ModerationStateTestBase {
|
|||
// Navigate to home page and check that the block is visible. It should be
|
||||
// visible because it is the default revision.
|
||||
$this->drupalGet('');
|
||||
$this->assertText($body);
|
||||
$this->assertSession()->pageTextContains($body);
|
||||
|
||||
// Update the block.
|
||||
$updated_body = 'This is the new body value';
|
||||
|
@ -92,13 +92,13 @@ class ModerationStateBlockTest extends ModerationStateTestBase {
|
|||
'moderation_state[0][state]' => 'draft',
|
||||
];
|
||||
$this->drupalPostForm('block/' . $block->id(), $edit, 'Save');
|
||||
$this->assertText('basic Moderated block has been updated.');
|
||||
$this->assertSession()->pageTextContains('basic Moderated block has been updated.');
|
||||
|
||||
// Navigate to the home page and check that the block shows the updated
|
||||
// content. It should show the updated content because the block's default
|
||||
// revision is not a published moderation state.
|
||||
$this->drupalGet('');
|
||||
$this->assertText($updated_body);
|
||||
$this->assertSession()->pageTextContains($updated_body);
|
||||
|
||||
// Publish the block so we can create a pending revision.
|
||||
$this->drupalPostForm('block/' . $block->id(), [
|
||||
|
@ -112,30 +112,30 @@ class ModerationStateBlockTest extends ModerationStateTestBase {
|
|||
'moderation_state[0][state]' => 'draft',
|
||||
];
|
||||
$this->drupalPostForm('block/' . $block->id(), $edit, 'Save');
|
||||
$this->assertText('basic Moderated block has been updated.');
|
||||
$this->assertSession()->pageTextContains('basic Moderated block has been updated.');
|
||||
|
||||
// Navigate to home page and check that the pending revision doesn't show,
|
||||
// since it should not be set as the default revision.
|
||||
$this->drupalGet('');
|
||||
$this->assertText($updated_body);
|
||||
$this->assertSession()->pageTextContains($updated_body);
|
||||
|
||||
// Open the latest tab and publish the new draft.
|
||||
$edit = [
|
||||
'new_state' => 'published',
|
||||
];
|
||||
$this->drupalPostForm('block/' . $block->id() . '/latest', $edit, 'Apply');
|
||||
$this->assertText('The moderation state has been updated.');
|
||||
$this->assertSession()->pageTextContains('The moderation state has been updated.');
|
||||
|
||||
// Navigate to home page and check that the pending revision is now the
|
||||
// default revision and therefore visible.
|
||||
$this->drupalGet('');
|
||||
$this->assertText($pending_revision_body);
|
||||
$this->assertSession()->pageTextContains($pending_revision_body);
|
||||
|
||||
// Check that revision is checked by default when content moderation is
|
||||
// enabled.
|
||||
$this->drupalGet('/block/' . $block->id());
|
||||
$this->assertSession()->checkboxChecked('revision');
|
||||
$this->assertText('Revisions must be required when moderation is enabled.');
|
||||
$this->assertSession()->pageTextContains('Revisions must be required when moderation is enabled.');
|
||||
$this->assertSession()->fieldDisabled('revision');
|
||||
}
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ class ModerationStateNodeTest extends ModerationStateTestBase {
|
|||
|
||||
// Delete the node.
|
||||
$this->drupalPostForm('node/' . $node->id() . '/delete', [], 'Delete');
|
||||
$this->assertText('The Moderated content moderated content has been deleted.');
|
||||
$this->assertSession()->pageTextContains('The Moderated content moderated content has been deleted.');
|
||||
|
||||
// Disable content moderation.
|
||||
$edit['bundles[moderated_content]'] = FALSE;
|
||||
|
@ -96,7 +96,7 @@ class ModerationStateNodeTest extends ModerationStateTestBase {
|
|||
// After saving, we should be at the canonical URL and viewing the first
|
||||
// revision.
|
||||
$this->assertSession()->addressEquals(Url::fromRoute('entity.node.canonical', ['node' => $node->id()]));
|
||||
$this->assertText('First version of the content.');
|
||||
$this->assertSession()->pageTextContains('First version of the content.');
|
||||
|
||||
// Create a new draft; after saving, we should still be on the canonical
|
||||
// URL, but viewing the second revision.
|
||||
|
@ -105,7 +105,7 @@ class ModerationStateNodeTest extends ModerationStateTestBase {
|
|||
'moderation_state[0][state]' => 'draft',
|
||||
], 'Save');
|
||||
$this->assertSession()->addressEquals(Url::fromRoute('entity.node.canonical', ['node' => $node->id()]));
|
||||
$this->assertText('Second version of the content.');
|
||||
$this->assertSession()->pageTextContains('Second version of the content.');
|
||||
|
||||
// Make a new published revision; after saving, we should be at the
|
||||
// canonical URL.
|
||||
|
@ -114,7 +114,7 @@ class ModerationStateNodeTest extends ModerationStateTestBase {
|
|||
'moderation_state[0][state]' => 'published',
|
||||
], 'Save');
|
||||
$this->assertSession()->addressEquals(Url::fromRoute('entity.node.canonical', ['node' => $node->id()]));
|
||||
$this->assertText('Third version of the content.');
|
||||
$this->assertSession()->pageTextContains('Third version of the content.');
|
||||
|
||||
// Make a new pending revision; after saving, we should be on the "Latest
|
||||
// version" tab.
|
||||
|
@ -123,7 +123,7 @@ class ModerationStateNodeTest extends ModerationStateTestBase {
|
|||
'moderation_state[0][state]' => 'draft',
|
||||
], 'Save');
|
||||
$this->assertSession()->addressEquals(Url::fromRoute('entity.node.latest_version', ['node' => $node->id()]));
|
||||
$this->assertText('Fourth version of the content.');
|
||||
$this->assertSession()->pageTextContains('Fourth version of the content.');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -23,14 +23,14 @@ class ModerationStateNodeTypeTest extends ModerationStateTestBase {
|
|||
public function testNotModerated() {
|
||||
$this->drupalLogin($this->adminUser);
|
||||
$this->createContentTypeFromUi('Not moderated', 'not_moderated');
|
||||
$this->assertText('The content type Not moderated has been added.');
|
||||
$this->assertSession()->pageTextContains('The content type Not moderated has been added.');
|
||||
$this->grantUserPermissionToCreateContentOfType($this->adminUser, 'not_moderated');
|
||||
$this->drupalGet('node/add/not_moderated');
|
||||
$this->assertRaw('Save');
|
||||
$this->submitForm([
|
||||
'title[0][value]' => 'Test',
|
||||
], 'Save');
|
||||
$this->assertText('Not moderated Test has been created.');
|
||||
$this->assertSession()->pageTextContains('Not moderated Test has been created.');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -65,7 +65,7 @@ class ModerationStateNodeTypeTest extends ModerationStateTestBase {
|
|||
$this->submitForm([
|
||||
'title[0][value]' => 'Test',
|
||||
], 'Save');
|
||||
$this->assertText('Not moderated Test has been created.');
|
||||
$this->assertSession()->pageTextContains('Not moderated Test has been created.');
|
||||
|
||||
// Check that the 'Create new revision' is not disabled.
|
||||
$this->drupalGet('/admin/structure/types/manage/not_moderated');
|
||||
|
|
|
@ -81,7 +81,7 @@ class WorkspaceContentModerationIntegrationTest extends ModerationStateTestBase
|
|||
], 'Save');
|
||||
|
||||
$this->drupalGet('/node/1');
|
||||
$this->assertText('First article - draft');
|
||||
$this->assertSession()->pageTextContains('First article - draft');
|
||||
|
||||
$this->drupalGet('/node/1/edit');
|
||||
$this->assertEquals('Current state Draft', $this->cssSelect('#edit-moderation-state-0-current')[0]->getText());
|
||||
|
@ -97,7 +97,7 @@ class WorkspaceContentModerationIntegrationTest extends ModerationStateTestBase
|
|||
], 'Save');
|
||||
|
||||
$this->drupalGet('/node/1');
|
||||
$this->assertText('First article - archived');
|
||||
$this->assertSession()->pageTextContains('First article - archived');
|
||||
|
||||
// Get the second node to a default revision state and publish the
|
||||
// workspace.
|
||||
|
@ -110,10 +110,10 @@ class WorkspaceContentModerationIntegrationTest extends ModerationStateTestBase
|
|||
|
||||
// The admin user can see unpublished nodes.
|
||||
$this->drupalGet('/node/1');
|
||||
$this->assertText('First article - archived');
|
||||
$this->assertSession()->pageTextContains('First article - archived');
|
||||
|
||||
$this->drupalGet('/node/2');
|
||||
$this->assertText('Second article - published');
|
||||
$this->assertSession()->pageTextContains('Second article - published');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -35,8 +35,8 @@ class ContentTranslationEnableTest extends BrowserTestBase {
|
|||
$this->drupalPostForm('admin/modules', $edit, 'Install');
|
||||
|
||||
// Status messages are shown.
|
||||
$this->assertText('This site has only a single language enabled. Add at least one more language in order to translate content.');
|
||||
$this->assertText('Enable translation for content types, taxonomy vocabularies, accounts, or any other element you wish to translate.');
|
||||
$this->assertSession()->pageTextContains('This site has only a single language enabled. Add at least one more language in order to translate content.');
|
||||
$this->assertSession()->pageTextContains('Enable translation for content types, taxonomy vocabularies, accounts, or any other element you wish to translate.');
|
||||
|
||||
// No pending updates should be available.
|
||||
$this->drupalGet('admin/reports/status');
|
||||
|
|
|
@ -70,7 +70,7 @@ class ContentTranslationSettingsTest extends BrowserTestBase {
|
|||
// Check for the content_translation_menu_links_discovered_alter() changes.
|
||||
$this->drupalGet('admin/config');
|
||||
$this->assertSession()->linkExists('Content language and translation');
|
||||
$this->assertText('Configure language and translation support for content.');
|
||||
$this->assertSession()->pageTextContains('Configure language and translation support for content.');
|
||||
// Test that the translation settings are ignored if the bundle is marked
|
||||
// translatable but the entity type is not.
|
||||
$edit = ['settings[comment][comment_article][translatable]' => TRUE];
|
||||
|
@ -241,7 +241,7 @@ class ContentTranslationSettingsTest extends BrowserTestBase {
|
|||
// Make sure account settings can be saved.
|
||||
$this->drupalPostForm('admin/config/people/accounts', ['anonymous' => 'Save me please!'], 'Save configuration');
|
||||
$this->assertSession()->fieldValueEquals('anonymous', 'Save me please!');
|
||||
$this->assertText('The configuration options have been saved.');
|
||||
$this->assertSession()->pageTextContains('The configuration options have been saved.');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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.');
|
||||
$this->assertSession()->pageTextContains('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.
|
||||
|
|
|
@ -37,8 +37,8 @@ class ContentTranslationUISkipTest extends BrowserTestBase {
|
|||
$this->drupalGet('admin/config/regional/content-language');
|
||||
|
||||
// Check the message regarding UI integration.
|
||||
$this->assertText('Test entity - Translatable skip UI check');
|
||||
$this->assertText('Test entity - Translatable check UI (Translation is not supported)');
|
||||
$this->assertSession()->pageTextContains('Test entity - Translatable skip UI check');
|
||||
$this->assertSession()->pageTextContains('Test entity - Translatable check UI (Translation is not supported)');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -194,7 +194,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');
|
||||
$this->assertSession()->pageTextContains('Source language');
|
||||
|
||||
// Check that the entered values have been correctly stored.
|
||||
foreach ($values as $langcode => $property_values) {
|
||||
|
|
|
@ -119,7 +119,7 @@ class DateFilterTest extends ViewTestBase {
|
|||
$edit['options[operator]'] = '=';
|
||||
$edit['options[expose][operator_list][]'] = ['<', '>'];
|
||||
$this->drupalPostForm('admin/structure/views/nojs/handler/test_exposed_filter_datetime/default/filter/field_date_value', $edit, 'Apply');
|
||||
$this->assertText('You selected the "Is equal to" operator as the default value but is not included in the list of limited operators.');
|
||||
$this->assertSession()->pageTextContains('You selected the "Is equal to" operator as the default value but is not included in the list of limited operators.');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -77,7 +77,7 @@ class DateTimeFieldTest extends DateTestBase {
|
|||
$this->submitForm($edit, 'Save');
|
||||
preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match);
|
||||
$id = $match[1];
|
||||
$this->assertText('entity_test ' . $id . ' has been created.');
|
||||
$this->assertSession()->pageTextContains('entity_test ' . $id . ' has been created.');
|
||||
$this->assertRaw($date->format($date_format));
|
||||
$this->assertNoRaw($date->format($time_format));
|
||||
|
||||
|
@ -272,7 +272,7 @@ class DateTimeFieldTest extends DateTestBase {
|
|||
$this->submitForm($edit, 'Save');
|
||||
preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match);
|
||||
$id = $match[1];
|
||||
$this->assertText('entity_test ' . $id . ' has been created.');
|
||||
$this->assertSession()->pageTextContains('entity_test ' . $id . ' has been created.');
|
||||
$this->assertRaw($date->format($date_format));
|
||||
$this->assertRaw($date->format($time_format));
|
||||
|
||||
|
@ -499,7 +499,7 @@ class DateTimeFieldTest extends DateTestBase {
|
|||
$this->submitForm($edit, 'Save');
|
||||
preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match);
|
||||
$id = $match[1];
|
||||
$this->assertText('entity_test ' . $id . ' has been created.');
|
||||
$this->assertSession()->pageTextContains('entity_test ' . $id . ' has been created.');
|
||||
|
||||
$this->assertTrue($this->assertSession()->optionExists("edit-$field_name-0-value-year", '2012')->isSelected());
|
||||
$this->assertTrue($this->assertSession()->optionExists("edit-$field_name-0-value-month", '12')->isSelected());
|
||||
|
@ -539,7 +539,7 @@ class DateTimeFieldTest extends DateTestBase {
|
|||
$this->submitForm($edit, 'Save');
|
||||
preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match);
|
||||
$id = $match[1];
|
||||
$this->assertText('entity_test ' . $id . ' has been created.');
|
||||
$this->assertSession()->pageTextContains('entity_test ' . $id . ' has been created.');
|
||||
|
||||
$this->assertTrue($this->assertSession()->optionExists("edit-$field_name-0-value-year", '2012')->isSelected());
|
||||
$this->assertTrue($this->assertSession()->optionExists("edit-$field_name-0-value-month", '12')->isSelected());
|
||||
|
@ -576,7 +576,7 @@ class DateTimeFieldTest extends DateTestBase {
|
|||
$this->submitForm($edit, 'Save');
|
||||
$this->assertSession()->statusCodeEquals(200);
|
||||
foreach ($expected as $expected_text) {
|
||||
$this->assertText($expected_text);
|
||||
$this->assertSession()->pageTextContains($expected_text);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -593,7 +593,7 @@ class DateTimeFieldTest extends DateTestBase {
|
|||
$this->assertSession()->statusCodeEquals(200);
|
||||
preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match);
|
||||
$id = $match[1];
|
||||
$this->assertText('entity_test ' . $id . ' has been created.');
|
||||
$this->assertSession()->pageTextContains('entity_test ' . $id . ' has been created.');
|
||||
|
||||
// Test the widget to ensure zeros are not deselected on validation.
|
||||
$this->drupalGet('entity_test/add');
|
||||
|
@ -728,7 +728,7 @@ class DateTimeFieldTest extends DateTestBase {
|
|||
];
|
||||
$this->drupalPostForm('admin/structure/types/manage/date_content/fields/node.date_content.' . $field_name, $field_edit, 'Save settings');
|
||||
|
||||
$this->assertText('The relative date value entered is invalid.');
|
||||
$this->assertSession()->pageTextContains('The relative date value entered is invalid.');
|
||||
|
||||
// Set a relative default_value.
|
||||
$field_edit = [
|
||||
|
@ -805,7 +805,7 @@ class DateTimeFieldTest extends DateTestBase {
|
|||
"{$field_name}[0][value][time]" => '12:00:00',
|
||||
];
|
||||
$this->submitForm($edit, 'Save');
|
||||
$this->assertText('date is invalid');
|
||||
$this->assertSession()->pageTextContains('date is invalid');
|
||||
|
||||
// Invalid year value.
|
||||
$date_value = 'aaaa-12-01';
|
||||
|
@ -814,7 +814,7 @@ class DateTimeFieldTest extends DateTestBase {
|
|||
"{$field_name}[0][value][time]" => '00:00:00',
|
||||
];
|
||||
$this->submitForm($edit, 'Save');
|
||||
$this->assertText('date is invalid');
|
||||
$this->assertSession()->pageTextContains('date is invalid');
|
||||
|
||||
// Invalid month value.
|
||||
$date_value = '2012-75-01';
|
||||
|
@ -823,7 +823,7 @@ class DateTimeFieldTest extends DateTestBase {
|
|||
"{$field_name}[0][value][time]" => '00:00:00',
|
||||
];
|
||||
$this->submitForm($edit, 'Save');
|
||||
$this->assertText('date is invalid');
|
||||
$this->assertSession()->pageTextContains('date is invalid');
|
||||
|
||||
// Invalid day value.
|
||||
$date_value = '2012-12-99';
|
||||
|
@ -832,7 +832,7 @@ class DateTimeFieldTest extends DateTestBase {
|
|||
"{$field_name}[0][value][time]" => '00:00:00',
|
||||
];
|
||||
$this->submitForm($edit, 'Save');
|
||||
$this->assertText('date is invalid');
|
||||
$this->assertSession()->pageTextContains('date is invalid');
|
||||
|
||||
// Invalid time value.
|
||||
$date_value = '2012-12-01';
|
||||
|
@ -842,7 +842,7 @@ class DateTimeFieldTest extends DateTestBase {
|
|||
"{$field_name}[0][value][time]" => $time_value,
|
||||
];
|
||||
$this->submitForm($edit, 'Save');
|
||||
$this->assertText('date is invalid');
|
||||
$this->assertSession()->pageTextContains('date is invalid');
|
||||
|
||||
// Invalid hour value.
|
||||
$date_value = '2012-12-01';
|
||||
|
@ -852,7 +852,7 @@ class DateTimeFieldTest extends DateTestBase {
|
|||
"{$field_name}[0][value][time]" => $time_value,
|
||||
];
|
||||
$this->submitForm($edit, 'Save');
|
||||
$this->assertText('date is invalid');
|
||||
$this->assertSession()->pageTextContains('date is invalid');
|
||||
|
||||
// Invalid minutes value.
|
||||
$date_value = '2012-12-01';
|
||||
|
@ -862,7 +862,7 @@ class DateTimeFieldTest extends DateTestBase {
|
|||
"{$field_name}[0][value][time]" => $time_value,
|
||||
];
|
||||
$this->submitForm($edit, 'Save');
|
||||
$this->assertText('date is invalid');
|
||||
$this->assertSession()->pageTextContains('date is invalid');
|
||||
|
||||
// Invalid seconds value.
|
||||
$date_value = '2012-12-01';
|
||||
|
@ -872,7 +872,7 @@ class DateTimeFieldTest extends DateTestBase {
|
|||
"{$field_name}[0][value][time]" => $time_value,
|
||||
];
|
||||
$this->submitForm($edit, 'Save');
|
||||
$this->assertText('date is invalid');
|
||||
$this->assertSession()->pageTextContains('date is invalid');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -915,7 +915,7 @@ class DateTimeFieldTest extends DateTestBase {
|
|||
$this->drupalGet('admin/structure/types/manage/date_content/fields/node.date_content.' . $field_name . '/storage');
|
||||
$result = $this->xpath("//*[@id='edit-settings-datetime-type' and contains(@disabled, 'disabled')]");
|
||||
$this->assertCount(1, $result, "Changing datetime setting is disabled.");
|
||||
$this->assertText('There is data for this field in the database. The field settings can no longer be changed.');
|
||||
$this->assertSession()->pageTextContains('There is data for this field in the database. The field settings can no longer be changed.');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -92,7 +92,7 @@ class DateRangeFieldTest extends DateTestBase {
|
|||
$this->submitForm($edit, 'Save');
|
||||
preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match);
|
||||
$id = $match[1];
|
||||
$this->assertText('entity_test ' . $id . ' has been created.');
|
||||
$this->assertSession()->pageTextContains('entity_test ' . $id . ' has been created.');
|
||||
$this->assertRaw($start_date->format($date_format));
|
||||
$this->assertNoRaw($start_date->format($time_format));
|
||||
$this->assertRaw($end_date->format($date_format));
|
||||
|
@ -218,7 +218,7 @@ class DateRangeFieldTest extends DateTestBase {
|
|||
$this->submitForm($edit, 'Save');
|
||||
preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match);
|
||||
$id = $match[1];
|
||||
$this->assertText('entity_test ' . $id . ' has been created.');
|
||||
$this->assertSession()->pageTextContains('entity_test ' . $id . ' has been created.');
|
||||
|
||||
$this->massageTestDate($start_date);
|
||||
|
||||
|
@ -325,7 +325,7 @@ class DateRangeFieldTest extends DateTestBase {
|
|||
$this->submitForm($edit, 'Save');
|
||||
preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match);
|
||||
$id = $match[1];
|
||||
$this->assertText('entity_test ' . $id . ' has been created.');
|
||||
$this->assertSession()->pageTextContains('entity_test ' . $id . ' has been created.');
|
||||
$this->assertRaw($start_date->format($date_format));
|
||||
$this->assertRaw($start_date->format($time_format));
|
||||
$this->assertRaw($end_date->format($date_format));
|
||||
|
@ -410,7 +410,7 @@ class DateRangeFieldTest extends DateTestBase {
|
|||
$this->submitForm($edit, 'Save');
|
||||
preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match);
|
||||
$id = $match[1];
|
||||
$this->assertText('entity_test ' . $id . ' has been created.');
|
||||
$this->assertSession()->pageTextContains('entity_test ' . $id . ' has been created.');
|
||||
|
||||
$this->displayOptions = [
|
||||
'type' => 'daterange_default',
|
||||
|
@ -498,7 +498,7 @@ class DateRangeFieldTest extends DateTestBase {
|
|||
$this->submitForm($edit, 'Save');
|
||||
preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match);
|
||||
$id = $match[1];
|
||||
$this->assertText('entity_test ' . $id . ' has been created.');
|
||||
$this->assertSession()->pageTextContains('entity_test ' . $id . ' has been created.');
|
||||
$this->assertRaw($start_date->format($date_format));
|
||||
$this->assertNoRaw($start_date->format($time_format));
|
||||
$this->assertRaw($end_date->format($date_format));
|
||||
|
@ -582,7 +582,7 @@ class DateRangeFieldTest extends DateTestBase {
|
|||
$this->submitForm($edit, 'Save');
|
||||
preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match);
|
||||
$id = $match[1];
|
||||
$this->assertText('entity_test ' . $id . ' has been created.');
|
||||
$this->assertSession()->pageTextContains('entity_test ' . $id . ' has been created.');
|
||||
|
||||
$this->displayOptions = [
|
||||
'type' => 'daterange_default',
|
||||
|
@ -770,7 +770,7 @@ class DateRangeFieldTest extends DateTestBase {
|
|||
$this->submitForm($edit, 'Save');
|
||||
preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match);
|
||||
$id = $match[1];
|
||||
$this->assertText('entity_test ' . $id . ' has been created.');
|
||||
$this->assertSession()->pageTextContains('entity_test ' . $id . ' has been created.');
|
||||
|
||||
$this->assertTrue($this->assertSession()->optionExists("edit-$field_name-0-value-year", '2012')->isSelected());
|
||||
$this->assertTrue($this->assertSession()->optionExists("edit-$field_name-0-value-month", '12')->isSelected());
|
||||
|
@ -825,7 +825,7 @@ class DateRangeFieldTest extends DateTestBase {
|
|||
$this->submitForm($edit, 'Save');
|
||||
preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match);
|
||||
$id = $match[1];
|
||||
$this->assertText('entity_test ' . $id . ' has been created.');
|
||||
$this->assertSession()->pageTextContains('entity_test ' . $id . ' has been created.');
|
||||
|
||||
$this->assertTrue($this->assertSession()->optionExists("edit-$field_name-0-value-year", '2012')->isSelected());
|
||||
$this->assertTrue($this->assertSession()->optionExists("edit-$field_name-0-value-month", '12')->isSelected());
|
||||
|
@ -871,7 +871,7 @@ class DateRangeFieldTest extends DateTestBase {
|
|||
$this->submitForm($edit, 'Save');
|
||||
$this->assertSession()->statusCodeEquals(200);
|
||||
foreach ($expected as $expected_text) {
|
||||
$this->assertText($expected_text);
|
||||
$this->assertSession()->pageTextContains($expected_text);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -892,7 +892,7 @@ class DateRangeFieldTest extends DateTestBase {
|
|||
$this->assertSession()->statusCodeEquals(200);
|
||||
preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match);
|
||||
$id = $match[1];
|
||||
$this->assertText('entity_test ' . $id . ' has been created.');
|
||||
$this->assertSession()->pageTextContains('entity_test ' . $id . ' has been created.');
|
||||
|
||||
// Test the widget to ensure zeros are not deselected on validation.
|
||||
$this->drupalGet('entity_test/add');
|
||||
|
@ -1052,7 +1052,7 @@ class DateRangeFieldTest extends DateTestBase {
|
|||
'default_value_input[default_end_date]' => '+1 day',
|
||||
];
|
||||
$this->drupalPostForm('admin/structure/types/manage/date_content/fields/node.date_content.' . $field_name, $field_edit, 'Save settings');
|
||||
$this->assertText('The relative start date value entered is invalid.');
|
||||
$this->assertSession()->pageTextContains('The relative start date value entered is invalid.');
|
||||
|
||||
$field_edit = [
|
||||
'default_value_input[default_date_type]' => 'relative',
|
||||
|
@ -1061,7 +1061,7 @@ class DateRangeFieldTest extends DateTestBase {
|
|||
'default_value_input[default_end_date]' => 'invalid date',
|
||||
];
|
||||
$this->drupalPostForm('admin/structure/types/manage/date_content/fields/node.date_content.' . $field_name, $field_edit, 'Save settings');
|
||||
$this->assertText('The relative end date value entered is invalid.');
|
||||
$this->assertSession()->pageTextContains('The relative end date value entered is invalid.');
|
||||
|
||||
// Set a relative default_value.
|
||||
$field_edit = [
|
||||
|
@ -1181,7 +1181,7 @@ class DateRangeFieldTest extends DateTestBase {
|
|||
"{$field_name}[0][end_value][time]" => '12:00:00',
|
||||
];
|
||||
$this->submitForm($edit, 'Save');
|
||||
$this->assertText('date is invalid');
|
||||
$this->assertSession()->pageTextContains('date is invalid');
|
||||
|
||||
// Invalid year value.
|
||||
$date_value = 'aaaa-12-01';
|
||||
|
@ -1192,7 +1192,7 @@ class DateRangeFieldTest extends DateTestBase {
|
|||
"{$field_name}[0][end_value][time]" => '12:00:00',
|
||||
];
|
||||
$this->submitForm($edit, 'Save');
|
||||
$this->assertText('date is invalid');
|
||||
$this->assertSession()->pageTextContains('date is invalid');
|
||||
|
||||
// Invalid month value.
|
||||
$date_value = '2012-75-01';
|
||||
|
@ -1203,7 +1203,7 @@ class DateRangeFieldTest extends DateTestBase {
|
|||
"{$field_name}[0][end_value][time]" => '12:00:00',
|
||||
];
|
||||
$this->submitForm($edit, 'Save');
|
||||
$this->assertText('date is invalid');
|
||||
$this->assertSession()->pageTextContains('date is invalid');
|
||||
|
||||
// Invalid day value.
|
||||
$date_value = '2012-12-99';
|
||||
|
@ -1214,7 +1214,7 @@ class DateRangeFieldTest extends DateTestBase {
|
|||
"{$field_name}[0][end_value][time]" => '12:00:00',
|
||||
];
|
||||
$this->submitForm($edit, 'Save');
|
||||
$this->assertText('date is invalid');
|
||||
$this->assertSession()->pageTextContains('date is invalid');
|
||||
|
||||
// Submit invalid start times and ensure they is not accepted.
|
||||
$time_value = '';
|
||||
|
@ -1225,7 +1225,7 @@ class DateRangeFieldTest extends DateTestBase {
|
|||
"{$field_name}[0][end_value][time]" => '12:00:00',
|
||||
];
|
||||
$this->submitForm($edit, 'Save');
|
||||
$this->assertText('date is invalid');
|
||||
$this->assertSession()->pageTextContains('date is invalid');
|
||||
|
||||
// Invalid hour value.
|
||||
$time_value = '49:00:00';
|
||||
|
@ -1236,7 +1236,7 @@ class DateRangeFieldTest extends DateTestBase {
|
|||
"{$field_name}[0][end_value][time]" => '12:00:00',
|
||||
];
|
||||
$this->submitForm($edit, 'Save');
|
||||
$this->assertText('date is invalid');
|
||||
$this->assertSession()->pageTextContains('date is invalid');
|
||||
|
||||
// Invalid minutes value.
|
||||
$time_value = '12:99:00';
|
||||
|
@ -1247,7 +1247,7 @@ class DateRangeFieldTest extends DateTestBase {
|
|||
"{$field_name}[0][end_value][time]" => '12:00:00',
|
||||
];
|
||||
$this->submitForm($edit, 'Save');
|
||||
$this->assertText('date is invalid');
|
||||
$this->assertSession()->pageTextContains('date is invalid');
|
||||
|
||||
// Invalid seconds value.
|
||||
$time_value = '12:15:99';
|
||||
|
@ -1258,7 +1258,7 @@ class DateRangeFieldTest extends DateTestBase {
|
|||
"{$field_name}[0][end_value][time]" => '12:00:00',
|
||||
];
|
||||
$this->submitForm($edit, 'Save');
|
||||
$this->assertText('date is invalid');
|
||||
$this->assertSession()->pageTextContains('date is invalid');
|
||||
|
||||
// Submit invalid end dates and ensure they is not accepted.
|
||||
$date_value = '';
|
||||
|
@ -1269,7 +1269,7 @@ class DateRangeFieldTest extends DateTestBase {
|
|||
"{$field_name}[0][end_value][time]" => '12:00:00',
|
||||
];
|
||||
$this->submitForm($edit, 'Save');
|
||||
$this->assertText('date is invalid');
|
||||
$this->assertSession()->pageTextContains('date is invalid');
|
||||
|
||||
// Invalid year value.
|
||||
$date_value = 'aaaa-12-01';
|
||||
|
@ -1280,7 +1280,7 @@ class DateRangeFieldTest extends DateTestBase {
|
|||
"{$field_name}[0][end_value][time]" => '00:00:00',
|
||||
];
|
||||
$this->submitForm($edit, 'Save');
|
||||
$this->assertText('date is invalid');
|
||||
$this->assertSession()->pageTextContains('date is invalid');
|
||||
|
||||
// Invalid month value.
|
||||
$date_value = '2012-75-01';
|
||||
|
@ -1291,7 +1291,7 @@ class DateRangeFieldTest extends DateTestBase {
|
|||
"{$field_name}[0][end_value][time]" => '00:00:00',
|
||||
];
|
||||
$this->submitForm($edit, 'Save');
|
||||
$this->assertText('date is invalid');
|
||||
$this->assertSession()->pageTextContains('date is invalid');
|
||||
|
||||
// Invalid day value.
|
||||
$date_value = '2012-12-99';
|
||||
|
@ -1302,7 +1302,7 @@ class DateRangeFieldTest extends DateTestBase {
|
|||
"{$field_name}[0][end_value][time]" => '00:00:00',
|
||||
];
|
||||
$this->submitForm($edit, 'Save');
|
||||
$this->assertText('date is invalid');
|
||||
$this->assertSession()->pageTextContains('date is invalid');
|
||||
|
||||
// Submit invalid start times and ensure they is not accepted.
|
||||
$time_value = '';
|
||||
|
@ -1313,7 +1313,7 @@ class DateRangeFieldTest extends DateTestBase {
|
|||
"{$field_name}[0][end_value][time]" => $time_value,
|
||||
];
|
||||
$this->submitForm($edit, 'Save');
|
||||
$this->assertText('date is invalid');
|
||||
$this->assertSession()->pageTextContains('date is invalid');
|
||||
|
||||
// Invalid hour value.
|
||||
$time_value = '49:00:00';
|
||||
|
@ -1324,7 +1324,7 @@ class DateRangeFieldTest extends DateTestBase {
|
|||
"{$field_name}[0][end_value][time]" => $time_value,
|
||||
];
|
||||
$this->submitForm($edit, 'Save');
|
||||
$this->assertText('date is invalid');
|
||||
$this->assertSession()->pageTextContains('date is invalid');
|
||||
|
||||
// Invalid minutes value.
|
||||
$time_value = '12:99:00';
|
||||
|
@ -1335,7 +1335,7 @@ class DateRangeFieldTest extends DateTestBase {
|
|||
"{$field_name}[0][end_value][time]" => $time_value,
|
||||
];
|
||||
$this->submitForm($edit, 'Save');
|
||||
$this->assertText('date is invalid');
|
||||
$this->assertSession()->pageTextContains('date is invalid');
|
||||
|
||||
// Invalid seconds value.
|
||||
$time_value = '12:15:99';
|
||||
|
@ -1346,7 +1346,7 @@ class DateRangeFieldTest extends DateTestBase {
|
|||
"{$field_name}[0][end_value][time]" => $time_value,
|
||||
];
|
||||
$this->submitForm($edit, 'Save');
|
||||
$this->assertText('date is invalid');
|
||||
$this->assertSession()->pageTextContains('date is invalid');
|
||||
|
||||
// End date before start date.
|
||||
$edit = [
|
||||
|
@ -1356,7 +1356,7 @@ 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');
|
||||
$this->assertSession()->pageTextContains('The ' . $field_label . ' end date cannot be before the start date');
|
||||
|
||||
// End date before start date.
|
||||
$edit = [
|
||||
|
@ -1366,7 +1366,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');
|
||||
$this->assertSession()->pageTextContains('The ' . $field_label . ' end date cannot be before the start date');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1410,7 +1410,7 @@ class DateRangeFieldTest extends DateTestBase {
|
|||
$this->drupalGet('admin/structure/types/manage/date_content/fields/node.date_content.' . $field_name . '/storage');
|
||||
$result = $this->xpath("//*[@id='edit-settings-datetime-type' and contains(@disabled, 'disabled')]");
|
||||
$this->assertCount(1, $result, "Changing datetime setting is disabled.");
|
||||
$this->assertText('There is data for this field in the database. The field settings can no longer be changed.');
|
||||
$this->assertSession()->pageTextContains('There is data for this field in the database. The field settings can no longer be changed.');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -139,7 +139,7 @@ class DbLogTest extends BrowserTestBase {
|
|||
$this->assertRaw($context['request_uri']);
|
||||
|
||||
// Verify severity.
|
||||
$this->assertText('Notice');
|
||||
$this->assertSession()->pageTextContains('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');
|
||||
$this->assertSession()->pageTextContains('Referrer');
|
||||
|
||||
// Verify severity.
|
||||
$this->assertText('Notice');
|
||||
$this->assertSession()->pageTextContains('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');
|
||||
$this->assertSession()->pageTextContains('Location');
|
||||
|
||||
// Verify severity.
|
||||
$this->assertText('Notice');
|
||||
$this->assertSession()->pageTextContains('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');
|
||||
$this->assertSession()->pageTextContains('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');
|
||||
$this->assertSession()->pageTextContains('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?');
|
||||
$this->assertSession()->pageTextContains('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");
|
||||
$this->assertSession()->pageTextContains("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");
|
||||
$this->assertSession()->pageTextContains("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');
|
||||
$this->assertSession()->pageTextContains('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');
|
||||
$this->assertSession()->pageTextContains('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);
|
||||
$this->assertSession()->pageTextContains($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');
|
||||
$this->assertSession()->pageTextContains('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());
|
||||
$this->assertSession()->pageTextContains('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');
|
||||
$this->assertSession()->pageTextContains('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.');
|
||||
$this->assertSession()->pageTextContains('Database log cleared.');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -822,7 +822,7 @@ class DbLogTest extends BrowserTestBase {
|
|||
|
||||
// Check if the full message displays on the details page.
|
||||
$this->drupalGet('admin/reports/dblog/event/' . $wid);
|
||||
$this->assertText('Dblog test log message');
|
||||
$this->assertSession()->pageTextContains('Dblog test log message');
|
||||
|
||||
// Delete the user.
|
||||
$tempuser->delete();
|
||||
|
@ -831,7 +831,7 @@ class DbLogTest extends BrowserTestBase {
|
|||
|
||||
// Check if the full message displays on the details page.
|
||||
$this->drupalGet('admin/reports/dblog/event/' . $wid);
|
||||
$this->assertText('Dblog test log message');
|
||||
$this->assertSession()->pageTextContains('Dblog test log message');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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());
|
||||
$this->assertSession()->pageTextContains($this->field->label());
|
||||
$this->assertNoRaw($on);
|
||||
|
||||
// Submit and ensure it is accepted.
|
||||
|
@ -117,7 +117,7 @@ class BooleanFieldTest 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.');
|
||||
$this->assertSession()->pageTextContains('entity_test ' . $id . ' has been created.');
|
||||
|
||||
// Verify that boolean value is displayed.
|
||||
$entity = EntityTest::load($id);
|
||||
|
@ -157,7 +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.');
|
||||
$this->assertSession()->pageTextContains('Use field label instead of the "On" label as the label.');
|
||||
|
||||
// Enable setting.
|
||||
$edit = ['fields[' . $field_name . '][settings_edit_form][settings][display_label]' => 1];
|
||||
|
@ -167,10 +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');
|
||||
$this->assertSession()->pageTextContains('Use field label: Yes');
|
||||
|
||||
$this->submitForm([], $field_name . "_settings_edit");
|
||||
$this->assertText('Use field label instead of the "On" label as the label.');
|
||||
$this->assertSession()->pageTextContains('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.
|
||||
|
@ -230,7 +230,7 @@ class BooleanFieldTest extends BrowserTestBase {
|
|||
$this->submitForm([], 'Save');
|
||||
preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match);
|
||||
$id = $match[1];
|
||||
$this->assertText('entity_test ' . $id . ' has been created.');
|
||||
$this->assertSession()->pageTextContains('entity_test ' . $id . ' has been created.');
|
||||
|
||||
// Tell the test module to disable access to the field.
|
||||
\Drupal::state()->set('field.test_boolean_field_access_field', $field_name);
|
||||
|
@ -241,7 +241,7 @@ class BooleanFieldTest extends BrowserTestBase {
|
|||
$this->submitForm([], 'Save');
|
||||
preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match);
|
||||
$id = $match[1];
|
||||
$this->assertText('entity_test ' . $id . ' has been created.');
|
||||
$this->assertSession()->pageTextContains('entity_test ' . $id . ' has been created.');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -100,7 +100,7 @@ class EmailFieldTest 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.');
|
||||
$this->assertSession()->pageTextContains('entity_test ' . $id . ' has been created.');
|
||||
$this->assertRaw($value);
|
||||
|
||||
// Verify that a mailto link is displayed.
|
||||
|
|
|
@ -173,7 +173,7 @@ class EntityReferenceAdminTest extends BrowserTestBase {
|
|||
$this->drupalPostForm('node/add/' . $this->type, $edit, 'Save');
|
||||
|
||||
// Assert that entity reference autocomplete field is validated.
|
||||
$this->assertText('There are no content items matching "Test"');
|
||||
$this->assertSession()->pageTextContains('There are no content items matching "Test"');
|
||||
|
||||
$edit = [
|
||||
'title[0][value]' => 'Test',
|
||||
|
@ -183,10 +183,10 @@ class EntityReferenceAdminTest extends BrowserTestBase {
|
|||
|
||||
// Assert the results multiple times to avoid sorting problem of nodes with
|
||||
// the same title.
|
||||
$this->assertText('Multiple content items match this reference;');
|
||||
$this->assertText($node1->getTitle() . ' (' . $node1->id() . ')');
|
||||
$this->assertText($node2->getTitle() . ' (' . $node2->id() . ')');
|
||||
$this->assertText('Specify the one you want by appending the id in parentheses, like "' . $node2->getTitle() . ' (' . $node2->id() . ')' . '".');
|
||||
$this->assertSession()->pageTextContains('Multiple content items match this reference;');
|
||||
$this->assertSession()->pageTextContains($node1->getTitle() . ' (' . $node1->id() . ')');
|
||||
$this->assertSession()->pageTextContains($node2->getTitle() . ' (' . $node2->id() . ')');
|
||||
$this->assertSession()->pageTextContains('Specify the one you want by appending the id in parentheses, like "' . $node2->getTitle() . ' (' . $node2->id() . ')' . '".');
|
||||
|
||||
$edit = [
|
||||
'title[0][value]' => 'Test',
|
||||
|
|
|
@ -145,8 +145,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());
|
||||
$this->assertText($referenced_node->label());
|
||||
$this->assertSession()->pageTextContains($referencing_node->label());
|
||||
$this->assertSession()->pageTextContains($referenced_node->label());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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);
|
||||
$this->assertText($this->originalLabel);
|
||||
$this->assertSession()->pageTextContains($this->labelOfNotTranslatedReference);
|
||||
$this->assertSession()->pageTextContains($this->originalLabel);
|
||||
$this->assertNoText($this->translatedLabel);
|
||||
$this->drupalGet($translation_url);
|
||||
$this->assertText($this->labelOfNotTranslatedReference);
|
||||
$this->assertSession()->pageTextContains($this->labelOfNotTranslatedReference);
|
||||
$this->assertNoText($this->originalLabel);
|
||||
$this->assertText($this->translatedLabel);
|
||||
$this->assertSession()->pageTextContains($this->translatedLabel);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -85,7 +85,7 @@ class FieldAccessTest extends FieldTestBase {
|
|||
|
||||
// Assert the text is visible.
|
||||
$this->drupalGet('node/' . $this->node->id());
|
||||
$this->assertText($this->testViewFieldValue);
|
||||
$this->assertSession()->pageTextContains($this->testViewFieldValue);
|
||||
|
||||
// Assert the text is not visible for anonymous users.
|
||||
// The field_test module implements hook_entity_field_access() which will
|
||||
|
|
|
@ -55,7 +55,7 @@ class FieldHelpTest extends BrowserTestBase {
|
|||
$this->assertSession()->linkExists('Options', 0, 'Options module is listed on the Field help page.');
|
||||
// Verify that modules with field types that do not implement hook_help are
|
||||
// listed.
|
||||
$this->assertText('Field API Test');
|
||||
$this->assertSession()->pageTextContains('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.');
|
||||
}
|
||||
|
|
|
@ -104,7 +104,7 @@ class FieldImportDeleteUninstallUiTest extends FieldTestBase {
|
|||
$this->drupalGet('admin/config/development/configuration');
|
||||
// Test that the message for one field being purged during a configuration
|
||||
// synchronization is correct.
|
||||
$this->assertText('This synchronization will delete data from the field entity_test.field_tel.');
|
||||
$this->assertSession()->pageTextContains('This synchronization will delete data from the field entity_test.field_tel.');
|
||||
|
||||
// Stage an uninstall of the datetime module to test the message for
|
||||
// multiple fields.
|
||||
|
@ -112,7 +112,7 @@ class FieldImportDeleteUninstallUiTest extends FieldTestBase {
|
|||
$sync->write('core.extension', $core_extension);
|
||||
|
||||
$this->drupalGet('admin/config/development/configuration');
|
||||
$this->assertText('This synchronization will delete data from the fields: entity_test.field_tel, entity_test.field_date.');
|
||||
$this->assertSession()->pageTextContains('This synchronization will delete data from the fields: entity_test.field_tel, entity_test.field_date.');
|
||||
|
||||
// This will purge all the data, delete the field and uninstall the
|
||||
// Telephone and Text modules.
|
||||
|
|
|
@ -121,7 +121,7 @@ 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);
|
||||
$this->assertSession()->pageTextContains($token_description);
|
||||
$this->assertSession()->fieldValueEquals("{$field_name}[0][value]", '');
|
||||
// Verify that no extraneous widget is displayed.
|
||||
$this->assertSession()->fieldNotExists("{$field_name}[1][value]");
|
||||
|
@ -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.');
|
||||
$this->assertSession()->pageTextContains('entity_test ' . $id . ' has been created.');
|
||||
$entity = EntityTest::load($id);
|
||||
$this->assertEquals($value, $entity->{$field_name}->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.');
|
||||
$this->assertSession()->pageTextContains('entity_test ' . $id . ' has been updated.');
|
||||
$this->container->get('entity_type.manager')->getStorage('entity_test')->resetCache([$id]);
|
||||
$entity = EntityTest::load($id);
|
||||
$this->assertEquals($value, $entity->{$field_name}->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.');
|
||||
$this->assertSession()->pageTextContains('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.');
|
||||
$this->assertSession()->pageTextContains('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.');
|
||||
$this->assertSession()->pageTextContains('entity_test ' . $id . ' has been created.');
|
||||
$entity = EntityTest::load($id);
|
||||
$this->assertEquals($value, $entity->{$field_name}->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.');
|
||||
$this->assertSession()->pageTextContains('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.');
|
||||
$this->assertSession()->pageTextContains('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.');
|
||||
$this->assertSession()->pageTextContains('entity_test_rev ' . $id . ' has been updated.');
|
||||
$storage->resetCache([$id]);
|
||||
$entity = $storage->load($id);
|
||||
$this->assertEquals($value, $entity->{$field_name}->value, 'Field value was updated');
|
||||
|
@ -679,7 +679,7 @@ class FormTest extends FieldTestBase {
|
|||
|
||||
$this->drupalGet('entity_test_base_field_display/manage/' . $entity->id());
|
||||
$this->assertSession()->statusCodeEquals(200);
|
||||
$this->assertText('A field with multiple values');
|
||||
$this->assertSession()->pageTextContains('A field with multiple values');
|
||||
// Test if labels were XSS filtered.
|
||||
$this->assertSession()->assertEscaped("<script>alert('a configurable field');</script>");
|
||||
}
|
||||
|
|
|
@ -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.');
|
||||
$this->assertSession()->pageTextContains('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.');
|
||||
$this->assertSession()->pageTextContains('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.');
|
||||
$this->assertSession()->pageTextContains('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.');
|
||||
$this->assertSession()->pageTextContains('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.');
|
||||
$this->assertSession()->pageTextContains('entity_test ' . $id . ' has been created.');
|
||||
|
||||
// Ensure that the 'number_decimal' formatter displays the number with the
|
||||
// expected rounding.
|
||||
|
|
|
@ -102,7 +102,7 @@ class ReEnableModuleFieldTest extends BrowserTestBase {
|
|||
]);
|
||||
$this->drupalLogin($admin_user);
|
||||
$this->drupalGet('admin/modules/uninstall');
|
||||
$this->assertText("The Telephone number field type is used in the following field: node.field_telephone");
|
||||
$this->assertSession()->pageTextContains("The Telephone number field type is used in the following field: node.field_telephone");
|
||||
|
||||
// Add another telephone field to a different entity type in order to test
|
||||
// the message for the case when multiple fields are blocking the
|
||||
|
@ -120,14 +120,14 @@ class ReEnableModuleFieldTest extends BrowserTestBase {
|
|||
])->save();
|
||||
|
||||
$this->drupalGet('admin/modules/uninstall');
|
||||
$this->assertText("The Telephone number field type is used in the following fields: node.field_telephone, user.field_telephone_2");
|
||||
$this->assertSession()->pageTextContains("The Telephone number field type is used in the following fields: node.field_telephone, user.field_telephone_2");
|
||||
|
||||
// Delete both fields.
|
||||
$field_storage->delete();
|
||||
$field_storage2->delete();
|
||||
|
||||
$this->drupalGet('admin/modules/uninstall');
|
||||
$this->assertText('Fields pending deletion');
|
||||
$this->assertSession()->pageTextContains('Fields pending deletion');
|
||||
$this->cronRun();
|
||||
$this->assertNoText("The Telephone number field type is used in the following field: node.field_telephone");
|
||||
$this->assertNoText('Fields pending deletion');
|
||||
|
|
|
@ -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.');
|
||||
$this->assertSession()->pageTextContains('entity_test ' . $id . ' has been created.');
|
||||
|
||||
// Display the entity.
|
||||
$entity = EntityTest::load($id);
|
||||
|
|
|
@ -52,7 +52,7 @@ class EntityDisplayModeTest extends BrowserTestBase {
|
|||
$this->drupalLogin($this->drupalCreateUser(['administer display modes']));
|
||||
$this->drupalGet('admin/structure/display-modes/view');
|
||||
$this->assertSession()->statusCodeEquals(200);
|
||||
$this->assertText('Add view mode');
|
||||
$this->assertSession()->pageTextContains('Add view mode');
|
||||
$this->assertSession()->linkByHrefExists('admin/structure/display-modes/view/add');
|
||||
$this->assertSession()->linkByHrefExists('admin/structure/display-modes/view/add/entity_test');
|
||||
|
||||
|
@ -107,7 +107,7 @@ class EntityDisplayModeTest extends BrowserTestBase {
|
|||
$this->drupalLogin($this->drupalCreateUser(['administer display modes']));
|
||||
$this->drupalGet('admin/structure/display-modes/form');
|
||||
$this->assertSession()->statusCodeEquals(200);
|
||||
$this->assertText('Add form mode');
|
||||
$this->assertSession()->pageTextContains('Add form mode');
|
||||
$this->assertSession()->linkByHrefExists('admin/structure/display-modes/form/add');
|
||||
|
||||
$this->drupalGet('admin/structure/display-modes/form/add/entity_test_no_label');
|
||||
|
|
|
@ -121,9 +121,9 @@ class FieldUIDeleteTest extends BrowserTestBase {
|
|||
|
||||
// Check the config dependencies of the first field.
|
||||
$this->drupalGet("$bundle_path2/fields/node.$type_name2.$field_name/delete");
|
||||
$this->assertText('The listed configuration will be updated.');
|
||||
$this->assertText('View');
|
||||
$this->assertText('test_view_field_delete');
|
||||
$this->assertSession()->pageTextContains('The listed configuration will be updated.');
|
||||
$this->assertSession()->pageTextContains('View');
|
||||
$this->assertSession()->pageTextContains('test_view_field_delete');
|
||||
|
||||
$xml = $this->cssSelect('#edit-entity-deletes');
|
||||
// Test that nothing is scheduled for deletion.
|
||||
|
|
|
@ -40,7 +40,7 @@ class FieldUIRouteTest extends BrowserTestBase {
|
|||
*/
|
||||
public function testFieldUIRoutes() {
|
||||
$this->drupalGet('entity_test_no_id/structure/entity_test/fields');
|
||||
$this->assertText('No fields are present yet.');
|
||||
$this->assertSession()->pageTextContains('No fields are present yet.');
|
||||
|
||||
$this->drupalGet('admin/config/people/accounts/fields');
|
||||
$this->assertSession()->titleEquals('Manage fields | Drupal');
|
||||
|
|
|
@ -239,7 +239,7 @@ class ManageFieldsFunctionalTest extends BrowserTestBase {
|
|||
$edit = [
|
||||
'settings[test_field_setting]' => $string,
|
||||
];
|
||||
$this->assertText('Default value');
|
||||
$this->assertSession()->pageTextContains('Default value');
|
||||
$this->submitForm($edit, 'Save settings');
|
||||
|
||||
// Assert the field settings are correct.
|
||||
|
@ -283,7 +283,7 @@ class ManageFieldsFunctionalTest extends BrowserTestBase {
|
|||
'cardinality_number' => '',
|
||||
];
|
||||
$this->drupalPostForm($field_edit_path, $edit, 'Save field settings');
|
||||
$this->assertText('Number of values is required.');
|
||||
$this->assertSession()->pageTextContains('Number of values is required.');
|
||||
|
||||
// Submit a custom number.
|
||||
$edit = [
|
||||
|
@ -291,7 +291,7 @@ class ManageFieldsFunctionalTest extends BrowserTestBase {
|
|||
'cardinality_number' => 6,
|
||||
];
|
||||
$this->drupalPostForm($field_edit_path, $edit, 'Save field settings');
|
||||
$this->assertText('Updated field Body field settings.');
|
||||
$this->assertSession()->pageTextContains('Updated field Body field settings.');
|
||||
$this->drupalGet($field_edit_path);
|
||||
$this->assertSession()->fieldValueEquals('cardinality', 'number');
|
||||
$this->assertSession()->fieldValueEquals('cardinality_number', 6);
|
||||
|
@ -324,7 +324,7 @@ class ManageFieldsFunctionalTest extends BrowserTestBase {
|
|||
'cardinality' => FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED,
|
||||
];
|
||||
$this->drupalPostForm($field_edit_path, $edit, 'Save field settings');
|
||||
$this->assertText('Updated field Body field settings.');
|
||||
$this->assertSession()->pageTextContains('Updated field Body field settings.');
|
||||
$this->drupalGet($field_edit_path);
|
||||
$this->assertSession()->fieldValueEquals('cardinality', FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED);
|
||||
$this->assertSession()->fieldValueEquals('cardinality_number', 1);
|
||||
|
@ -467,7 +467,7 @@ class ManageFieldsFunctionalTest extends BrowserTestBase {
|
|||
'field_name' => $field_exceed_max_length_input,
|
||||
];
|
||||
$this->drupalPostForm('admin/structure/types/manage/' . $this->contentType . '/fields/add-field', $edit, 'Save and continue');
|
||||
$this->assertText('Machine-readable name cannot be longer than 22 characters but is currently 23 characters long.');
|
||||
$this->assertSession()->pageTextContains('Machine-readable name cannot be longer than 22 characters but is currently 23 characters long.');
|
||||
|
||||
// Create a valid field.
|
||||
$this->fieldUIAddNewField('admin/structure/types/manage/' . $this->contentType, $this->fieldNameInput, $this->fieldLabel);
|
||||
|
@ -509,12 +509,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");
|
||||
$this->assertSession()->pageTextContains("$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");
|
||||
$this->assertSession()->pageTextContains("Saved $field_name configuration");
|
||||
$field = FieldConfig::loadByName('node', $this->contentType, $field_name);
|
||||
$this->assertEquals([['value' => 1]], $field->getDefaultValueLiteral(), 'The default value was correctly saved.');
|
||||
|
||||
|
@ -525,7 +525,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");
|
||||
$this->assertSession()->pageTextContains("Saved $field_name configuration");
|
||||
$field = FieldConfig::loadByName('node', $this->contentType, $field_name);
|
||||
$this->assertEquals([], $field->getDefaultValueLiteral(), 'The default value was correctly saved.');
|
||||
|
||||
|
@ -543,7 +543,7 @@ class ManageFieldsFunctionalTest extends BrowserTestBase {
|
|||
|
||||
$this->drupalGet($admin_path);
|
||||
$this->submitForm([], 'Save settings');
|
||||
$this->assertText("Saved $field_name configuration");
|
||||
$this->assertSession()->pageTextContains("Saved $field_name configuration");
|
||||
$field = FieldConfig::loadByName('node', $this->contentType, $field_name);
|
||||
$this->assertEquals([], $field->getDefaultValueLiteral(), 'The default value was correctly saved.');
|
||||
|
||||
|
@ -606,13 +606,13 @@ class ManageFieldsFunctionalTest extends BrowserTestBase {
|
|||
$edit['field_name'] = 'title';
|
||||
$bundle_path = 'admin/structure/types/manage/' . $this->contentType;
|
||||
$this->drupalPostForm("$bundle_path/fields/add-field", $edit, 'Save and continue');
|
||||
$this->assertText('The machine-readable name is already in use. It must be unique.');
|
||||
$this->assertSession()->pageTextContains('The machine-readable name is already in use. It must be unique.');
|
||||
|
||||
// Try with a base field.
|
||||
$edit['field_name'] = 'sticky';
|
||||
$bundle_path = 'admin/structure/types/manage/' . $this->contentType;
|
||||
$this->drupalPostForm("$bundle_path/fields/add-field", $edit, 'Save and continue');
|
||||
$this->assertText('The machine-readable name is already in use. It must be unique.');
|
||||
$this->assertSession()->pageTextContains('The machine-readable name is already in use. It must be unique.');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -715,7 +715,7 @@ class ManageFieldsFunctionalTest extends BrowserTestBase {
|
|||
$url = 'admin/structure/types/manage/' . $this->contentType . '/fields/add-field';
|
||||
$this->drupalPostForm($url, $edit, 'Save and continue');
|
||||
|
||||
$this->assertText('The machine-readable name is already in use. It must be unique.');
|
||||
$this->assertSession()->pageTextContains('The machine-readable name is already in use. It must be unique.');
|
||||
$this->assertSession()->addressEquals($url);
|
||||
}
|
||||
|
||||
|
@ -782,7 +782,7 @@ class ManageFieldsFunctionalTest extends BrowserTestBase {
|
|||
// Check that hook_field_widget_single_element_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_single_element_form_alter(): Default form is true.');
|
||||
$this->assertSession()->pageTextContains('From hook_field_widget_single_element_form_alter(): Default form is true.');
|
||||
|
||||
$edit = [
|
||||
'description' => '<em>Test with a non upload field.',
|
||||
|
@ -799,7 +799,7 @@ class ManageFieldsFunctionalTest extends BrowserTestBase {
|
|||
*/
|
||||
public function fieldListAdminPage() {
|
||||
$this->drupalGet('admin/reports/fields');
|
||||
$this->assertText($this->fieldName);
|
||||
$this->assertSession()->pageTextContains($this->fieldName);
|
||||
$this->assertSession()->linkByHrefExists('admin/structure/types/manage/' . $this->contentType . '/fields');
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ class FileFieldAnonymousSubmissionTest extends FileFieldTestBase {
|
|||
$this->drupalLogout();
|
||||
$this->drupalGet('node/add/article');
|
||||
$this->assertSession()->statusCodeEquals(200);
|
||||
$this->assertText(strip_tags(t('Create @name', ['@name' => $bundle_label])));
|
||||
$this->assertSession()->pageTextContains(strip_tags(t('Create @name', ['@name' => $bundle_label])));
|
||||
|
||||
$edit = [
|
||||
'title[0][value]' => $node_title,
|
||||
|
@ -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)));
|
||||
$this->assertSession()->pageTextContains(strip_tags(t('@type %title has been created.', $t_args)));
|
||||
$matches = [];
|
||||
if (preg_match('@node/(\d+)$@', $this->getUrl(), $matches)) {
|
||||
$nid = end($matches);
|
||||
|
@ -72,7 +72,7 @@ class FileFieldAnonymousSubmissionTest extends FileFieldTestBase {
|
|||
$this->drupalLogout();
|
||||
$this->drupalGet('node/add/article');
|
||||
$this->assertSession()->statusCodeEquals(200);
|
||||
$this->assertText(strip_tags(t('Create @name', ['@name' => $bundle_label])));
|
||||
$this->assertSession()->pageTextContains(strip_tags(t('Create @name', ['@name' => $bundle_label])));
|
||||
|
||||
// Generate an image file.
|
||||
$image = $this->getTestFile('image');
|
||||
|
@ -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)));
|
||||
$this->assertSession()->pageTextContains(strip_tags(t('@type %title has been created.', $t_args)));
|
||||
$matches = [];
|
||||
if (preg_match('@node/(\d+)$@', $this->getUrl(), $matches)) {
|
||||
$nid = end($matches);
|
||||
|
@ -129,7 +129,7 @@ class FileFieldAnonymousSubmissionTest extends FileFieldTestBase {
|
|||
// Load the node form.
|
||||
$this->drupalGet('node/add/article');
|
||||
$this->assertSession()->statusCodeEquals(200);
|
||||
$this->assertText(strip_tags(t('Create @name', ['@name' => $bundle_label])));
|
||||
$this->assertSession()->pageTextContains(strip_tags(t('Create @name', ['@name' => $bundle_label])));
|
||||
|
||||
// Generate an image file.
|
||||
$image = $this->getTestFile('image');
|
||||
|
@ -149,7 +149,7 @@ class FileFieldAnonymousSubmissionTest extends FileFieldTestBase {
|
|||
$this->assertSession()->statusCodeEquals(200);
|
||||
$t_args = ['@type' => $bundle_label, '%title' => $node_title];
|
||||
$this->assertNoText(strip_tags(t('@type %title has been created.', $t_args)));
|
||||
$this->assertText('Title field is required.');
|
||||
$this->assertSession()->pageTextContains('Title field is required.');
|
||||
|
||||
// Submit the form again but this time with the missing title field. This
|
||||
// should still work.
|
||||
|
@ -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)));
|
||||
$this->assertSession()->pageTextContains(strip_tags(t('@type %title has been created.', $t_args)));
|
||||
$matches = [];
|
||||
if (preg_match('@node/(\d+)$@', $this->getUrl(), $matches)) {
|
||||
$nid = end($matches);
|
||||
|
|
|
@ -94,7 +94,7 @@ class FileFieldDisplayTest extends FileFieldTestBase {
|
|||
$field_name . '[0][display]' => TRUE,
|
||||
];
|
||||
$this->drupalPostForm('node/' . $nid . '/edit', $edit, 'Save');
|
||||
$this->assertText($description);
|
||||
$this->assertSession()->pageTextContains($description);
|
||||
|
||||
// Ensure the filename in the link's title attribute is escaped.
|
||||
$this->assertRaw('title="escaped-&-text.txt"');
|
||||
|
@ -183,7 +183,7 @@ class FileFieldDisplayTest extends FileFieldTestBase {
|
|||
$this->drupalPostForm('node/add/' . $type_name, $edit, 'Save');
|
||||
$node = $this->drupalGetNodeByTitle($title);
|
||||
$this->drupalGet('node/' . $node->id() . '/edit');
|
||||
$this->assertText('The description may be used as the label of the link to the file.');
|
||||
$this->assertSession()->pageTextContains('The description may be used as the label of the link to the file.');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue