Commit 5939e6b5 authored by catch's avatar catch

Issue #3145418 by longwave, paulocs, shetpooja04, Spokje, nikitagupta,...

Issue #3145418 by longwave, paulocs, shetpooja04, Spokje, nikitagupta, mondrake, ravi.shankar, sarvjeetsingh, mrinalini9: [November 9, 2020] Remove uses of t() in assertText() calls
parent 4397d8d5
...@@ -52,7 +52,7 @@ public function testActionConfiguration() { ...@@ -52,7 +52,7 @@ public function testActionConfiguration() {
$action_id = $edit['id']; $action_id = $edit['id'];
// Make sure that the new complex action was saved properly. // Make sure that the new complex action was saved properly.
$this->assertText(t('The action has been successfully saved.'), "Make sure we get a confirmation that we've successfully saved the complex action."); $this->assertText('The action has been successfully saved.', "Make sure we get a confirmation that we've successfully saved the complex action.");
$this->assertText($action_label, "Make sure the action label appears on the configuration page after we've saved the complex action."); $this->assertText($action_label, "Make sure the action label appears on the configuration page after we've saved the complex action.");
// Make another POST request to the action edit page. // Make another POST request to the action edit page.
...@@ -66,7 +66,7 @@ public function testActionConfiguration() { ...@@ -66,7 +66,7 @@ public function testActionConfiguration() {
$this->assertSession()->statusCodeEquals(200); $this->assertSession()->statusCodeEquals(200);
// Make sure that the action updated properly. // Make sure that the action updated properly.
$this->assertText(t('The action has been successfully saved.'), "Make sure we get a confirmation that we've successfully updated the complex action."); $this->assertText('The action has been successfully saved.', "Make sure we get a confirmation that we've successfully updated the complex action.");
$this->assertNoText($action_label, "Make sure the old action label does NOT appear on the configuration page after we've updated the complex action."); $this->assertNoText($action_label, "Make sure the old action label does NOT appear on the configuration page after we've updated the complex action.");
$this->assertText($new_action_label, "Make sure the action label appears on the configuration page after we've updated the complex action."); $this->assertText($new_action_label, "Make sure the action label appears on the configuration page after we've updated the complex action.");
......
...@@ -37,7 +37,7 @@ public function testSettingsPage() { ...@@ -37,7 +37,7 @@ public function testSettingsPage() {
'aggregator_processors[aggregator_test_processor]' => 'aggregator_test_processor', 'aggregator_processors[aggregator_test_processor]' => 'aggregator_test_processor',
]; ];
$this->drupalPostForm('admin/config/services/aggregator/settings', $edit, t('Save configuration')); $this->drupalPostForm('admin/config/services/aggregator/settings', $edit, t('Save configuration'));
$this->assertText(t('The configuration options have been saved.')); $this->assertText('The configuration options have been saved.');
// Check that settings have the correct default value. // Check that settings have the correct default value.
foreach ($edit as $name => $value) { foreach ($edit as $name => $value) {
...@@ -45,13 +45,13 @@ public function testSettingsPage() { ...@@ -45,13 +45,13 @@ public function testSettingsPage() {
} }
// Check for our test processor settings form. // Check for our test processor settings form.
$this->assertText(t('Dummy length setting')); $this->assertText('Dummy length setting');
// Change its value to ensure that settingsSubmit is called. // Change its value to ensure that settingsSubmit is called.
$edit = [ $edit = [
'dummy_length' => 100, 'dummy_length' => 100,
]; ];
$this->drupalPostForm('admin/config/services/aggregator/settings', $edit, t('Save configuration')); $this->drupalPostForm('admin/config/services/aggregator/settings', $edit, t('Save configuration'));
$this->assertText(t('The configuration options have been saved.')); $this->assertText('The configuration options have been saved.');
$this->assertSession()->fieldValueEquals('dummy_length', 100); $this->assertSession()->fieldValueEquals('dummy_length', 100);
// Make sure settings form is still accessible even after uninstalling a module // Make sure settings form is still accessible even after uninstalling a module
......
...@@ -75,7 +75,7 @@ protected function setUp() { ...@@ -75,7 +75,7 @@ protected function setUp() {
public function createFeed($feed_url = NULL, array $edit = []) { public function createFeed($feed_url = NULL, array $edit = []) {
$edit = $this->getFeedEditArray($feed_url, $edit); $edit = $this->getFeedEditArray($feed_url, $edit);
$this->drupalPostForm('aggregator/sources/add', $edit, t('Save')); $this->drupalPostForm('aggregator/sources/add', $edit, t('Save'));
$this->assertText(t('The feed @name has been added.', ['@name' => $edit['title[0][value]']]), new FormattableMarkup('The feed @name has been added.', ['@name' => $edit['title[0][value]']])); $this->assertText('The feed ' . Html::escape($edit['title[0][value]']) . ' has been added.', new FormattableMarkup('The feed @name has been added.', ['@name' => $edit['title[0][value]']]));
// Verify that the creation message contains a link to a feed. // Verify that the creation message contains a link to a feed.
$this->assertSession()->elementExists('xpath', '//div[@data-drupal-messages]//a[contains(@href, "aggregator/sources/")]'); $this->assertSession()->elementExists('xpath', '//div[@data-drupal-messages]//a[contains(@href, "aggregator/sources/")]');
......
...@@ -74,7 +74,7 @@ public function validateImportFormFields() { ...@@ -74,7 +74,7 @@ public function validateImportFormFields() {
$edit = ['remote' => 'invalidUrl://empty']; $edit = ['remote' => 'invalidUrl://empty'];
$this->drupalPostForm('admin/config/services/aggregator/add/opml', $edit, t('Import')); $this->drupalPostForm('admin/config/services/aggregator/add/opml', $edit, t('Import'));
$this->assertText(t('The URL invalidUrl://empty is not valid.'), 'Error if the URL is invalid.'); $this->assertText('The URL invalidUrl://empty is not valid.', 'Error if the URL is invalid.');
$after = $count_query->execute(); $after = $count_query->execute();
$this->assertEqual($before, $after, 'No feeds were added during the three last form submissions.'); $this->assertEqual($before, $after, 'No feeds were added during the three last form submissions.');
...@@ -89,11 +89,11 @@ protected function submitImportForm() { ...@@ -89,11 +89,11 @@ protected function submitImportForm() {
$form['files[upload]'] = $this->getInvalidOpml(); $form['files[upload]'] = $this->getInvalidOpml();
$this->drupalPostForm('admin/config/services/aggregator/add/opml', $form, t('Import')); $this->drupalPostForm('admin/config/services/aggregator/add/opml', $form, t('Import'));
$this->assertText(t('No new feed has been added.'), 'Attempting to upload invalid XML.'); $this->assertText('No new feed has been added.', 'Attempting to upload invalid XML.');
$edit = ['remote' => file_create_url($this->getEmptyOpml())]; $edit = ['remote' => file_create_url($this->getEmptyOpml())];
$this->drupalPostForm('admin/config/services/aggregator/add/opml', $edit, t('Import')); $this->drupalPostForm('admin/config/services/aggregator/add/opml', $edit, t('Import'));
$this->assertText(t('No new feed has been added.'), 'Attempting to load empty OPML from remote URL.'); $this->assertText('No new feed has been added.', 'Attempting to load empty OPML from remote URL.');
$after = $count_query->execute(); $after = $count_query->execute();
$this->assertEqual($before, $after, 'No feeds were added during the two last form submissions.'); $this->assertEqual($before, $after, 'No feeds were added during the two last form submissions.');
......
...@@ -44,7 +44,7 @@ public function testUpdateFeedItem() { ...@@ -44,7 +44,7 @@ public function testUpdateFeedItem() {
$this->assertSession()->statusCodeEquals(200); $this->assertSession()->statusCodeEquals(200);
$this->drupalPostForm('aggregator/sources/add', $edit, t('Save')); $this->drupalPostForm('aggregator/sources/add', $edit, t('Save'));
$this->assertText(t('The feed @name has been added.', ['@name' => $edit['title[0][value]']]), new FormattableMarkup('The feed @name has been added.', ['@name' => $edit['title[0][value]']])); $this->assertText('The feed ' . $edit['title[0][value]'] . ' has been added.', new FormattableMarkup('The feed @name has been added.', ['@name' => $edit['title[0][value]']]));
// Verify that the creation message contains a link to a feed. // Verify that the creation message contains a link to a feed.
$this->assertSession()->elementExists('xpath', '//div[@data-drupal-messages]//a[contains(@href, "aggregator/sources/")]'); $this->assertSession()->elementExists('xpath', '//div[@data-drupal-messages]//a[contains(@href, "aggregator/sources/")]');
......
...@@ -32,7 +32,7 @@ public function testUpdateFeed() { ...@@ -32,7 +32,7 @@ public function testUpdateFeed() {
$edit[$same_field] = $feed->{$same_field}->value; $edit[$same_field] = $feed->{$same_field}->value;
} }
$this->drupalPostForm('aggregator/sources/' . $feed->id() . '/configure', $edit, t('Save')); $this->drupalPostForm('aggregator/sources/' . $feed->id() . '/configure', $edit, t('Save'));
$this->assertText(t('The feed @name has been updated.', ['@name' => $edit['title[0][value]']]), new FormattableMarkup('The feed %name has been updated.', ['%name' => $edit['title[0][value]']])); $this->assertText('The feed ' . $edit['title[0][value]'] . ' has been updated.', new FormattableMarkup('The feed %name has been updated.', ['%name' => $edit['title[0][value]']]));
// Verify that the creation message contains a link to a feed. // Verify that the creation message contains a link to a feed.
$this->assertSession()->elementExists('xpath', '//div[@data-drupal-messages]//a[contains(@href, "aggregator/sources/")]'); $this->assertSession()->elementExists('xpath', '//div[@data-drupal-messages]//a[contains(@href, "aggregator/sources/")]');
......
...@@ -47,25 +47,25 @@ public function testIPAddressValidation() { ...@@ -47,25 +47,25 @@ public function testIPAddressValidation() {
$edit = []; $edit = [];
$edit['ip'] = '1.2.3.3'; $edit['ip'] = '1.2.3.3';
$this->drupalPostForm('admin/config/people/ban', $edit, t('Add')); $this->drupalPostForm('admin/config/people/ban', $edit, t('Add'));
$this->assertText(t('This IP address is already banned.')); $this->assertText('This IP address is already banned.');
// Try to block a reserved IP address. // Try to block a reserved IP address.
$edit = []; $edit = [];
$edit['ip'] = '255.255.255.255'; $edit['ip'] = '255.255.255.255';
$this->drupalPostForm('admin/config/people/ban', $edit, t('Add')); $this->drupalPostForm('admin/config/people/ban', $edit, t('Add'));
$this->assertText(t('Enter a valid IP address.')); $this->assertText('Enter a valid IP address.');
// Try to block a reserved IP address. // Try to block a reserved IP address.
$edit = []; $edit = [];
$edit['ip'] = 'test.example.com'; $edit['ip'] = 'test.example.com';
$this->drupalPostForm('admin/config/people/ban', $edit, t('Add')); $this->drupalPostForm('admin/config/people/ban', $edit, t('Add'));
$this->assertText(t('Enter a valid IP address.')); $this->assertText('Enter a valid IP address.');
// Submit an empty form. // Submit an empty form.
$edit = []; $edit = [];
$edit['ip'] = ''; $edit['ip'] = '';
$this->drupalPostForm('admin/config/people/ban', $edit, t('Add')); $this->drupalPostForm('admin/config/people/ban', $edit, t('Add'));
$this->assertText(t('Enter a valid IP address.')); $this->assertText('Enter a valid IP address.');
// Pass an IP address as a URL parameter and submit it. // Pass an IP address as a URL parameter and submit it.
$submit_ip = '1.2.3.4'; $submit_ip = '1.2.3.4';
...@@ -80,7 +80,7 @@ public function testIPAddressValidation() { ...@@ -80,7 +80,7 @@ public function testIPAddressValidation() {
// $edit = array(); // $edit = array();
// $edit['ip'] = \Drupal::request()->getClientIP(); // $edit['ip'] = \Drupal::request()->getClientIP();
// $this->drupalPostForm('admin/config/people/ban', $edit, t('Save')); // $this->drupalPostForm('admin/config/people/ban', $edit, t('Save'));
// $this->assertText(t('You may not ban your own IP address.')); // $this->assertText('You may not ban your own IP address.');
// Test duplicate ip address are not present in the 'blocked_ips' table. // Test duplicate ip address are not present in the 'blocked_ips' table.
// when they are entered programmatically. // when they are entered programmatically.
......
...@@ -49,7 +49,7 @@ public function testCachePerPage() { ...@@ -49,7 +49,7 @@ public function testCachePerPage() {
// form. // form.
$this->drupalPostForm(NULL, $form_values, t('Submit')); $this->drupalPostForm(NULL, $form_values, t('Submit'));
$this->assertSession()->addressEquals('test-page'); $this->assertSession()->addressEquals('test-page');
$this->assertText(t('Your email address is @email', ['@email' => 'test@example.com'])); $this->assertText('Your email address is test@example.com');
// Go to a different page and see if the block is enabled there as well. // Go to a different page and see if the block is enabled there as well.
$this->drupalGet('test-render-title'); $this->drupalGet('test-render-title');
...@@ -61,7 +61,7 @@ public function testCachePerPage() { ...@@ -61,7 +61,7 @@ public function testCachePerPage() {
// /test-render-title. // /test-render-title.
$this->drupalPostForm(NULL, $form_values, t('Submit')); $this->drupalPostForm(NULL, $form_values, t('Submit'));
$this->assertSession()->addressEquals('test-render-title'); $this->assertSession()->addressEquals('test-render-title');
$this->assertText(t('Your email address is @email', ['@email' => 'test@example.com'])); $this->assertText('Your email address is test@example.com');
} }
/** /**
......
...@@ -68,7 +68,7 @@ public function testBlockLinks() { ...@@ -68,7 +68,7 @@ public function testBlockLinks() {
$edit['label'] = $this->randomMachineName(); $edit['label'] = $this->randomMachineName();
$edit['id'] = mb_strtolower($edit['label']); $edit['id'] = mb_strtolower($edit['label']);
$this->drupalPostForm('admin/structure/menu/add', $edit, t('Save')); $this->drupalPostForm('admin/structure/menu/add', $edit, t('Save'));
$this->assertText(t('Menu @label has been added.', ['@label' => $edit['label']])); $this->assertText('Menu ' . $edit['label'] . ' has been added.');
// Check that the block is listed for all languages. // Check that the block is listed for all languages.
foreach ($this->langcodes as $langcode) { foreach ($this->langcodes as $langcode) {
......
...@@ -200,7 +200,7 @@ public function testBlock() { ...@@ -200,7 +200,7 @@ public function testBlock() {
// Set block title to confirm that interface works and override any custom titles. // 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']], t('Save block')); $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']], t('Save block'));
$this->assertText(t('The block configuration has been saved.'), 'Block title set.'); $this->assertText('The block configuration has been saved.', 'Block title set.');
// Check to see if the block was created by checking its configuration. // Check to see if the block was created by checking its configuration.
$instance = Block::load($block['id']); $instance = Block::load($block['id']);
...@@ -216,7 +216,7 @@ public function testBlock() { ...@@ -216,7 +216,7 @@ public function testBlock() {
$this->clickLink('Disable'); $this->clickLink('Disable');
// Confirm that the block is now listed as disabled. // Confirm that the block is now listed as disabled.
$this->assertText(t('The block settings have been updated.'), 'Block successfully moved to disabled region.'); $this->assertText('The block settings have been updated.', 'Block successfully moved to disabled region.');
// Confirm that the block instance title and markup are not displayed. // Confirm that the block instance title and markup are not displayed.
$this->drupalGet('node'); $this->drupalGet('node');
...@@ -260,7 +260,7 @@ public function testBlockThemeSelector() { ...@@ -260,7 +260,7 @@ public function testBlockThemeSelector() {
$block['theme'] = $theme; $block['theme'] = $theme;
$block['region'] = 'content'; $block['region'] = 'content';
$this->drupalPostForm('admin/structure/block/add/system_powered_by_block', $block, t('Save block')); $this->drupalPostForm('admin/structure/block/add/system_powered_by_block', $block, t('Save block'));
$this->assertText(t('The block configuration has been saved.')); $this->assertText('The block configuration has been saved.');
$this->assertSession()->addressEquals('admin/structure/block/list/' . $theme . '?block-placement=' . Html::getClass($block['id'])); $this->assertSession()->addressEquals('admin/structure/block/list/' . $theme . '?block-placement=' . Html::getClass($block['id']));
// Set the default theme and ensure the block is placed. // Set the default theme and ensure the block is placed.
...@@ -341,11 +341,11 @@ public function moveBlockToRegion(array $block, $region) { ...@@ -341,11 +341,11 @@ public function moveBlockToRegion(array $block, $region) {
$this->drupalPostForm('admin/structure/block', $edit, t('Save blocks')); $this->drupalPostForm('admin/structure/block', $edit, t('Save blocks'));
// Confirm that the block was moved to the proper region. // Confirm that the block was moved to the proper region.
$this->assertText(t('The block settings have been updated.'), new FormattableMarkup('Block successfully moved to %region_name region.', ['%region_name' => $region])); $this->assertText('The block settings have been updated.', new FormattableMarkup('Block successfully moved to %region_name region.', ['%region_name' => $region]));
// Confirm that the block is being displayed. // Confirm that the block is being displayed.
$this->drupalGet(''); $this->drupalGet('');
$this->assertText(t($block['settings[label]']), 'Block successfully being displayed on the page.'); $this->assertText($block['settings[label]'], 'Block successfully being displayed on the page.');
// Confirm that the custom block was found at the proper region. // Confirm that the custom block was found at the proper region.
$xpath = $this->assertSession()->buildXPathQuery('//div[@class=:region-class]//div[@id=:block-id]/*', [ $xpath = $this->assertSession()->buildXPathQuery('//div[@class=:region-class]//div[@id=:block-id]/*', [
......
...@@ -252,7 +252,7 @@ public function testBlockDelete() { ...@@ -252,7 +252,7 @@ public function testBlockDelete() {
// Delete the block. // Delete the block.
$this->drupalGet('block/1/delete'); $this->drupalGet('block/1/delete');
$this->assertText(\Drupal::translation()->formatPlural(1, 'This will also remove 1 placed block instance.', 'This will also remove @count placed block instance.')); $this->assertText('This will also remove 1 placed block instance.');
$this->drupalPostForm(NULL, [], 'Delete'); $this->drupalPostForm(NULL, [], 'Delete');
$this->assertRaw(t('The custom block %name has been deleted.', ['%name' => $edit['info[0][value]']])); $this->assertRaw(t('The custom block %name has been deleted.', ['%name' => $edit['info[0][value]']]));
......
...@@ -113,7 +113,7 @@ public function testListing() { ...@@ -113,7 +113,7 @@ public function testListing() {
$this->assertSession()->elementTextNotContains('xpath', '//td', $new_label); $this->assertSession()->elementTextNotContains('xpath', '//td', $new_label);
// Confirm that the empty text is displayed. // Confirm that the empty text is displayed.
$this->assertText(t('There are no custom blocks yet.')); $this->assertText('There are no custom blocks yet.');
$block_content = BlockContent::create([ $block_content = BlockContent::create([
'info' => 'Non-reusable block', 'info' => 'Non-reusable block',
......
...@@ -174,7 +174,7 @@ public function testBlockContentTypeDeletion() { ...@@ -174,7 +174,7 @@ public function testBlockContentTypeDeletion() {
$this->assertRaw( $this->assertRaw(
t('Are you sure you want to delete the custom block type %type?', ['%type' => $type->id()]) t('Are you sure you want to delete the custom block type %type?', ['%type' => $type->id()])
); );
$this->assertText(t('This action cannot be undone.'), 'The custom block type deletion confirmation form is available.'); $this->assertText('This action cannot be undone.', 'The custom block type deletion confirmation form is available.');
} }
/** /**
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
namespace Drupal\Tests\block_content\Functional; namespace Drupal\Tests\block_content\Functional;
use Drupal\Component\Render\FormattableMarkup;
use Drupal\block_content\Entity\BlockContent; use Drupal\block_content\Entity\BlockContent;
/** /**
...@@ -70,7 +69,7 @@ public function testPageEdit() { ...@@ -70,7 +69,7 @@ public function testPageEdit() {
// Test deleting the block. // Test deleting the block.
$this->drupalGet("block/" . $revised_block->id()); $this->drupalGet("block/" . $revised_block->id());
$this->clickLink(t('Delete')); $this->clickLink(t('Delete'));
$this->assertText(new FormattableMarkup('Are you sure you want to delete the custom block @label?', ['@label' => $revised_block->label()])); $this->assertText('Are you sure you want to delete the custom block ' . $revised_block->label() . '?');
} }
} }
...@@ -162,7 +162,7 @@ public function testEmptyBook() { ...@@ -162,7 +162,7 @@ public function testEmptyBook() {
// Log in as a user with access to the book outline and save the form. // Log in as a user with access to the book outline and save the form.
$this->drupalLogin($this->adminUser); $this->drupalLogin($this->adminUser);
$this->drupalPostForm('admin/structure/book/' . $book->id(), [], t('Save book pages')); $this->drupalPostForm('admin/structure/book/' . $book->id(), [], t('Save book pages'));
$this->assertText(t('Updated book @book.', ['@book' => $book->label()])); $this->assertText('Updated book ' . $book->label() . '.');
} }
/** /**
...@@ -298,7 +298,7 @@ public function testBookNavigationBlock() { ...@@ -298,7 +298,7 @@ public function testBookNavigationBlock() {
$edit = []; $edit = [];
$edit[RoleInterface::ANONYMOUS_ID . '[node test view]'] = TRUE; $edit[RoleInterface::ANONYMOUS_ID . '[node test view]'] = TRUE;
$this->drupalPostForm('admin/people/permissions/' . RoleInterface::ANONYMOUS_ID, $edit, t('Save permissions')); $this->drupalPostForm('admin/people/permissions/' . RoleInterface::ANONYMOUS_ID, $edit, t('Save permissions'));
$this->assertText(t('The changes have been saved.'), "Permission 'node test view' successfully assigned to anonymous users."); $this->assertText('The changes have been saved.', "Permission 'node test view' successfully assigned to anonymous users.");
// Test correct display of the block. // Test correct display of the block.
$nodes = $this->createBook(); $nodes = $this->createBook();
...@@ -396,7 +396,7 @@ public function testNavigationBlockOnAccessModuleInstalled() { ...@@ -396,7 +396,7 @@ public function testNavigationBlockOnAccessModuleInstalled() {
$edit = []; $edit = [];
$edit[RoleInterface::ANONYMOUS_ID . '[node test view]'] = TRUE; $edit[RoleInterface::ANONYMOUS_ID . '[node test view]'] = TRUE;
$this->drupalPostForm('admin/people/permissions/' . RoleInterface::ANONYMOUS_ID, $edit, t('Save permissions')); $this->drupalPostForm('admin/people/permissions/' . RoleInterface::ANONYMOUS_ID, $edit, t('Save permissions'));
$this->assertText(t('The changes have been saved.'), "Permission 'node test view' successfully assigned to anonymous users."); $this->assertText('The changes have been saved.', "Permission 'node test view' successfully assigned to anonymous users.");
// Create a book. // Create a book.
$this->createBook(); $this->createBook();
......
...@@ -42,7 +42,7 @@ public function testApprovalAdminInterface() { ...@@ -42,7 +42,7 @@ public function testApprovalAdminInterface() {
// Test that the comments page loads correctly when there are no comments // Test that the comments page loads correctly when there are no comments
$this->drupalGet('admin/content/comment'); $this->drupalGet('admin/content/comment');
$this->assertText(t('No comments available.')); $this->assertText('No comments available.');
$this->drupalLogout(); $this->drupalLogout();
...@@ -51,7 +51,7 @@ public function testApprovalAdminInterface() { ...@@ -51,7 +51,7 @@ public function testApprovalAdminInterface() {
$body = $this->randomMachineName(); $body = $this->randomMachineName();
// Set $contact to true so that it won't check for id and message. // Set $contact to true so that it won't check for id and message.
$this->postComment($this->node, $body, $subject, TRUE); $this->postComment($this->node, $body, $subject, TRUE);
$this->assertText(t('Your comment has been queued for review by site administrators and will be published after approval.'), 'Comment requires approval.'); $this->assertText('Your comment has been queued for review by site administrators and will be published after approval.', 'Comment requires approval.');
// Get unapproved comment id. // Get unapproved comment id.
$this->drupalLogin($this->adminUser); $this->drupalLogin($this->adminUser);
...@@ -83,13 +83,13 @@ public function testApprovalAdminInterface() { ...@@ -83,13 +83,13 @@ public function testApprovalAdminInterface() {
// Publish multiple comments in one operation. // Publish multiple comments in one operation.
$this->drupalLogin($this->adminUser); $this->drupalLogin($this->adminUser);
$this->drupalGet('admin/content/comment/approval'); $this->drupalGet('admin/content/comment/approval');
$this->assertText(t('Unapproved comments (@count)', ['@count' => 2]), 'Two unapproved comments waiting for approval.'); $this->assertText('Unapproved comments (2)', 'Two unapproved comments waiting for approval.');
$edit = [ $edit = [
"comments[{$comments[0]->id()}]" => 1, "comments[{$comments[0]->id()}]" => 1,
"comments[{$comments[1]->id()}]" => 1, "comments[{$comments[1]->id()}]" => 1,
]; ];
$this->drupalPostForm(NULL, $edit, t('Update')); $this->drupalPostForm(NULL, $edit, t('Update'));
$this->assertText(t('Unapproved comments (@count)', ['@count' => 0]), 'All comments were approved.'); $this->assertText('Unapproved comments (0)', 'All comments were approved.');
// Delete multiple comments in one operation. // Delete multiple comments in one operation.
$edit = [ $edit = [
...@@ -99,15 +99,15 @@ public function testApprovalAdminInterface() { ...@@ -99,15 +99,15 @@ public function testApprovalAdminInterface() {
"comments[{$anonymous_comment4->id()}]" => 1, "comments[{$anonymous_comment4->id()}]" => 1,
]; ];
$this->drupalPostForm(NULL, $edit, t('Update')); $this->drupalPostForm(NULL, $edit, t('Update'));
$this->assertText(t('Are you sure you want to delete these comments and all their children?'), 'Confirmation required.'); $this->assertText('Are you sure you want to delete these comments and all their children?', 'Confirmation required.');
$this->drupalPostForm(NULL, [], t('Delete')); $this->drupalPostForm(NULL, [], t('Delete'));
$this->assertText(t('No comments available.'), 'All comments were deleted.'); $this->assertText('No comments available.', 'All comments were deleted.');
// Test message when no comments selected. // Test message when no comments selected.
$edit = [ $edit = [
'operation' => 'delete', 'operation' => 'delete',
]; ];
$this->drupalPostForm(NULL, $edit, t('Update')); $this->drupalPostForm(NULL, $edit, t('Update'));
$this->assertText(t('Select one or more comments to perform the update on.')); $this->assertText('Select one or more comments to perform the update on.');
// Make sure the label of unpublished node is not visible on listing page. // Make sure the label of unpublished node is not visible on listing page.
$this->drupalGet('admin/content/comment'); $this->drupalGet('admin/content/comment');
...@@ -139,7 +139,7 @@ public function testApprovalNodeInterface() { ...@@ -139,7 +139,7 @@ public function testApprovalNodeInterface() {
$body = $this->randomMachineName(); $body = $this->randomMachineName();
// Set $contact to true so that it won't check for id and message. // Set $contact to true so that it won't check for id and message.
$this->postComment($this->node, $body, $subject, TRUE);