Unverified Commit a44a9b1c authored by larowlan's avatar larowlan
Browse files

Issue #3159230 by mondrake, sandeep_jangra, ravi.shankar, naresh_bavaskar,...

Issue #3159230 by mondrake, sandeep_jangra, ravi.shankar, naresh_bavaskar, larowlan, longwave: AssertLegacyTrait::assert(No)Raw() in functional tests still have a message passed in
parent 97cff664
......@@ -83,7 +83,7 @@ public function testActionConfiguration() {
$this->assertSession()->statusCodeEquals(200);
// Make sure that the action was actually deleted.
$this->assertRaw(t('The action %action has been deleted.', ['%action' => $new_action_label]), 'Make sure that we get a delete confirmation message.');
$this->assertRaw(t('The action %action has been deleted.', ['%action' => $new_action_label]));
$this->drupalGet('admin/config/system/actions');
$this->assertSession()->statusCodeEquals(200);
$this->assertNoText($new_action_label, "Make sure the action label does not appear on the overview page after we've deleted the action.");
......
......@@ -93,7 +93,7 @@ public function createFeed($feed_url = NULL, array $edit = []) {
*/
public function deleteFeed(FeedInterface $feed) {
$this->drupalPostForm('aggregator/sources/' . $feed->id() . '/delete', [], t('Delete'));
$this->assertRaw(t('The feed %title has been deleted.', ['%title' => $feed->label()]), 'Feed deleted successfully.');
$this->assertRaw(t('The feed %title has been deleted.', ['%title' => $feed->label()]));
}
/**
......@@ -213,7 +213,7 @@ public function updateFeedItems(FeedInterface $feed, $expected_count = NULL) {
*/
public function deleteFeedItems(FeedInterface $feed) {
$this->drupalPostForm('admin/config/services/aggregator/delete/' . $feed->id(), [], t('Delete items'));
$this->assertRaw(t('The news items from %title have been deleted.', ['%title' => $feed->label()]), 'Feed items deleted.');
$this->assertRaw(t('The news items from %title have been deleted.', ['%title' => $feed->label()]));
}
/**
......
......@@ -62,7 +62,7 @@ public function validateImportFormFields() {
$edit = [];
$this->drupalPostForm('admin/config/services/aggregator/add/opml', $edit, t('Import'));
$this->assertRaw(t('<em>Either</em> upload a file or enter a URL.'), 'Error if no fields are filled.');
$this->assertRaw(t('<em>Either</em> upload a file or enter a URL.'));
$path = $this->getEmptyOpml();
$edit = [
......@@ -70,7 +70,7 @@ public function validateImportFormFields() {
'remote' => file_create_url($path),
];
$this->drupalPostForm('admin/config/services/aggregator/add/opml', $edit, t('Import'));
$this->assertRaw(t('<em>Either</em> upload a file or enter a URL.'), 'Error if both fields are filled.');
$this->assertRaw(t('<em>Either</em> upload a file or enter a URL.'));
$edit = ['remote' => 'invalidUrl://empty'];
$this->drupalPostForm('admin/config/services/aggregator/add/opml', $edit, t('Import'));
......@@ -110,8 +110,10 @@ protected function submitImportForm() {
'refresh' => '900',
];
$this->drupalPostForm('admin/config/services/aggregator/add/opml', $edit, t('Import'));
$this->assertRaw(t('A feed with the URL %url already exists.', ['%url' => $feeds[0]['url[0][value]']]), 'Verifying that a duplicate URL was identified');
$this->assertRaw(t('A feed named %title already exists.', ['%title' => $feeds[1]['title[0][value]']]), 'Verifying that a duplicate title was identified');
// Verify that a duplicate URL was identified.
$this->assertRaw(t('A feed with the URL %url already exists.', ['%url' => $feeds[0]['url[0][value]']]));
// Verify that a duplicate title was identified.
$this->assertRaw(t('A feed named %title already exists.', ['%title' => $feeds[1]['title[0][value]']]));
$after = $count_query->execute();
$this->assertEqual($after, 2, 'Verifying that two distinct feeds were added.');
......
......@@ -41,7 +41,7 @@ public function testIPAddressValidation() {
$this->drupalPostForm('admin/config/people/ban', $edit, t('Add'));
$ip = $connection->select('ban_ip', 'bi')->fields('bi', ['iid'])->condition('ip', $edit['ip'])->execute()->fetchField();
$this->assertNotEmpty($ip, 'IP address found in database.');
$this->assertRaw(t('The IP address %ip has been banned.', ['%ip' => $edit['ip']]), 'IP address was banned.');
$this->assertRaw(t('The IP address %ip has been banned.', ['%ip' => $edit['ip']]));
// Try to block an IP address that's already blocked.
$edit = [];
......@@ -72,7 +72,7 @@ public function testIPAddressValidation() {
$this->drupalPostForm('admin/config/people/ban/' . $submit_ip, [], t('Add'));
$ip = $connection->select('ban_ip', 'bi')->fields('bi', ['iid'])->condition('ip', $submit_ip)->execute()->fetchField();
$this->assertNotEmpty($ip, 'IP address found in database');
$this->assertRaw(t('The IP address %ip has been banned.', ['%ip' => $submit_ip]), 'IP address was banned.');
$this->assertRaw(t('The IP address %ip has been banned.', ['%ip' => $submit_ip]));
// Submit your own IP address. This fails, although it works when testing
// manually.
......
......@@ -184,7 +184,7 @@ public function testBigPipe() {
1 => $cases['html']->bigPipePlaceholderId,
]);
$this->assertRaw('</body>', 'Closing body tag present.');
$this->assertRaw('</body>');
// Verifying BigPipe assets are present.
$this->assertFalse(empty($this->getDrupalSettings()), 'drupalSettings present.');
......@@ -213,8 +213,9 @@ public function testBigPipe() {
// The 'edge_case__html_exception' case throws an exception.
$this->assertRaw('The website encountered an unexpected error. Please try again later');
$this->assertRaw('You are not allowed to say llamas are not cool!');
$this->assertNoRaw(BigPipe::STOP_SIGNAL, 'BigPipe stop signal absent: error occurred before then.');
$this->assertNoRaw('</body>', 'Closing body tag absent: error occurred before then.');
// Check that stop signal and closing body tag are absent.
$this->assertNoRaw(BigPipe::STOP_SIGNAL);
$this->assertNoRaw('</body>');
// The exception is expected. Do not interpret it as a test failure.
unlink($this->root . '/' . $this->siteDirectory . '/error.log');
}
......@@ -264,12 +265,12 @@ public function testBigPipeNoJs() {
// Verifying there are no BigPipe placeholders & replacements.
$this->assertSession()->responseHeaderEquals('BigPipe-Test-Placeholders', '<none>');
// Verifying BigPipe start/stop signals are absent.
$this->assertNoRaw(BigPipe::START_SIGNAL, 'BigPipe start signal absent.');
$this->assertNoRaw(BigPipe::STOP_SIGNAL, 'BigPipe stop signal absent.');
$this->assertNoRaw(BigPipe::START_SIGNAL);
$this->assertNoRaw(BigPipe::STOP_SIGNAL);
// Verifying BigPipe assets are absent.
$this->assertTrue(!isset($this->getDrupalSettings()['bigPipePlaceholderIds']) && empty($this->getDrupalSettings()['ajaxPageState']), 'BigPipe drupalSettings and BigPipe asset library absent.');
$this->assertRaw('</body>', 'Closing body tag present.');
$this->assertRaw('</body>');
// Verify that 4xx responses work fine. (4xx responses are handled by
// subrequests to a route pointing to a controller with the desired output.)
......@@ -283,7 +284,7 @@ public function testBigPipeNoJs() {
// The 'edge_case__html_exception' case throws an exception.
$this->assertRaw('The website encountered an unexpected error. Please try again later');
$this->assertRaw('You are not allowed to say llamas are not cool!');
$this->assertNoRaw('</body>', 'Closing body tag absent: error occurred before then.');
$this->assertNoRaw('</body>');
// The exception is expected. Do not interpret it as a test failure.
unlink($this->root . '/' . $this->siteDirectory . '/error.log');
}
......@@ -366,7 +367,7 @@ protected function assertBigPipePlaceholders(array $expected_big_pipe_placeholde
foreach ($expected_big_pipe_placeholders as $big_pipe_placeholder_id => $expected_ajax_response) {
// Verify expected placeholder.
$expected_placeholder_html = '<span data-big-pipe-placeholder-id="' . $big_pipe_placeholder_id . '"></span>';
$this->assertRaw($expected_placeholder_html, 'BigPipe placeholder for placeholder ID "' . $big_pipe_placeholder_id . '" found.');
$this->assertRaw($expected_placeholder_html);
$pos = strpos($this->getSession()->getPage()->getContent(), $expected_placeholder_html);
$placeholder_positions[$pos] = $big_pipe_placeholder_id;
// Verify expected placeholder replacement.
......@@ -397,8 +398,8 @@ protected function assertBigPipePlaceholders(array $expected_big_pipe_placeholde
$this->assertSame(count($expected_big_pipe_placeholders_with_replacements), preg_match_all('/' . preg_quote('<script type="application/vnd.drupal-ajax" data-big-pipe-replacement-for-placeholder-with-id="', '/') . '/', $this->getSession()->getPage()->getContent()));
// Verifying BigPipe start/stop signals.
$this->assertRaw(BigPipe::START_SIGNAL, 'BigPipe start signal present.');
$this->assertRaw(BigPipe::STOP_SIGNAL, 'BigPipe stop signal present.');
$this->assertRaw(BigPipe::START_SIGNAL);
$this->assertRaw(BigPipe::STOP_SIGNAL);
$start_signal_position = strpos($this->getSession()->getPage()->getContent(), BigPipe::START_SIGNAL);
$stop_signal_position = strpos($this->getSession()->getPage()->getContent(), BigPipe::STOP_SIGNAL);
$this->assertTrue($start_signal_position < $stop_signal_position, 'BigPipe start signal appears before stop signal.');
......@@ -491,7 +492,8 @@ protected function assertBigPipeNoJsMetaRefreshRedirect() {
$this->assertTrue(empty(array_diff(['cookies:big_pipe_nojs', 'session.exists'], explode(' ', $headers[0]['X-Drupal-Cache-Contexts'][0]))), 'The first response varies by the "cookies:big_pipe_nojs" and "session.exists" cache contexts.');
$this->assertEqual('no-store, content="BigPipe/1.0"', $headers[1]['Surrogate-Control'][0], 'The second response has a "Surrogate-Control" header.');
$this->assertNoRaw('<noscript><meta http-equiv="Refresh" content="0; URL=', 'Once the BigPipe no-JS cookie is set, the <meta> refresh is absent: only one redirect ever happens.');
// Check that the <meta> refresh is absent, only one redirect ever happens.
$this->assertNoRaw('<noscript><meta http-equiv="Refresh" content="0; URL=');
}
}
......@@ -49,11 +49,11 @@ public function testBlockInInvalidRegion() {
// Clearing the cache should disable the test block placed in the invalid region.
$this->drupalPostForm('admin/config/development/performance', [], 'Clear all caches');
$this->assertRaw($warning_message, 'Enabled block was in the invalid region and has been disabled.');
$this->assertRaw($warning_message);
// Clear the cache to check if the warning message is not triggered.
$this->drupalPostForm('admin/config/development/performance', [], 'Clear all caches');
$this->assertNoRaw($warning_message, 'Disabled block in the invalid region will not trigger the warning.');
$this->assertNoRaw($warning_message);
// Place disabled test block in the invalid region of the default theme.
\Drupal::configFactory()->getEditable('block.block.' . $block->id())->set('region', 'invalid_region')->save();
......@@ -61,7 +61,7 @@ public function testBlockInInvalidRegion() {
// Clear the cache to check if the warning message is not triggered.
$this->drupalPostForm('admin/config/development/performance', [], 'Clear all caches');
$this->assertNoRaw($warning_message, 'Disabled block in the invalid region will not trigger the warning.');
$this->assertNoRaw($warning_message);
}
}
......@@ -63,7 +63,7 @@ public function testBlockVisibility() {
// Confirm that an empty block is not displayed.
$this->assertNoText('Powered by Drupal', 'Empty block not displayed.');
$this->assertNoRaw('sidebar-first', 'Empty sidebar-first region is not displayed.');
$this->assertNoRaw('sidebar-first');
}
/**
......
......@@ -50,7 +50,8 @@ public function testXssInTitle() {
\Drupal::state()->set('block_test.content', $this->randomMachineName());
$this->drupalGet('');
$this->assertNoRaw('<script>alert("XSS label");</script>', 'The block title was properly sanitized when rendered.');
// Check that the block title was properly sanitized when rendered.
$this->assertNoRaw('<script>alert("XSS label");</script>');
$this->drupalLogin($this->drupalCreateUser([
'administer blocks',
......@@ -58,7 +59,9 @@ public function testXssInTitle() {
]));
$default_theme = $this->config('system.theme')->get('default');
$this->drupalGet('admin/structure/block/list/' . $default_theme);
$this->assertNoRaw("<script>alert('XSS subject');</script>", 'The block title was properly sanitized in Block Plugin UI Admin page.');
// Check that the block title was properly sanitized in Block Plugin UI
// Admin page.
$this->assertNoRaw("<script>alert('XSS subject');</script>");
}
/**
......@@ -88,7 +91,8 @@ public function testBlockXss() {
$this->drupalGet(Url::fromRoute('block.admin_display'));
$this->clickLink('Place block');
$this->assertNoRaw('&amp;lt;', 'The page does not have double escaped HTML tags.');
// Check that the page does not have double escaped HTML tags.
$this->assertNoRaw('&amp;lt;');
}
/**
......
......@@ -2,7 +2,6 @@
namespace Drupal\Tests\block\Functional\Views;
use Drupal\Component\Render\FormattableMarkup;
use Drupal\Component\Serialization\Json;
use Drupal\Component\Utility\Crypt;
use Drupal\Core\Site\Settings;
......@@ -385,8 +384,9 @@ public function testBlockContextualLinks() {
$cached_id = 'block:block=' . $cached_block->id() . ':langcode=en|entity.view.edit_form:view=test_view_block:location=block&name=test_view_block&display_id=block_1&langcode=en';
$cached_id_token = Crypt::hmacBase64($cached_id, Settings::getHashSalt() . $this->container->get('private_key')->get());
// @see \Drupal\contextual\Tests\ContextualDynamicContextTest:assertContextualLinkPlaceHolder()
$this->assertRaw('<div' . new Attribute(['data-contextual-id' => $id, 'data-contextual-token' => $id_token]) . '></div>', new FormattableMarkup('Contextual link placeholder with id @id exists.', ['@id' => $id]));
$this->assertRaw('<div' . new Attribute(['data-contextual-id' => $cached_id, 'data-contextual-token' => $cached_id_token]) . '></div>', new FormattableMarkup('Contextual link placeholder with id @id exists.', ['@id' => $cached_id]));
// Check existence of the contextual link placeholders.
$this->assertRaw('<div' . new Attribute(['data-contextual-id' => $id, 'data-contextual-token' => $id_token]) . '></div>');
$this->assertRaw('<div' . new Attribute(['data-contextual-id' => $cached_id, 'data-contextual-token' => $cached_id_token]) . '></div>');
// Get server-rendered contextual links.
// @see \Drupal\contextual\Tests\ContextualDynamicContextTest:renderContextualLinks()
......
......@@ -62,7 +62,7 @@ public function testBlockContentCreation() {
$this->assertRaw(new FormattableMarkup('@block %name has been created.', [
'@block' => 'basic',
'%name' => $edit['info[0][value]'],
]), 'Basic block created.');
]));
// Check that the view mode setting is hidden because only one exists.
$this->assertNoFieldByXPath('//select[@name="settings[view_mode]"]', NULL, 'View mode setting hidden because only one exists');
......@@ -111,7 +111,7 @@ public function testBlockContentCreationMultipleViewModes() {
$this->assertRaw(new FormattableMarkup('@block %name has been created.', [
'@block' => 'basic',
'%name' => $edit['info[0][value]'],
]), 'Basic block created.');
]));
// Save our block permanently
$this->drupalPostForm(NULL, ['region' => 'content'], t('Save block'));
......@@ -186,7 +186,7 @@ public function testDefaultBlockContentCreation() {
$this->assertRaw(new FormattableMarkup('@block %name has been created.', [
'@block' => 'basic',
'%name' => $edit['info[0][value]'],
]), 'Basic block created.');
]));
// Check that the block exists in the database.
$blocks = \Drupal::entityTypeManager()
......
......@@ -112,7 +112,7 @@ public function testBlockContentTypeEditing() {
// Verify that title and body fields are displayed.
$this->drupalGet('block/add/basic');
$this->assertRaw('Block description', 'Block info field was found.');
$this->assertRaw('Block description');
$this->assertNotEmpty($this->cssSelect('#edit-body-0-value'), 'Body field was found.');
// Change the block type name.
......@@ -132,7 +132,7 @@ public function testBlockContentTypeEditing() {
\Drupal::service('entity_field.manager')->clearCachedFieldDefinitions();
$this->drupalGet('block/add');
$this->assertRaw('Bar', 'New name was displayed.');
$this->assertRaw('Bar');
$this->clickLink('Bar');
// Verify that the original machine name was used in the URL.
$this->assertSession()->addressEquals(Url::fromRoute('block_content.add_form', ['block_content_type' => 'basic']));
......@@ -163,8 +163,7 @@ public function testBlockContentTypeDeletion() {
// Attempt to delete the block type, which should not be allowed.
$this->drupalGet('admin/structure/block/block-content/manage/' . $type->id() . '/delete');
$this->assertRaw(
t('%label is used by 1 custom block on your site. You can not remove this block type until you have removed all of the %label blocks.', ['%label' => $type->label()]),
'The block type will not be deleted until all blocks of that type are removed.'
t('%label is used by 1 custom block on your site. You can not remove this block type until you have removed all of the %label blocks.', ['%label' => $type->label()])
);
$this->assertNoText('This action cannot be undone.', 'The block type deletion confirmation form is not available.');
......@@ -173,8 +172,7 @@ public function testBlockContentTypeDeletion() {
// Attempt to delete the block type, which should now be allowed.
$this->drupalGet('admin/structure/block/block-content/manage/' . $type->id() . '/delete');
$this->assertRaw(
t('Are you sure you want to delete the custom block type %type?', ['%type' => $type->id()]),
'The block type is available for deletion.'
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.');
}
......
......@@ -231,7 +231,7 @@ public function testBookExport() {
// Make sure each part of the book is there.
foreach ($nodes as $node) {
$this->assertText($node->label(), 'Node title found in printer friendly version.');
$this->assertRaw($node->body->processed, 'Node body found in printer friendly version.');
$this->assertRaw($node->body->processed);
}
// Make sure we can't export an unsupported format.
......
......@@ -104,14 +104,14 @@ public function checkBookNode(EntityInterface $node, $nodes, $previous, $up, $ne
$url = $previous->toUrl();
$url->setOptions(['attributes' => ['rel' => ['prev'], 'title' => t('Go to previous page')]]);
$text = new FormattableMarkup('<b>‹</b> @label', ['@label' => $previous->label()]);
$this->assertRaw(Link::fromTextAndUrl($text, $url)->toString(), 'Previous page link found.');
$this->assertRaw(Link::fromTextAndUrl($text, $url)->toString());
}
if ($up) {
/** @var \Drupal\Core\Url $url */
$url = $up->toUrl();
$url->setOptions(['attributes' => ['title' => t('Go to parent page')]]);
$this->assertRaw(Link::fromTextAndUrl('Up', $url)->toString(), 'Up page link found.');
$this->assertRaw(Link::fromTextAndUrl('Up', $url)->toString());
}
if ($next) {
......@@ -119,7 +119,7 @@ public function checkBookNode(EntityInterface $node, $nodes, $previous, $up, $ne
$url = $next->toUrl();
$url->setOptions(['attributes' => ['rel' => ['next'], 'title' => t('Go to next page')]]);
$text = new FormattableMarkup('@label <b>›</b>', ['@label' => $next->label()]);
$this->assertRaw(Link::fromTextAndUrl($text, $url)->toString(), 'Next page link found.');
$this->assertRaw(Link::fromTextAndUrl($text, $url)->toString());
}
// Compute the expected breadcrumb.
......@@ -142,7 +142,7 @@ public function checkBookNode(EntityInterface $node, $nodes, $previous, $up, $ne
// Check printer friendly version.
$this->drupalGet('book/export/html/' . $node->id());
$this->assertText($node->label(), 'Printer friendly title found.');
$this->assertRaw($node->body->processed, 'Printer friendly body found.');
$this->assertRaw($node->body->processed);
$number++;
}
......
......@@ -100,11 +100,12 @@ public function testLoading() {
$this->assertCount(0, $format_selector, 'No text format selector exists on the page.');
$hidden_input = $this->xpath('//input[@type="hidden" and contains(@class, "editor")]');
$this->assertCount(0, $hidden_input, 'A single text format hidden input does not exist on the page.');
$this->assertNoRaw(drupal_get_path('module', 'ckeditor') . '/js/ckeditor.js', 'CKEditor glue JS is absent.');
// Verify that CKEditor glue JS is absent.
$this->assertNoRaw(drupal_get_path('module', 'ckeditor') . '/js/ckeditor.js');
// On pages where there would never be a text editor, CKEditor JS is absent.
$this->drupalGet('user');
$this->assertNoRaw(drupal_get_path('module', 'ckeditor') . '/js/ckeditor.js', 'CKEditor glue JS is absent.');
$this->assertNoRaw(drupal_get_path('module', 'ckeditor') . '/js/ckeditor.js');
// The normal user:
// - has access to 2 text formats;
......
......@@ -208,8 +208,10 @@ public function testOverrideAndResetScheme() {
$this->drupalPlaceBlock('system_branding_block', ['region' => 'header']);
$this->drupalGet('');
$this->assertNoRaw('files/color/bartik-', 'Make sure the color logo is not being used.');
$this->assertRaw('bartik/logo.svg', 'Make sure the original bartik logo exists.');
// Make sure the color logo is not being used.
$this->assertNoRaw('files/color/bartik-');
// Make sure the original bartik logo exists.
$this->assertRaw('bartik/logo.svg');
// Log in and set the color scheme to 'slate'.
$this->drupalLogin($this->bigUser);
......@@ -219,8 +221,10 @@ public function testOverrideAndResetScheme() {
// Visit the homepage and ensure color changes.
$this->drupalLogout();
$this->drupalGet('');
$this->assertRaw('files/color/bartik-', 'Make sure the color logo is being used.');
$this->assertNoRaw('bartik/logo.svg', 'Make sure the original bartik logo does not exist.');
// Make sure the color logo is being used.
$this->assertRaw('files/color/bartik-');
// Make sure the original bartik logo does not exist.
$this->assertNoRaw('bartik/logo.svg');
// Log in and set the color scheme back to default (delete config).
$this->drupalLogin($this->bigUser);
......@@ -230,8 +234,10 @@ public function testOverrideAndResetScheme() {
// Log out and ensure there is no color and we have the original logo.
$this->drupalLogout();
$this->drupalGet('');
$this->assertNoRaw('files/color/bartik-', 'Make sure the color logo is not being used.');
$this->assertRaw('bartik/logo.svg', 'Make sure the original bartik logo exists.');
// Make sure the color logo is not being used.
$this->assertNoRaw('files/color/bartik-');
// Make sure the original bartik logo exists.
$this->assertRaw('bartik/logo.svg');
}
}
......@@ -137,27 +137,27 @@ public function testAnonymous() {
// Make sure the user data appears correctly when editing the comment.
$this->drupalLogin($this->adminUser);
$this->drupalGet('comment/' . $anonymous_comment3->id() . '/edit');
$this->assertRaw($author_name, "The anonymous user's name is correct when editing the comment.");
$this->assertRaw($author_name);
$this->assertFieldByName('uid', '', 'The author field is empty (i.e. anonymous) when editing the comment.');
$this->assertRaw($author_mail, "The anonymous user's email address is correct when editing the comment.");
$this->assertRaw($author_mail);
// Unpublish comment.
$this->performCommentOperation($anonymous_comment3, 'unpublish');
$this->drupalGet('admin/content/comment/approval');
$this->assertRaw('comments[' . $anonymous_comment3->id() . ']', 'Comment was unpublished.');
$this->assertRaw('comments[' . $anonymous_comment3->id() . ']');
// Publish comment.
$this->performCommentOperation($anonymous_comment3, 'publish', TRUE);
$this->drupalGet('admin/content/comment');
$this->assertRaw('comments[' . $anonymous_comment3->id() . ']', 'Comment was published.');
$this->assertRaw('comments[' . $anonymous_comment3->id() . ']');
// Delete comment.
$this->performCommentOperation($anonymous_comment3, 'delete');
$this->drupalGet('admin/content/comment');
$this->assertNoRaw('comments[' . $anonymous_comment3->id() . ']', 'Comment was deleted.');
$this->assertNoRaw('comments[' . $anonymous_comment3->id() . ']');
$this->drupalLogout();
// Comment 3 was deleted.
......
......@@ -88,7 +88,7 @@ public function testRecentCommentBlock() {
for ($i = 0; $i < 10; $i++) {
$this->clickLink($comments[$i]->getSubject());
$this->assertText($comments[$i]->getSubject(), 'Comment link goes to correct page.');
$this->assertRaw('<link rel="canonical"', 'Canonical URL was found in the HTML head');
$this->assertRaw('<link rel="canonical"');
}
}
......
......@@ -115,7 +115,7 @@ public function testCommentClasses() {
// user (the viewer) was the author of the comment. We do this in Java-
// Script to prevent breaking the render cache.
$this->assertCount(1, $this->xpath('//*[contains(@class, "comment") and @data-comment-user-id="' . $case['comment_uid'] . '"]'), 'data-comment-user-id attribute is set on comment.');
$this->assertRaw(drupal_get_path('module', 'comment') . '/js/comment-by-viewer.js', 'drupal.comment-by-viewer library is present.');
$this->assertRaw(drupal_get_path('module', 'comment') . '/js/comment-by-viewer.js');
}
// Verify the unpublished class.
......
......@@ -238,7 +238,7 @@ public function performCommentOperation($comment, $operation, $approval = FALSE)
if ($operation == 'delete') {
$this->drupalPostForm(NULL, [], t('Delete'));
$this->assertRaw(\Drupal::translation()->formatPlural(1, 'Deleted 1 comment.', 'Deleted @count comments.'), new FormattableMarkup('Operation "@operation" was performed on comment.', ['@operation' => $operation]));
$this->assertRaw(\Drupal::translation()->formatPlural(1, 'Deleted 1 comment.', 'Deleted @count comments.'));
}
else {
$this->assertText(t('The update has been performed.'), new FormattableMarkup('Operation "@operation" was performed on comment.', ['@operation' => $operation]));
......@@ -313,17 +313,17 @@ public function testCommentFunctionality() {
// Unpublish the comment.
$this->performCommentOperation($comment1, 'unpublish');
$this->drupalGet('admin/content/comment/approval');
$this->assertRaw('comments[' . $comment1->id() . ']', 'Comment was unpublished.');
$this->assertRaw('comments[' . $comment1->id() . ']');
// Publish the comment.
$this->performCommentOperation($comment1, 'publish', TRUE);
$this->drupalGet('admin/content/comment');
$this->assertRaw('comments[' . $comment1->id() . ']', 'Comment was published.');
$this->assertRaw('comments[' . $comment1->id() . ']');
// Delete the comment.
$this->performCommentOperation($comment1, 'delete');
$this->drupalGet('admin/content/comment');
$this->assertNoRaw('comments[' . $comment1->id() . ']', 'Comment was deleted.');
$this->assertNoRaw('comments[' . $comment1->id() . ']');
// Post another comment.
$comment1 = $this->postComment($this->entity, $this->randomMachineName(), $this->randomMachineName());
......@@ -331,7 +331,7 @@ public function testCommentFunctionality() {
// Check that the comment was found.
$this->drupalGet('admin/content/comment');
$this->assertRaw('comments[' . $comment1->id() . ']', 'Comment was published.');
$this->assertRaw('comments[' . $comment1->id() . ']');
// Check that entity access applies to administrative page.
$this->assertText($this->entity->label(), 'Name of commented account found.');
......
......@@ -45,7 +45,7 @@ public function testCommentPaging() {
// Check the first page of the node, and confirm the correct comments are
// shown.
$this->drupalGet('node/' . $node->id());
$this->assertRaw(t('next'), 'Paging links found.');
$this->assertRaw(t('next'));
$this->assertTrue($this->commentExists($comments[0]), 'Comment 1 appears on page 1.');
$this->assertFalse($this->commentExists($comments[1]), 'Comment 2 does not appear on page 1.');
$this->assertFalse($this->commentExists($comments[2]), 'Comment 3 does not appear on page 1.');
......@@ -380,7 +380,7 @@ public function testTwoPagers() {
// Check the first page of the node, and confirm the correct comments are
// shown.
$this->drupalGet('node/' . $node->id());
$this->assertRaw(t('next'), 'Paging links found.');
$this->assertRaw(t('next'));
$this->assertRaw('Comment 1 on field comment');
$this->assertRaw('Comment 1 on field comment_2');
// Navigate to next page of field 1.
......
......@@ -72,13 +72,13 @@ public function testCommentRss() {
]));
$raw = '<comments>' . $this->node->toUrl('canonical', ['fragment' => 'comments', 'absolute' => TRUE])->toString() . '</comments>';
$this->assertRaw($raw, 'Comments as part of RSS feed.');
$this->assertRaw($raw);
// Hide comments from RSS feed and check presence.
$this->node->set('comment', CommentItemInterface::HIDDEN);
$this->node->save();
$this->drupalGet('rss.xml');
$this->assertNoRaw($raw, 'Hidden comments is not a part of RSS feed.');
$this->assertNoRaw($raw);
}
}
......@@ -364,7 +364,7 @@ public function performCommentOperation(CommentInterface $comment, $operation, $
if ($operation == 'delete') {
$this->drupalPostForm(NULL, [], t('Delete'));
$this->assertRaw(\Drupal::translation()->formatPlural(1, 'Deleted 1 comment.', 'Deleted @count comments.'), new FormattableMarkup('Operation "@operation" was performed on comment.', ['@operation' => $operation]));
$this->assertRaw(\Drupal::translation()->formatPlural(1, 'Deleted 1 comment.', 'Deleted @count comments.'));
}
else {
$this->assertText(t('The update has been performed.'), new FormattableMarkup('Operation "@operation" was performed on comment.', ['@operation' => $operation]));
......
......@@ -112,7 +112,7 @@ public function testCommentTypeEditing() {
$this->drupalPostForm('admin/structure/comment/manage/comment', $edit, t('Save'));