diff --git a/core/modules/action/tests/src/Functional/ConfigurationTest.php b/core/modules/action/tests/src/Functional/ConfigurationTest.php index 2a4a7452e2b..c2f98725820 100644 --- a/core/modules/action/tests/src/Functional/ConfigurationTest.php +++ b/core/modules/action/tests/src/Functional/ConfigurationTest.php @@ -83,7 +83,7 @@ class ConfigurationTest extends BrowserTestBase { $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."); diff --git a/core/modules/aggregator/tests/src/Functional/AggregatorTestBase.php b/core/modules/aggregator/tests/src/Functional/AggregatorTestBase.php index 505ed0093e3..a21f166654e 100644 --- a/core/modules/aggregator/tests/src/Functional/AggregatorTestBase.php +++ b/core/modules/aggregator/tests/src/Functional/AggregatorTestBase.php @@ -93,7 +93,7 @@ abstract class AggregatorTestBase extends BrowserTestBase { */ 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 @@ abstract class AggregatorTestBase extends BrowserTestBase { */ 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()])); } /** diff --git a/core/modules/aggregator/tests/src/Functional/ImportOpmlTest.php b/core/modules/aggregator/tests/src/Functional/ImportOpmlTest.php index 9368d31006c..37aafaa8514 100644 --- a/core/modules/aggregator/tests/src/Functional/ImportOpmlTest.php +++ b/core/modules/aggregator/tests/src/Functional/ImportOpmlTest.php @@ -62,7 +62,7 @@ class ImportOpmlTest extends AggregatorTestBase { $edit = []; $this->drupalPostForm('admin/config/services/aggregator/add/opml', $edit, t('Import')); - $this->assertRaw(t('Either upload a file or enter a URL.'), 'Error if no fields are filled.'); + $this->assertRaw(t('Either upload a file or enter a URL.')); $path = $this->getEmptyOpml(); $edit = [ @@ -70,7 +70,7 @@ class ImportOpmlTest extends AggregatorTestBase { 'remote' => file_create_url($path), ]; $this->drupalPostForm('admin/config/services/aggregator/add/opml', $edit, t('Import')); - $this->assertRaw(t('Either upload a file or enter a URL.'), 'Error if both fields are filled.'); + $this->assertRaw(t('Either 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 @@ class ImportOpmlTest extends AggregatorTestBase { '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.'); diff --git a/core/modules/ban/tests/src/Functional/IpAddressBlockingTest.php b/core/modules/ban/tests/src/Functional/IpAddressBlockingTest.php index eaa2b94c50b..04a9b75602f 100644 --- a/core/modules/ban/tests/src/Functional/IpAddressBlockingTest.php +++ b/core/modules/ban/tests/src/Functional/IpAddressBlockingTest.php @@ -41,7 +41,7 @@ class IpAddressBlockingTest extends BrowserTestBase { $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 @@ class IpAddressBlockingTest extends BrowserTestBase { $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. diff --git a/core/modules/big_pipe/tests/src/Functional/BigPipeTest.php b/core/modules/big_pipe/tests/src/Functional/BigPipeTest.php index 574a1557f73..c6ae925bd14 100644 --- a/core/modules/big_pipe/tests/src/Functional/BigPipeTest.php +++ b/core/modules/big_pipe/tests/src/Functional/BigPipeTest.php @@ -184,7 +184,7 @@ class BigPipeTest extends BrowserTestBase { 1 => $cases['html']->bigPipePlaceholderId, ]); - $this->assertRaw('', 'Closing body tag present.'); + $this->assertRaw(''); // Verifying BigPipe assets are present. $this->assertFalse(empty($this->getDrupalSettings()), 'drupalSettings present.'); @@ -213,8 +213,9 @@ class BigPipeTest extends BrowserTestBase { // 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('', '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(''); // The exception is expected. Do not interpret it as a test failure. unlink($this->root . '/' . $this->siteDirectory . '/error.log'); } @@ -264,12 +265,12 @@ class BigPipeTest extends BrowserTestBase { // Verifying there are no BigPipe placeholders & replacements. $this->assertSession()->responseHeaderEquals('BigPipe-Test-Placeholders', ''); // 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('', 'Closing body tag present.'); + $this->assertRaw(''); // 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 @@ class BigPipeTest extends BrowserTestBase { // 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('', 'Closing body tag absent: error occurred before then.'); + $this->assertNoRaw(''); // The exception is expected. Do not interpret it as a test failure. unlink($this->root . '/' . $this->siteDirectory . '/error.log'); } @@ -366,7 +367,7 @@ class BigPipeTest extends BrowserTestBase { foreach ($expected_big_pipe_placeholders as $big_pipe_placeholder_id => $expected_ajax_response) { // Verify expected placeholder. $expected_placeholder_html = ''; - $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 @@ class BigPipeTest extends BrowserTestBase { $this->assertSame(count($expected_big_pipe_placeholders_with_replacements), preg_match_all('/' . preg_quote('', 'The block title was properly sanitized when rendered.'); + // Check that the block title was properly sanitized when rendered. + $this->assertNoRaw(''); $this->drupalLogin($this->drupalCreateUser([ 'administer blocks', @@ -58,7 +59,9 @@ class BlockXssTest extends BrowserTestBase { ])); $default_theme = $this->config('system.theme')->get('default'); $this->drupalGet('admin/structure/block/list/' . $default_theme); - $this->assertNoRaw("", '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(""); } /** @@ -88,7 +91,8 @@ class BlockXssTest extends BrowserTestBase { $this->drupalGet(Url::fromRoute('block.admin_display')); $this->clickLink('Place block'); - $this->assertNoRaw('&lt;', 'The page does not have double escaped HTML tags.'); + // Check that the page does not have double escaped HTML tags. + $this->assertNoRaw('&lt;'); } /** diff --git a/core/modules/block/tests/src/Functional/Views/DisplayBlockTest.php b/core/modules/block/tests/src/Functional/Views/DisplayBlockTest.php index f04f35b1aaf..d799899a268 100644 --- a/core/modules/block/tests/src/Functional/Views/DisplayBlockTest.php +++ b/core/modules/block/tests/src/Functional/Views/DisplayBlockTest.php @@ -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 @@ class DisplayBlockTest extends ViewTestBase { $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(' $id, 'data-contextual-token' => $id_token]) . '>', new FormattableMarkup('Contextual link placeholder with id @id exists.', ['@id' => $id])); - $this->assertRaw(' $cached_id, 'data-contextual-token' => $cached_id_token]) . '>', new FormattableMarkup('Contextual link placeholder with id @id exists.', ['@id' => $cached_id])); + // Check existence of the contextual link placeholders. + $this->assertRaw(' $id, 'data-contextual-token' => $id_token]) . '>'); + $this->assertRaw(' $cached_id, 'data-contextual-token' => $cached_id_token]) . '>'); // Get server-rendered contextual links. // @see \Drupal\contextual\Tests\ContextualDynamicContextTest:renderContextualLinks() diff --git a/core/modules/block_content/tests/src/Functional/BlockContentCreationTest.php b/core/modules/block_content/tests/src/Functional/BlockContentCreationTest.php index ad90ed09579..54dc07e3f21 100644 --- a/core/modules/block_content/tests/src/Functional/BlockContentCreationTest.php +++ b/core/modules/block_content/tests/src/Functional/BlockContentCreationTest.php @@ -62,7 +62,7 @@ class BlockContentCreationTest extends BlockContentTestBase { $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 @@ class BlockContentCreationTest extends BlockContentTestBase { $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 @@ class BlockContentCreationTest extends BlockContentTestBase { $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() diff --git a/core/modules/block_content/tests/src/Functional/BlockContentTypeTest.php b/core/modules/block_content/tests/src/Functional/BlockContentTypeTest.php index 4a4c3738e81..e064f7a85de 100644 --- a/core/modules/block_content/tests/src/Functional/BlockContentTypeTest.php +++ b/core/modules/block_content/tests/src/Functional/BlockContentTypeTest.php @@ -112,7 +112,7 @@ class BlockContentTypeTest extends BlockContentTestBase { // 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 @@ class BlockContentTypeTest extends BlockContentTestBase { \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 @@ class BlockContentTypeTest extends BlockContentTestBase { // 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 @@ class BlockContentTypeTest extends BlockContentTestBase { // 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.'); } diff --git a/core/modules/book/tests/src/Functional/BookTest.php b/core/modules/book/tests/src/Functional/BookTest.php index 9dd34263c10..bbce9eee264 100644 --- a/core/modules/book/tests/src/Functional/BookTest.php +++ b/core/modules/book/tests/src/Functional/BookTest.php @@ -231,7 +231,7 @@ class BookTest extends BrowserTestBase { // Make sure each part of the book is there. foreach ($nodes as $node) { $this->assertText($node->label(), 'Node title found in printer friendly version.'); - $this->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. diff --git a/core/modules/book/tests/src/Functional/BookTestTrait.php b/core/modules/book/tests/src/Functional/BookTestTrait.php index b52a4c6f0e3..00a9e410432 100644 --- a/core/modules/book/tests/src/Functional/BookTestTrait.php +++ b/core/modules/book/tests/src/Functional/BookTestTrait.php @@ -104,14 +104,14 @@ trait BookTestTrait { $url = $previous->toUrl(); $url->setOptions(['attributes' => ['rel' => ['prev'], 'title' => t('Go to previous page')]]); $text = new FormattableMarkup(' @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 @@ trait BookTestTrait { $url = $next->toUrl(); $url->setOptions(['attributes' => ['rel' => ['next'], 'title' => t('Go to next page')]]); $text = new FormattableMarkup('@label ', ['@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 @@ trait BookTestTrait { // 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++; } diff --git a/core/modules/ckeditor/tests/src/Functional/CKEditorLoadingTest.php b/core/modules/ckeditor/tests/src/Functional/CKEditorLoadingTest.php index 89baa22bcb5..4b8436d3dde 100644 --- a/core/modules/ckeditor/tests/src/Functional/CKEditorLoadingTest.php +++ b/core/modules/ckeditor/tests/src/Functional/CKEditorLoadingTest.php @@ -100,11 +100,12 @@ class CKEditorLoadingTest extends BrowserTestBase { $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; diff --git a/core/modules/color/tests/src/Functional/ColorTest.php b/core/modules/color/tests/src/Functional/ColorTest.php index f0532c65e55..57f8ba73a8a 100644 --- a/core/modules/color/tests/src/Functional/ColorTest.php +++ b/core/modules/color/tests/src/Functional/ColorTest.php @@ -208,8 +208,10 @@ class ColorTest extends BrowserTestBase { $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 @@ class ColorTest extends BrowserTestBase { // 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 @@ class ColorTest extends BrowserTestBase { // 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'); } } diff --git a/core/modules/comment/tests/src/Functional/CommentAnonymousTest.php b/core/modules/comment/tests/src/Functional/CommentAnonymousTest.php index 8b1a7e46d3e..009c5c3b129 100644 --- a/core/modules/comment/tests/src/Functional/CommentAnonymousTest.php +++ b/core/modules/comment/tests/src/Functional/CommentAnonymousTest.php @@ -137,27 +137,27 @@ class CommentAnonymousTest extends CommentTestBase { // 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. diff --git a/core/modules/comment/tests/src/Functional/CommentBlockTest.php b/core/modules/comment/tests/src/Functional/CommentBlockTest.php index e5b7852a358..ee6c3fc2390 100644 --- a/core/modules/comment/tests/src/Functional/CommentBlockTest.php +++ b/core/modules/comment/tests/src/Functional/CommentBlockTest.php @@ -88,7 +88,7 @@ class CommentBlockTest extends CommentTestBase { for ($i = 0; $i < 10; $i++) { $this->clickLink($comments[$i]->getSubject()); $this->assertText($comments[$i]->getSubject(), 'Comment link goes to correct page.'); - $this->assertRaw('assertRaw('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. diff --git a/core/modules/comment/tests/src/Functional/CommentNonNodeTest.php b/core/modules/comment/tests/src/Functional/CommentNonNodeTest.php index 62cc571b715..f0f2492d8c2 100644 --- a/core/modules/comment/tests/src/Functional/CommentNonNodeTest.php +++ b/core/modules/comment/tests/src/Functional/CommentNonNodeTest.php @@ -238,7 +238,7 @@ class CommentNonNodeTest extends BrowserTestBase { 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 @@ class CommentNonNodeTest extends BrowserTestBase { // 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 @@ class CommentNonNodeTest extends BrowserTestBase { // 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.'); diff --git a/core/modules/comment/tests/src/Functional/CommentPagerTest.php b/core/modules/comment/tests/src/Functional/CommentPagerTest.php index 3e4c7a0b21c..7a8406fd216 100644 --- a/core/modules/comment/tests/src/Functional/CommentPagerTest.php +++ b/core/modules/comment/tests/src/Functional/CommentPagerTest.php @@ -45,7 +45,7 @@ class CommentPagerTest extends CommentTestBase { // 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 @@ class CommentPagerTest extends CommentTestBase { // 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. diff --git a/core/modules/comment/tests/src/Functional/CommentRssTest.php b/core/modules/comment/tests/src/Functional/CommentRssTest.php index b05bfc2c7dd..0ea4351205a 100644 --- a/core/modules/comment/tests/src/Functional/CommentRssTest.php +++ b/core/modules/comment/tests/src/Functional/CommentRssTest.php @@ -72,13 +72,13 @@ class CommentRssTest extends CommentTestBase { ])); $raw = '' . $this->node->toUrl('canonical', ['fragment' => 'comments', 'absolute' => TRUE])->toString() . ''; - $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); } } diff --git a/core/modules/comment/tests/src/Functional/CommentTestBase.php b/core/modules/comment/tests/src/Functional/CommentTestBase.php index abdae813e0e..eef34adaf6a 100644 --- a/core/modules/comment/tests/src/Functional/CommentTestBase.php +++ b/core/modules/comment/tests/src/Functional/CommentTestBase.php @@ -364,7 +364,7 @@ abstract class CommentTestBase extends BrowserTestBase { 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])); diff --git a/core/modules/comment/tests/src/Functional/CommentTypeTest.php b/core/modules/comment/tests/src/Functional/CommentTypeTest.php index 47a26131511..25926d18dc9 100644 --- a/core/modules/comment/tests/src/Functional/CommentTypeTest.php +++ b/core/modules/comment/tests/src/Functional/CommentTypeTest.php @@ -112,7 +112,7 @@ class CommentTypeTest extends CommentTestBase { $this->drupalPostForm('admin/structure/comment/manage/comment', $edit, t('Save')); $this->drupalGet('admin/structure/comment'); - $this->assertRaw('Bar', 'New name was displayed.'); + $this->assertRaw('Bar'); $this->clickLink('Manage fields'); // Verify that the original machine name was used in the URL. $this->assertSession()->addressEquals(Url::fromRoute('entity.comment.field_ui_fields', ['comment_type' => 'comment'])); @@ -158,15 +158,13 @@ class CommentTypeTest extends CommentTestBase { // Attempt to delete the comment type, which should not be allowed. $this->drupalGet('admin/structure/comment/manage/' . $type->id() . '/delete'); $this->assertRaw( - t('%label is used by 1 comment on your site. You can not remove this comment type until you have removed all of the %label comments.', ['%label' => $type->label()]), - 'The comment type will not be deleted until all comments of that type are removed.' + t('%label is used by 1 comment on your site. You can not remove this comment type until you have removed all of the %label comments.', ['%label' => $type->label()]) ); $this->assertRaw( t('%label is used by the %field field on your site. You can not remove this comment type until you have removed the field.', [ '%label' => 'foo', '%field' => 'node.foo', - ]), - 'The comment type will not be deleted until all fields of that type are removed.' + ]) ); $this->assertNoText('This action cannot be undone.', 'The comment type deletion confirmation form is not available.'); @@ -176,8 +174,7 @@ class CommentTypeTest extends CommentTestBase { // Attempt to delete the comment type, which should now be allowed. $this->drupalGet('admin/structure/comment/manage/' . $type->id() . '/delete'); $this->assertRaw( - t('Are you sure you want to delete the comment type %type?', ['%type' => $type->id()]), - 'The comment type is available for deletion.' + t('Are you sure you want to delete the comment type %type?', ['%type' => $type->id()]) ); $this->assertText(t('This action cannot be undone.'), 'The comment type deletion confirmation form is available.'); diff --git a/core/modules/config/tests/src/Functional/ConfigEntityListTest.php b/core/modules/config/tests/src/Functional/ConfigEntityListTest.php index c49118341bd..95358c8e6af 100644 --- a/core/modules/config/tests/src/Functional/ConfigEntityListTest.php +++ b/core/modules/config/tests/src/Functional/ConfigEntityListTest.php @@ -277,14 +277,14 @@ class ConfigEntityListTest extends BrowserTestBase { $this->drupalGet('admin/structure/config_test'); // Item 51 should not be present. - $this->assertRaw('Test config entity 50', 'Config entity 50 is shown.'); - $this->assertNoRaw('Test config entity 51', 'Config entity 51 is on the next page.'); + $this->assertRaw('Test config entity 50'); + $this->assertNoRaw('Test config entity 51'); - // Browse to the next page. + // Browse to the next page, test config entity 51 is on page 2. $this->clickLink(t('Page 2')); - $this->assertNoRaw('Test config entity 50', 'Test config entity 50 is on the previous page.'); - $this->assertRaw('dotted.default', 'Default config entity appears on page 2.'); - $this->assertRaw('Test config entity 51', 'Test config entity 51 is on page 2.'); + $this->assertNoRaw('Test config entity 50'); + $this->assertRaw('dotted.default'); + $this->assertRaw('Test config entity 51'); } } diff --git a/core/modules/config/tests/src/Functional/ConfigExportUITest.php b/core/modules/config/tests/src/Functional/ConfigExportUITest.php index e822e378cb9..06f2c6f2d41 100644 --- a/core/modules/config/tests/src/Functional/ConfigExportUITest.php +++ b/core/modules/config/tests/src/Functional/ConfigExportUITest.php @@ -89,7 +89,7 @@ class ConfigExportUITest extends BrowserTestBase { // Check the single export form doesn't have "form-required" elements. $this->drupalGet('admin/config/development/configuration/single/export'); - $this->assertNoRaw('js-form-required form-required', 'No form required fields are found.'); + $this->assertNoRaw('js-form-required form-required'); // Ensure the temporary file is not available to users without the // permission. diff --git a/core/modules/contact/tests/src/Functional/ContactPersonalTest.php b/core/modules/contact/tests/src/Functional/ContactPersonalTest.php index 291f7c952f5..f62b2286ee2 100644 --- a/core/modules/contact/tests/src/Functional/ContactPersonalTest.php +++ b/core/modules/contact/tests/src/Functional/ContactPersonalTest.php @@ -255,7 +255,8 @@ class ContactPersonalTest extends BrowserTestBase { // Submit contact form one over limit. $this->submitPersonalContact($this->contactUser); - $this->assertRaw(t('You cannot send more than %number messages in @interval. Try again later.', ['%number' => $flood_limit, '@interval' => \Drupal::service('date.formatter')->formatInterval($this->config('contact.settings')->get('flood.interval'))]), 'Normal user denied access to flooded contact form.'); + // Normal user should be denied access to flooded contact form. + $this->assertRaw(t('You cannot send more than %number messages in @interval. Try again later.', ['%number' => $flood_limit, '@interval' => \Drupal::service('date.formatter')->formatInterval($this->config('contact.settings')->get('flood.interval'))])); // Test that the admin user can still access the contact form even though // the flood limit was reached. diff --git a/core/modules/content_translation/tests/src/Functional/ContentTranslationContextualLinksTest.php b/core/modules/content_translation/tests/src/Functional/ContentTranslationContextualLinksTest.php index b958fa1af64..51058b89ee4 100644 --- a/core/modules/content_translation/tests/src/Functional/ContentTranslationContextualLinksTest.php +++ b/core/modules/content_translation/tests/src/Functional/ContentTranslationContextualLinksTest.php @@ -127,7 +127,7 @@ class ContentTranslationContextualLinksTest extends BrowserTestBase { $this->drupalLogin($this->translator); $translate_link = 'node/' . $node->id() . '/translations'; $this->drupalGet($translate_link); - $this->assertRaw(t('Translations of %label', ['%label' => $node->label()]), 'The contextual link leads to the translate page.'); + $this->assertRaw(t('Translations of %label', ['%label' => $node->label()])); } } diff --git a/core/modules/dblog/tests/src/Functional/DbLogTest.php b/core/modules/dblog/tests/src/Functional/DbLogTest.php index 33eec9c62b3..7e3a511f713 100644 --- a/core/modules/dblog/tests/src/Functional/DbLogTest.php +++ b/core/modules/dblog/tests/src/Functional/DbLogTest.php @@ -133,10 +133,10 @@ class DbLogTest extends BrowserTestBase { $this->assertSession()->linkByHrefExists($context['referer']); // Verify hostname. - $this->assertRaw($context['ip'], 'Found hostname on the detail page.'); + $this->assertRaw($context['ip']); // Verify location. - $this->assertRaw($context['request_uri'], 'Found location on the detail page.'); + $this->assertRaw($context['request_uri']); // Verify severity. $this->assertText('Notice', 'The severity was properly displayed on the detail page.'); @@ -471,7 +471,7 @@ class DbLogTest extends BrowserTestBase { $link = mb_substr($value, strpos($value, 'admin/reports/dblog/event/')); $this->drupalGet($link); // Check for full message text on the details page. - $this->assertRaw($message, 'DBLog event details was found: [delete user]'); + $this->assertRaw($message); } $this->assertNotEmpty($link, 'DBLog event was recorded: [delete user]'); // Visit random URL (to generate page not found event). diff --git a/core/modules/editor/tests/src/Functional/EditorAdminTest.php b/core/modules/editor/tests/src/Functional/EditorAdminTest.php index e2ffd5ecfb6..25eacaf3feb 100644 --- a/core/modules/editor/tests/src/Functional/EditorAdminTest.php +++ b/core/modules/editor/tests/src/Functional/EditorAdminTest.php @@ -72,7 +72,7 @@ class EditorAdminTest extends BrowserTestBase { $this->assertCount(1, $select_is_disabled, 'The Text Editor select is disabled.'); $this->assertCount(1, $options, 'The Text Editor select has only one option.'); $this->assertTrue(($options[0]->getText()) === 'None', 'Option 1 in the Text Editor select is "None".'); - $this->assertRaw('This option is disabled because no modules that provide a text editor are currently enabled.', 'Description for select present that tells users to install a text editor module.'); + $this->assertRaw('This option is disabled because no modules that provide a text editor are currently enabled.'); } /** @@ -203,7 +203,7 @@ class EditorAdminTest extends BrowserTestBase { $this->assertTrue(($options[1]->getText()) === 'Unicorn Editor', 'Option 2 in the Text Editor select is "Unicorn Editor".'); $this->assertTrue($options[0]->hasAttribute('selected'), 'Option 1 ("None") is selected.'); // Ensure the none option is selected. - $this->assertNoRaw('This option is disabled because no modules that provide a text editor are currently enabled.', 'Description for select absent that tells users to install a text editor module.'); + $this->assertNoRaw('This option is disabled because no modules that provide a text editor are currently enabled.'); // Select the "Unicorn Editor" editor and click the "Configure" button. $edit = [ diff --git a/core/modules/field/tests/src/Functional/Boolean/BooleanFieldTest.php b/core/modules/field/tests/src/Functional/Boolean/BooleanFieldTest.php index b34504e955d..534cfa5b7b0 100644 --- a/core/modules/field/tests/src/Functional/Boolean/BooleanFieldTest.php +++ b/core/modules/field/tests/src/Functional/Boolean/BooleanFieldTest.php @@ -108,7 +108,7 @@ class BooleanFieldTest extends BrowserTestBase { $this->drupalGet('entity_test/add'); $this->assertFieldByName("{$field_name}[value]", '', 'Widget found.'); $this->assertText($this->field->label(), 'Uses field label by default.'); - $this->assertNoRaw($on, 'Does not use the "On" label.'); + $this->assertNoRaw($on); // Submit and ensure it is accepted. $edit = [ diff --git a/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceFieldDefaultValueTest.php b/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceFieldDefaultValueTest.php index 0457ba614be..f775b61a040 100644 --- a/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceFieldDefaultValueTest.php +++ b/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceFieldDefaultValueTest.php @@ -90,7 +90,7 @@ class EntityReferenceFieldDefaultValueTest extends BrowserTestBase { // Check that default value is selected in default value form. $this->drupalGet('admin/structure/types/manage/reference_content/fields/node.reference_content.' . $field_name); - $this->assertRaw('name="default_value_input[' . $field_name . '][0][target_id]" value="' . $referenced_node->getTitle() . ' (' . $referenced_node->id() . ')', 'The default value is selected in instance settings page'); + $this->assertRaw('name="default_value_input[' . $field_name . '][0][target_id]" value="' . $referenced_node->getTitle() . ' (' . $referenced_node->id() . ')'); // Check if the ID has been converted to UUID in config entity. $config_entity = $this->config('field.field.node.reference_content.' . $field_name)->get(); diff --git a/core/modules/field/tests/src/Functional/FormTest.php b/core/modules/field/tests/src/Functional/FormTest.php index e0cbc00272a..27f18a0b7b5 100644 --- a/core/modules/field/tests/src/Functional/FormTest.php +++ b/core/modules/field/tests/src/Functional/FormTest.php @@ -138,7 +138,7 @@ class FormTest extends FieldTestBase { "{$field_name}[0][value]" => -1, ]; $this->drupalPostForm(NULL, $edit, t('Save')); - $this->assertRaw(t('%name does not accept the value -1.', ['%name' => $this->field['label']]), 'Field validation fails with invalid input.'); + $this->assertRaw(t('%name does not accept the value -1.', ['%name' => $this->field['label']])); // TODO : check that the correct field is flagged for error. // Create an entity @@ -230,7 +230,7 @@ class FormTest extends FieldTestBase { // Submit with missing required value. $edit = []; $this->drupalPostForm('entity_test/add', $edit, t('Save')); - $this->assertRaw(t('@name field is required.', ['@name' => $this->field['label']]), 'Required field with no value fails validation'); + $this->assertRaw(t('@name field is required.', ['@name' => $this->field['label']])); // Create an entity $value = mt_rand(1, 127); @@ -250,7 +250,7 @@ class FormTest extends FieldTestBase { "{$field_name}[0][value]" => $value, ]; $this->drupalPostForm('entity_test/manage/' . $id . '/edit', $edit, t('Save')); - $this->assertRaw(t('@name field is required.', ['@name' => $this->field['label']]), 'Required field with no value fails validation'); + $this->assertRaw(t('@name field is required.', ['@name' => $this->field['label']])); } public function testFieldFormUnlimited() { @@ -462,7 +462,7 @@ class FormTest extends FieldTestBase { // Submit the form with more values than the field accepts. $edit = [$field_name => '1, 2, 3, 4, 5']; $this->drupalPostForm(NULL, $edit, t('Save')); - $this->assertRaw('this field cannot hold more than 4 values', 'Form validation failed.'); + $this->assertRaw('this field cannot hold more than 4 values'); // Check that the field values were not submitted. $this->assertFieldValues($entity_init, $field_name, [1, 2, 3]); diff --git a/core/modules/field/tests/src/Functional/NestedFormTest.php b/core/modules/field/tests/src/Functional/NestedFormTest.php index cbf3e2844ab..311b089953e 100644 --- a/core/modules/field/tests/src/Functional/NestedFormTest.php +++ b/core/modules/field/tests/src/Functional/NestedFormTest.php @@ -128,14 +128,14 @@ class NestedFormTest extends FieldTestBase { 'field_unlimited[1][value]' => -1, ]; $this->drupalPostForm('test-entity/nested/1/2', $edit, t('Save')); - $this->assertRaw(t('%label does not accept the value -1', ['%label' => 'Unlimited field']), 'Entity 1: the field validation error was reported.'); + $this->assertRaw(t('%label does not accept the value -1', ['%label' => 'Unlimited field'])); $error_field = $this->xpath('//input[@id=:id and contains(@class, "error")]', [':id' => 'edit-field-unlimited-1-value']); $this->assertCount(1, $error_field, 'Entity 1: the error was flagged on the correct element.'); $edit = [ 'entity_2[field_unlimited][1][value]' => -1, ]; $this->drupalPostForm('test-entity/nested/1/2', $edit, t('Save')); - $this->assertRaw(t('%label does not accept the value -1', ['%label' => 'Unlimited field']), 'Entity 2: the field validation error was reported.'); + $this->assertRaw(t('%label does not accept the value -1', ['%label' => 'Unlimited field'])); $error_field = $this->xpath('//input[@id=:id and contains(@class, "error")]', [':id' => 'edit-entity-2-field-unlimited-1-value']); $this->assertCount(1, $error_field, 'Entity 2: the error was flagged on the correct element.'); diff --git a/core/modules/field/tests/src/Functional/Number/NumberFieldTest.php b/core/modules/field/tests/src/Functional/Number/NumberFieldTest.php index e4e9358c716..69a7255de17 100644 --- a/core/modules/field/tests/src/Functional/Number/NumberFieldTest.php +++ b/core/modules/field/tests/src/Functional/Number/NumberFieldTest.php @@ -87,7 +87,7 @@ class NumberFieldTest extends BrowserTestBase { preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match); $id = $match[1]; $this->assertText(t('entity_test @id has been created.', ['@id' => $id]), 'Entity was created'); - $this->assertRaw($value, 'Value is displayed.'); + $this->assertRaw($value); // Try to create entries with more than one decimal separator; assert fail. $wrong_entries = [ @@ -104,7 +104,7 @@ class NumberFieldTest extends BrowserTestBase { "{$field_name}[0][value]" => $wrong_entry, ]; $this->drupalPostForm(NULL, $edit, t('Save')); - $this->assertRaw(t('%name must be a number.', ['%name' => $field_name]), 'Correctly failed to save decimal value with more than one decimal point.'); + $this->assertRaw(t('%name must be a number.', ['%name' => $field_name])); } // Try to create entries with minus sign not in the first position. @@ -122,7 +122,7 @@ class NumberFieldTest extends BrowserTestBase { "{$field_name}[0][value]" => $wrong_entry, ]; $this->drupalPostForm(NULL, $edit, t('Save')); - $this->assertRaw(t('%name must be a number.', ['%name' => $field_name]), 'Correctly failed to save decimal value with minus sign in the wrong position.'); + $this->assertRaw(t('%name must be a number.', ['%name' => $field_name])); } } @@ -209,7 +209,7 @@ class NumberFieldTest extends BrowserTestBase { "{$field_name}[0][value]" => $minimum - 1, ]; $this->drupalPostForm(NULL, $edit, t('Save')); - $this->assertRaw(t('%name must be higher than or equal to %minimum.', ['%name' => $field_name, '%minimum' => $minimum]), 'Correctly failed to save integer value less than minimum allowed value.'); + $this->assertRaw(t('%name must be higher than or equal to %minimum.', ['%name' => $field_name, '%minimum' => $minimum])); // Try to set a decimal value $this->drupalGet('entity_test/add'); @@ -217,7 +217,7 @@ class NumberFieldTest extends BrowserTestBase { "{$field_name}[0][value]" => 1.5, ]; $this->drupalPostForm(NULL, $edit, t('Save')); - $this->assertRaw(t('%name is not a valid number.', ['%name' => $field_name]), 'Correctly failed to save decimal value to integer field.'); + $this->assertRaw(t('%name is not a valid number.', ['%name' => $field_name])); // Try to set a value above the maximum value $this->drupalGet('entity_test/add'); @@ -225,7 +225,7 @@ class NumberFieldTest extends BrowserTestBase { "{$field_name}[0][value]" => $maximum + 1, ]; $this->drupalPostForm(NULL, $edit, t('Save')); - $this->assertRaw(t('%name must be lower than or equal to %maximum.', ['%name' => $field_name, '%maximum' => $maximum]), 'Correctly failed to save integer value greater than maximum allowed value.'); + $this->assertRaw(t('%name must be lower than or equal to %maximum.', ['%name' => $field_name, '%maximum' => $maximum])); // Try to set a wrong integer value. $this->drupalGet('entity_test/add'); @@ -233,7 +233,7 @@ class NumberFieldTest extends BrowserTestBase { "{$field_name}[0][value]" => '20-40', ]; $this->drupalPostForm(NULL, $edit, t('Save')); - $this->assertRaw(t('%name must be a number.', ['%name' => $field_name]), 'Correctly failed to save wrong integer value.'); + $this->assertRaw(t('%name must be a number.', ['%name' => $field_name])); // Test with valid entries. $valid_entries = [ @@ -251,7 +251,7 @@ class NumberFieldTest extends BrowserTestBase { preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match); $id = $match[1]; $this->assertText(t('entity_test @id has been created.', ['@id' => $id]), 'Entity was created'); - $this->assertRaw($valid_entry, 'Value is displayed.'); + $this->assertRaw($valid_entry); $this->assertNoFieldByXpath('//div[@content="' . $valid_entry . '"]', NULL, 'The "content" attribute is not present since the Prefix is not being displayed'); } @@ -348,7 +348,7 @@ class NumberFieldTest extends BrowserTestBase { "{$field_name}[0][value]" => $wrong_entry, ]; $this->drupalPostForm(NULL, $edit, t('Save')); - $this->assertRaw(t('%name must be a number.', ['%name' => $field_name]), 'Correctly failed to save float value with more than one decimal point.'); + $this->assertRaw(t('%name must be a number.', ['%name' => $field_name])); } // Try to create entries with minus sign not in the first position. @@ -366,7 +366,7 @@ class NumberFieldTest extends BrowserTestBase { "{$field_name}[0][value]" => $wrong_entry, ]; $this->drupalPostForm(NULL, $edit, t('Save')); - $this->assertRaw(t('%name must be a number.', ['%name' => $field_name]), 'Correctly failed to save float value with minus sign in the wrong position.'); + $this->assertRaw(t('%name must be a number.', ['%name' => $field_name])); } } @@ -432,7 +432,7 @@ class NumberFieldTest extends BrowserTestBase { ]; $this->drupalPostForm($field_configuration_url, $edit, t('Save settings')); // Check if an error message is shown. - $this->assertNoRaw(t('%name is not a valid number.', ['%name' => t('Minimum')]), 'Saved ' . gettype($minimum_value) . ' value as minimal value on a ' . $field->getType() . ' field'); + $this->assertNoRaw(t('%name is not a valid number.', ['%name' => t('Minimum')])); // Check if a success message is shown. $this->assertRaw(t('Saved %label configuration.', ['%label' => $field->getLabel()])); // Check if the minimum value was actually set. diff --git a/core/modules/field/tests/src/FunctionalJavascript/Number/NumberFieldTest.php b/core/modules/field/tests/src/FunctionalJavascript/Number/NumberFieldTest.php index 00ada093732..39f5a6542b0 100644 --- a/core/modules/field/tests/src/FunctionalJavascript/Number/NumberFieldTest.php +++ b/core/modules/field/tests/src/FunctionalJavascript/Number/NumberFieldTest.php @@ -151,7 +151,7 @@ class NumberFieldTest extends WebDriverTestBase { // Check number_decimal and number_unformatted formatters behavior. $this->drupalGet('node/' . $node->id()); $float_formatted = number_format($random_float, $scale, $decimal_separator, $thousand_separator); - $this->assertRaw("$prefix$float_formatted$suffix", 'Prefix and suffix added'); + $this->assertRaw("$prefix$float_formatted$suffix"); $this->assertRaw((string) $random_integer); // Configure the number_decimal formatter. @@ -182,7 +182,7 @@ class NumberFieldTest extends WebDriverTestBase { $this->drupalGet('node/' . $node->id()); $integer_formatted = number_format($random_integer, 0, '', $thousand_separator); - $this->assertRaw($integer_formatted, 'Random integer formatted'); + $this->assertRaw($integer_formatted); } } diff --git a/core/modules/field_ui/tests/src/Functional/ManageFieldsFunctionalTest.php b/core/modules/field_ui/tests/src/Functional/ManageFieldsFunctionalTest.php index db4b08a65f5..9205070b33d 100644 --- a/core/modules/field_ui/tests/src/Functional/ManageFieldsFunctionalTest.php +++ b/core/modules/field_ui/tests/src/Functional/ManageFieldsFunctionalTest.php @@ -167,7 +167,7 @@ class ManageFieldsFunctionalTest extends BrowserTestBase { ]; foreach ($table_headers as $table_header) { // We check that the label appear in the table headings. - $this->assertRaw($table_header . '', new FormattableMarkup('%table_header table header was found.', ['%table_header' => $table_header])); + $this->assertRaw($table_header . ''); } // Test the "Add field" action link. @@ -249,7 +249,7 @@ class ManageFieldsFunctionalTest extends BrowserTestBase { public function addExistingField() { // Check "Re-use existing field" appears. $this->drupalGet('admin/structure/types/manage/page/fields/add-field'); - $this->assertRaw(t('Re-use an existing field'), '"Re-use existing field" was found.'); + $this->assertRaw(t('Re-use an existing field')); // Check that fields of other entity types (here, the 'comment_body' field) // do not show up in the "Re-use existing field" list. @@ -307,7 +307,7 @@ class ManageFieldsFunctionalTest extends BrowserTestBase { 'cardinality_number' => 1, ]; $this->drupalPostForm($field_edit_path, $edit, t('Save field settings')); - $this->assertRaw(t('There is @count entity with @delta or more values in this field.', ['@count' => 1, '@delta' => 2]), 'Correctly failed to set cardinality lower than highest delta.'); + $this->assertRaw(t('There is @count entity with @delta or more values in this field.', ['@count' => 1, '@delta' => 2])); // Create a second entity with three values. $edit = ['title[0][value]' => 'Cardinality 3', 'body[0][value]' => 'Body 1', 'body[1][value]' => 'Body 2', 'body[2][value]' => 'Body 3']; @@ -330,14 +330,14 @@ class ManageFieldsFunctionalTest extends BrowserTestBase { 'cardinality_number' => 1, ]; $this->drupalPostForm($field_edit_path, $edit, t('Save field settings')); - $this->assertRaw(t('There are @count entities with @delta or more values in this field.', ['@count' => 2, '@delta' => 2]), 'Correctly failed to set cardinality lower than highest delta.'); + $this->assertRaw(t('There are @count entities with @delta or more values in this field.', ['@count' => 2, '@delta' => 2])); $edit = [ 'cardinality' => 'number', 'cardinality_number' => 2, ]; $this->drupalPostForm($field_edit_path, $edit, t('Save field settings')); - $this->assertRaw(t('There is @count entity with @delta or more values in this field.', ['@count' => 1, '@delta' => 3]), 'Correctly failed to set cardinality lower than highest delta.'); + $this->assertRaw(t('There is @count entity with @delta or more values in this field.', ['@count' => 1, '@delta' => 3])); $edit = [ 'cardinality' => 'number', @@ -373,7 +373,7 @@ class ManageFieldsFunctionalTest extends BrowserTestBase { } // Check "Re-use existing field" appears. $this->drupalGet('admin/structure/types/manage/page/fields/add-field'); - $this->assertRaw(t('Re-use an existing field'), '"Re-use existing field" was found.'); + $this->assertRaw(t('Re-use an existing field')); // Ensure that we test with a label that contains HTML. $label = $this->randomString(4) . '
' . $this->randomString(4); diff --git a/core/modules/field_ui/tests/src/Traits/FieldUiTestTrait.php b/core/modules/field_ui/tests/src/Traits/FieldUiTestTrait.php index e5554cbdae5..86b92df295f 100644 --- a/core/modules/field_ui/tests/src/Traits/FieldUiTestTrait.php +++ b/core/modules/field_ui/tests/src/Traits/FieldUiTestTrait.php @@ -45,17 +45,17 @@ trait FieldUiTestTrait { // First step: 'Add field' page. $this->drupalPostForm($bundle_path, $initial_edit, t('Save and continue')); - $this->assertRaw(t('These settings apply to the %label field everywhere it is used.', ['%label' => $label]), 'Storage settings page was displayed.'); + $this->assertRaw(t('These settings apply to the %label field everywhere it is used.', ['%label' => $label])); // Test Breadcrumbs. $this->assertSession()->linkExists($label, 0, 'Field label is correct in the breadcrumb of the storage settings page.'); // Second step: 'Storage settings' form. $this->drupalPostForm(NULL, $storage_edit, t('Save field settings')); - $this->assertRaw(t('Updated field %label field settings.', ['%label' => $label]), 'Redirected to field settings page.'); + $this->assertRaw(t('Updated field %label field settings.', ['%label' => $label])); // Third step: 'Field settings' form. $this->drupalPostForm(NULL, $field_edit, t('Save settings')); - $this->assertRaw(t('Saved %label configuration.', ['%label' => $label]), 'Redirected to "Manage fields" page.'); + $this->assertRaw(t('Saved %label configuration.', ['%label' => $label])); // Check that the field appears in the overview form. $this->assertFieldByXPath('//table[@id="field-overview"]//tr/td[1]', $label, 'Field was created and appears in the overview page.'); @@ -86,12 +86,13 @@ trait FieldUiTestTrait { $this->drupalPostForm("$bundle_path/fields/add-field", $initial_edit, t('Save and continue')); // Set the main content to only the content region because the label can // contain HTML which will be auto-escaped by Twig. - $this->assertRaw('field-config-edit-form', 'The field config edit form is present.'); - $this->assertNoRaw('&lt;', 'The page does not have double escaped HTML tags.'); + $this->assertRaw('field-config-edit-form'); + // Check that the page does not have double escaped HTML tags. + $this->assertNoRaw('&lt;'); // Second step: 'Field settings' form. $this->drupalPostForm(NULL, $field_edit, t('Save settings')); - $this->assertRaw(t('Saved %label configuration.', ['%label' => $label]), 'Redirected to "Manage fields" page.'); + $this->assertRaw(t('Saved %label configuration.', ['%label' => $label])); // Check that the field appears in the overview form. $this->assertFieldByXPath('//table[@id="field-overview"]//tr/td[1]', $label, 'Field was created and appears in the overview page.'); @@ -112,14 +113,14 @@ trait FieldUiTestTrait { public function fieldUIDeleteField($bundle_path, $field_name, $label, $bundle_label) { // Display confirmation form. $this->drupalGet("$bundle_path/fields/$field_name/delete"); - $this->assertRaw(t('Are you sure you want to delete the field %label', ['%label' => $label]), 'Delete confirmation was found.'); + $this->assertRaw(t('Are you sure you want to delete the field %label', ['%label' => $label])); // Test Breadcrumbs. $this->assertSession()->linkExists($label, 0, 'Field label is correct in the breadcrumb of the field delete page.'); // Submit confirmation form. $this->drupalPostForm(NULL, [], t('Delete')); - $this->assertRaw(t('The field %label has been deleted from the %type content type.', ['%label' => $label, '%type' => $bundle_label]), 'Delete message was found.'); + $this->assertRaw(t('The field %label has been deleted from the %type content type.', ['%label' => $label, '%type' => $bundle_label])); // Check that the field does not appear in the overview form. $this->assertNoFieldByXPath('//table[@id="field-overview"]//span[@class="label-field"]', $label, 'Field does not appear in the overview page.'); diff --git a/core/modules/file/tests/src/Functional/FileFieldDisplayTest.php b/core/modules/file/tests/src/Functional/FileFieldDisplayTest.php index 7b3a92e8c54..79684571c4e 100644 --- a/core/modules/file/tests/src/Functional/FileFieldDisplayTest.php +++ b/core/modules/file/tests/src/Functional/FileFieldDisplayTest.php @@ -79,13 +79,13 @@ class FileFieldDisplayTest extends FileFieldTestBase { '#file' => $node_file, ]; $default_output = \Drupal::service('renderer')->renderRoot($file_link); - $this->assertRaw($default_output, 'Default formatter displaying correctly on full node view.'); + $this->assertRaw($default_output); // Turn the "display" option off and check that the file is no longer displayed. $edit = [$field_name . '[0][display]' => FALSE]; $this->drupalPostForm('node/' . $nid . '/edit', $edit, t('Save')); - $this->assertNoRaw($default_output, 'Field is hidden when "display" option is unchecked.'); + $this->assertNoRaw($default_output); // Add a description and make sure that it is displayed. $description = $this->randomMachineName(); @@ -110,8 +110,10 @@ class FileFieldDisplayTest extends FileFieldTestBase { $edit[$field_name . '[1][display]'] = FALSE; $this->drupalPostForm(NULL, $edit, t('Preview')); $this->clickLink(t('Back to content editing')); - $this->assertRaw($field_name . '[0][display]', 'First file appears as expected.'); - $this->assertRaw($field_name . '[1][display]', 'Second file appears as expected.'); + // First file. + $this->assertRaw($field_name . '[0][display]'); + // Second file. + $this->assertRaw($field_name . '[1][display]'); $this->assertSession()->responseContains($field_name . '[1][description]'); // Check that the file fields don't contain duplicate HTML IDs. diff --git a/core/modules/file/tests/src/Functional/FileFieldValidateTest.php b/core/modules/file/tests/src/Functional/FileFieldValidateTest.php index 51698a6257f..9b4d14bd50d 100644 --- a/core/modules/file/tests/src/Functional/FileFieldValidateTest.php +++ b/core/modules/file/tests/src/Functional/FileFieldValidateTest.php @@ -36,7 +36,7 @@ class FileFieldValidateTest extends FileFieldTestBase { $edit = []; $edit['title[0][value]'] = $this->randomMachineName(); $this->drupalPostForm('node/add/' . $type_name, $edit, t('Save')); - $this->assertRaw(t('@title field is required.', ['@title' => $field->getLabel()]), 'Node save failed when required file field was empty.'); + $this->assertRaw(t('@title field is required.', ['@title' => $field->getLabel()])); // Create a new node with the uploaded file. $nid = $this->uploadNodeFile($test_file, $field_name, $type_name); @@ -57,7 +57,7 @@ class FileFieldValidateTest extends FileFieldTestBase { $edit = []; $edit['title[0][value]'] = $this->randomMachineName(); $this->drupalPostForm('node/add/' . $type_name, $edit, t('Save')); - $this->assertRaw(t('@title field is required.', ['@title' => $field->getLabel()]), 'Node save failed when required multiple value file field was empty.'); + $this->assertRaw(t('@title field is required.', ['@title' => $field->getLabel()])); // Create a new node with the uploaded file into the multivalue field. $nid = $this->uploadNodeFile($test_file, $field_name, $type_name); @@ -104,7 +104,7 @@ class FileFieldValidateTest extends FileFieldTestBase { // Check that uploading the large file fails (1M limit). $this->uploadNodeFile($large_file, $field_name, $type_name); $error_message = t('The file is %filesize exceeding the maximum file size of %maxsize.', ['%filesize' => format_size($large_file->getSize()), '%maxsize' => format_size($file_limit)]); - $this->assertRaw($error_message, new FormattableMarkup('Node save failed when file (%filesize) exceeded the max upload size (%maxsize).', ['%filesize' => format_size($large_file->getSize()), '%maxsize' => $max_filesize])); + $this->assertRaw($error_message); } // Turn off the max filesize. @@ -148,7 +148,7 @@ class FileFieldValidateTest extends FileFieldTestBase { // Check that the file with the wrong extension cannot be uploaded. $this->uploadNodeFile($test_file, $field_name, $type_name); $error_message = t('Only files with the following extensions are allowed: %files-allowed.', ['%files-allowed' => 'txt']); - $this->assertRaw($error_message, 'Node save failed when file uploaded with the wrong extension.'); + $this->assertRaw($error_message); // Enable extension checking for text and image files. $this->updateFileField($field_name, $type_name, ['file_extensions' => "txt $test_file_extension"]); diff --git a/core/modules/file/tests/src/Functional/FileFieldWidgetTest.php b/core/modules/file/tests/src/Functional/FileFieldWidgetTest.php index e7b9c19c126..156326713cc 100644 --- a/core/modules/file/tests/src/Functional/FileFieldWidgetTest.php +++ b/core/modules/file/tests/src/Functional/FileFieldWidgetTest.php @@ -376,12 +376,12 @@ class FileFieldWidgetTest extends FileFieldTestBase { $this->drupalPostForm(NULL, $edit, t('Upload')); $error_message = t('Only files with the following extensions are allowed: %files-allowed.', ['%files-allowed' => 'txt']); - $this->assertRaw($error_message, t('Validation error when file with wrong extension uploaded (JSMode=%type).', ['%type' => $type])); + $this->assertRaw($error_message); // Upload file with correct extension, check that error message is removed. $edit[$name] = \Drupal::service('file_system')->realpath($test_file_text->getFileUri()); $this->drupalPostForm(NULL, $edit, t('Upload')); - $this->assertNoRaw($error_message, t('Validation error removed when file with correct extension uploaded (JSMode=%type).', ['%type' => $type])); + $this->assertNoRaw($error_message); } /** diff --git a/core/modules/file/tests/src/Functional/FileManagedFileElementTest.php b/core/modules/file/tests/src/Functional/FileManagedFileElementTest.php index 3f67a7948a8..8b2176f4460 100644 --- a/core/modules/file/tests/src/Functional/FileManagedFileElementTest.php +++ b/core/modules/file/tests/src/Functional/FileManagedFileElementTest.php @@ -38,7 +38,7 @@ class FileManagedFileElementTest extends FileFieldTestBase { // Submit without a file. $this->drupalPostForm($path, [], t('Save')); - $this->assertRaw(t('The file ids are %fids.', ['%fids' => implode(',', [])]), 'Submitted without a file.'); + $this->assertRaw(t('The file ids are %fids.', ['%fids' => implode(',', [])])); // Submit with a file, but with an invalid form token. Ensure the file // was not saved. @@ -60,11 +60,11 @@ class FileManagedFileElementTest extends FileFieldTestBase { $this->drupalPostForm($path, $edit, t('Save')); $last_fid = $this->getLastFileId(); $this->assertTrue($last_fid > $last_fid_prior, 'New file got saved.'); - $this->assertRaw(t('The file ids are %fids.', ['%fids' => implode(',', [$last_fid])]), 'Submit handler has correct file info.'); + $this->assertRaw(t('The file ids are %fids.', ['%fids' => implode(',', [$last_fid])])); // Submit no new input, but with a default file. $this->drupalPostForm($path . '/' . $last_fid, [], t('Save')); - $this->assertRaw(t('The file ids are %fids.', ['%fids' => implode(',', [$last_fid])]), 'Empty submission did not change an existing file.'); + $this->assertRaw(t('The file ids are %fids.', ['%fids' => implode(',', [$last_fid])])); // Upload, then Submit. $last_fid_prior = $this->getLastFileId(); @@ -74,7 +74,7 @@ class FileManagedFileElementTest extends FileFieldTestBase { $last_fid = $this->getLastFileId(); $this->assertTrue($last_fid > $last_fid_prior, 'New file got uploaded.'); $this->drupalPostForm(NULL, [], t('Save')); - $this->assertRaw(t('The file ids are %fids.', ['%fids' => implode(',', [$last_fid])]), 'Submit handler has correct file info.'); + $this->assertRaw(t('The file ids are %fids.', ['%fids' => implode(',', [$last_fid])])); // Remove, then Submit. $remove_button_title = $multiple ? t('Remove selected') : t('Remove'); @@ -86,7 +86,7 @@ class FileManagedFileElementTest extends FileFieldTestBase { $this->drupalGet($path . '/' . $last_fid); $this->drupalPostForm(NULL, $remove_edit, $remove_button_title); $this->drupalPostForm(NULL, [], t('Save')); - $this->assertRaw(t('The file ids are %fids.', ['%fids' => '']), 'Submission after file removal was successful.'); + $this->assertRaw(t('The file ids are %fids.', ['%fids' => ''])); // Upload, then Remove, then Submit. $this->drupalGet($path); @@ -100,7 +100,7 @@ class FileManagedFileElementTest extends FileFieldTestBase { $this->drupalPostForm(NULL, $remove_edit, $remove_button_title); $this->drupalPostForm(NULL, [], t('Save')); - $this->assertRaw(t('The file ids are %fids.', ['%fids' => '']), 'Submission after file upload and removal was successful.'); + $this->assertRaw(t('The file ids are %fids.', ['%fids' => ''])); } } } @@ -124,7 +124,8 @@ class FileManagedFileElementTest extends FileFieldTestBase { // Save the entire form. $this->drupalPostForm(NULL, [], t('Save')); - $this->assertRaw(t('The file ids are %fids.', ['%fids' => implode(',', $fid_list)]), 'Two files saved into a single multiple file element.'); + // Check that two files are saved into a single multiple file element. + $this->assertRaw(t('The file ids are %fids.', ['%fids' => implode(',', $fid_list)])); // Delete only the first file. $edit = [ diff --git a/core/modules/file/tests/src/Functional/FilePrivateTest.php b/core/modules/file/tests/src/Functional/FilePrivateTest.php index 7b3224a2b21..925499e7ad2 100644 --- a/core/modules/file/tests/src/Functional/FilePrivateTest.php +++ b/core/modules/file/tests/src/Functional/FilePrivateTest.php @@ -57,7 +57,7 @@ class FilePrivateTest extends FileFieldTestBase { $node_file = File::load($node->{$field_name}->target_id); // Ensure the file can be viewed. $this->drupalGet('node/' . $node->id()); - $this->assertRaw($node_file->getFilename(), 'File reference is displayed after attaching it'); + $this->assertRaw($node_file->getFilename()); // Ensure the file can be downloaded. $this->drupalGet(file_create_url($node_file->getFileUri())); $this->assertSession()->statusCodeEquals(200); diff --git a/core/modules/file/tests/src/Functional/SaveUploadFormTest.php b/core/modules/file/tests/src/Functional/SaveUploadFormTest.php index bd7891920bd..07524ad439e 100644 --- a/core/modules/file/tests/src/Functional/SaveUploadFormTest.php +++ b/core/modules/file/tests/src/Functional/SaveUploadFormTest.php @@ -87,7 +87,7 @@ class SaveUploadFormTest extends FileManagedTestBase { ]; $this->drupalPostForm('file-test/save_upload_from_form_test', $edit, t('Submit')); $this->assertSession()->statusCodeEquals(200); - $this->assertRaw(t('You WIN!'), 'Found the success message.'); + $this->assertRaw(t('You WIN!')); // Check that the correct hooks were called then clean out the hook // counters. @@ -166,8 +166,8 @@ class SaveUploadFormTest extends FileManagedTestBase { $this->drupalPostForm('file-test/save_upload_from_form_test', $edit, t('Submit')); $this->assertSession()->statusCodeEquals(200); $message = t('Only files with the following extensions are allowed:') . ' ' . $extensions . ''; - $this->assertRaw($message, 'Cannot upload a disallowed extension'); - $this->assertRaw(t('Epic upload FAIL!'), 'Found the failure message.'); + $this->assertRaw($message); + $this->assertRaw(t('Epic upload FAIL!')); // Check that the correct hooks were called. $this->assertFileHooksCalled(['validate']); @@ -185,8 +185,8 @@ class SaveUploadFormTest extends FileManagedTestBase { $this->drupalPostForm('file-test/save_upload_from_form_test', $edit, t('Submit')); $this->assertSession()->statusCodeEquals(200); - $this->assertNoRaw(t('Only files with the following extensions are allowed:'), 'Can upload an allowed extension.'); - $this->assertRaw(t('You WIN!'), 'Found the success message.'); + $this->assertNoRaw(t('Only files with the following extensions are allowed:')); + $this->assertRaw(t('You WIN!')); // Check that the correct hooks were called. $this->assertFileHooksCalled(['validate', 'load', 'update']); @@ -202,8 +202,8 @@ class SaveUploadFormTest extends FileManagedTestBase { ]; $this->drupalPostForm('file-test/save_upload_from_form_test', $edit, t('Submit')); $this->assertSession()->statusCodeEquals(200); - $this->assertNoRaw(t('Only files with the following extensions are allowed:'), 'Can upload any extension.'); - $this->assertRaw(t('You WIN!'), 'Found the success message.'); + $this->assertNoRaw(t('Only files with the following extensions are allowed:')); + $this->assertRaw(t('You WIN!')); // Check that the correct hooks were called. $this->assertFileHooksCalled(['validate', 'load', 'update']); @@ -228,9 +228,9 @@ class SaveUploadFormTest extends FileManagedTestBase { $this->drupalPostForm('file-test/save_upload_from_form_test', $edit, t('Submit')); $this->assertSession()->statusCodeEquals(200); $message = t('For security reasons, your upload has been renamed to') . ' ' . $this->phpfile->filename . '.txt' . ''; - $this->assertRaw($message, 'Dangerous file was renamed.'); - $this->assertRaw(t('File MIME type is text/plain.'), "Dangerous file's MIME type was changed."); - $this->assertRaw(t('You WIN!'), 'Found the success message.'); + $this->assertRaw($message); + $this->assertRaw(t('File MIME type is text/plain.')); + $this->assertRaw(t('You WIN!')); // Check that the correct hooks were called. $this->assertFileHooksCalled(['validate', 'insert']); @@ -243,9 +243,9 @@ class SaveUploadFormTest extends FileManagedTestBase { $this->drupalPostForm('file-test/save_upload_from_form_test', $edit, t('Submit')); $this->assertSession()->statusCodeEquals(200); - $this->assertNoRaw(t('For security reasons, your upload has been renamed'), 'Found no security message.'); - $this->assertRaw(t('File name is @filename', ['@filename' => $this->phpfile->filename]), 'Dangerous file was not renamed when insecure uploads is TRUE.'); - $this->assertRaw(t('You WIN!'), 'Found the success message.'); + $this->assertNoRaw(t('For security reasons, your upload has been renamed')); + $this->assertRaw(t('File name is @filename', ['@filename' => $this->phpfile->filename])); + $this->assertRaw(t('You WIN!')); // Check that the correct hooks were called. $this->assertFileHooksCalled(['validate', 'insert']); @@ -279,9 +279,9 @@ class SaveUploadFormTest extends FileManagedTestBase { $this->drupalPostForm('file-test/save_upload_from_form_test', $edit, t('Submit')); $this->assertSession()->statusCodeEquals(200); - $this->assertRaw(t('For security reasons, your upload has been renamed'), 'Found security message.'); - $this->assertRaw(t('File name is @filename', ['@filename' => $munged_filename]), 'File was successfully munged.'); - $this->assertRaw(t('You WIN!'), 'Found the success message.'); + $this->assertRaw(t('For security reasons, your upload has been renamed')); + $this->assertRaw(t('File name is @filename', ['@filename' => $munged_filename])); + $this->assertRaw(t('You WIN!')); // Check that the correct hooks were called. $this->assertFileHooksCalled(['validate', 'insert']); @@ -297,9 +297,9 @@ class SaveUploadFormTest extends FileManagedTestBase { $this->drupalPostForm('file-test/save_upload_from_form_test', $edit, t('Submit')); $this->assertSession()->statusCodeEquals(200); - $this->assertNoRaw(t('For security reasons, your upload has been renamed'), 'Found no security message.'); - $this->assertRaw(t('File name is @filename', ['@filename' => $this->image->getFilename()]), 'File was not munged when allowing any extension.'); - $this->assertRaw(t('You WIN!'), 'Found the success message.'); + $this->assertNoRaw(t('For security reasons, your upload has been renamed')); + $this->assertRaw(t('File name is @filename', ['@filename' => $this->image->getFilename()])); + $this->assertRaw(t('You WIN!')); // Check that the correct hooks were called. $this->assertFileHooksCalled(['validate', 'insert']); @@ -317,7 +317,7 @@ class SaveUploadFormTest extends FileManagedTestBase { ]; $this->drupalPostForm('file-test/save_upload_from_form_test', $edit, t('Submit')); $this->assertSession()->statusCodeEquals(200); - $this->assertRaw(t('You WIN!'), 'Found the success message.'); + $this->assertRaw(t('You WIN!')); // Check that the correct hooks were called. $this->assertFileHooksCalled(['validate', 'insert']); @@ -335,7 +335,7 @@ class SaveUploadFormTest extends FileManagedTestBase { ]; $this->drupalPostForm('file-test/save_upload_from_form_test', $edit, t('Submit')); $this->assertSession()->statusCodeEquals(200); - $this->assertRaw(t('You WIN!'), 'Found the success message.'); + $this->assertRaw(t('You WIN!')); // Check that the correct hooks were called. $this->assertFileHooksCalled(['validate', 'load', 'update']); @@ -353,7 +353,7 @@ class SaveUploadFormTest extends FileManagedTestBase { ]; $this->drupalPostForm('file-test/save_upload_from_form_test', $edit, t('Submit')); $this->assertSession()->statusCodeEquals(200); - $this->assertRaw(t('Epic upload FAIL!'), 'Found the failure message.'); + $this->assertRaw(t('Epic upload FAIL!')); // Check that the no hooks were called while failing. $this->assertFileHooksCalled([]); @@ -364,7 +364,7 @@ class SaveUploadFormTest extends FileManagedTestBase { */ public function testNoUpload() { $this->drupalPostForm('file-test/save_upload_from_form_test', [], t('Submit')); - $this->assertNoRaw(t('Epic upload FAIL!'), 'Failure message not found.'); + $this->assertNoRaw(t('Epic upload FAIL!')); } /** @@ -386,8 +386,8 @@ class SaveUploadFormTest extends FileManagedTestBase { \Drupal::state()->set('file_test.disable_error_collection', TRUE); $this->drupalPostForm('file-test/save_upload_from_form_test', $edit, t('Submit')); $this->assertSession()->statusCodeEquals(200); - $this->assertRaw(t('File upload error. Could not move uploaded file.'), 'Found the failure message.'); - $this->assertRaw(t('Epic upload FAIL!'), 'Found the failure message.'); + $this->assertRaw(t('File upload error. Could not move uploaded file.')); + $this->assertRaw(t('Epic upload FAIL!')); // Uploading failed. Now check the log. $this->drupalGet('admin/reports/dblog'); @@ -395,7 +395,7 @@ class SaveUploadFormTest extends FileManagedTestBase { $this->assertRaw(t('Upload error. Could not move uploaded file @file to destination @destination.', [ '@file' => $this->image->getFilename(), '@destination' => 'temporary://' . $test_directory . '/' . $this->image->getFilename(), - ]), 'Found upload error log entry.'); + ])); } /** @@ -412,7 +412,7 @@ class SaveUploadFormTest extends FileManagedTestBase { ]; $this->drupalPostForm('file-test/save_upload_from_form_test', $edit, t('Submit')); $this->assertSession()->statusCodeEquals(200); - $this->assertRaw(t('You WIN!'), 'Found the success message.'); + $this->assertRaw(t('You WIN!')); // Ensure the expected error message is present and the counts before and // after calling _file_save_upload_from_form() are correct. @@ -428,7 +428,7 @@ class SaveUploadFormTest extends FileManagedTestBase { ]; $this->drupalPostForm('file-test/save_upload_from_form_test', $edit, t('Submit')); $this->assertSession()->statusCodeEquals(200); - $this->assertRaw(t('Epic upload FAIL!'), 'Found the failure message.'); + $this->assertRaw(t('Epic upload FAIL!')); // Ensure the expected error message is present and the counts before and // after calling _file_save_upload_from_form() are correct. @@ -442,7 +442,7 @@ class SaveUploadFormTest extends FileManagedTestBase { ]; $this->drupalPostForm('file-test/save_upload_from_form_test', $edit, t('Submit')); $this->assertSession()->statusCodeEquals(200); - $this->assertRaw(t('You WIN!'), 'Found the success message.'); + $this->assertRaw(t('You WIN!')); // Ensure the error message is not present and the counts before and after // calling _file_save_upload_from_form() are correct. @@ -476,10 +476,10 @@ class SaveUploadFormTest extends FileManagedTestBase { $files['files']['file_test_upload'][1] = $file_system->realpath($textfile->uri); $client->request($form->getMethod(), $form->getUri(), $edit, $files); $this->assertSession()->statusCodeEquals(200); - $this->assertRaw(t('Epic upload FAIL!'), 'Found the failure message.'); + $this->assertRaw(t('Epic upload FAIL!')); // Search for combined error message followed by a formatted list of messages. - $this->assertRaw(t('One or more files could not be uploaded.') . '
', 'Error message contains combined list of validation errors.'); + $this->assertRaw(t('One or more files could not be uploaded.') . '
'); } /** @@ -496,7 +496,7 @@ class SaveUploadFormTest extends FileManagedTestBase { ]; $this->drupalPostForm('file-test/save_upload_from_form_test', $edit, t('Submit')); $this->assertSession()->statusCodeEquals(200); - $this->assertRaw(t('Epic upload FAIL!'), 'Found the failure message.'); + $this->assertRaw(t('Epic upload FAIL!')); $this->assertCount(1, $this->cssSelect('input[name="files[file_test_upload][]"].error'), 'File upload field has error.'); } diff --git a/core/modules/file/tests/src/Functional/SaveUploadTest.php b/core/modules/file/tests/src/Functional/SaveUploadTest.php index c4d9ee49f38..04802f32961 100644 --- a/core/modules/file/tests/src/Functional/SaveUploadTest.php +++ b/core/modules/file/tests/src/Functional/SaveUploadTest.php @@ -82,7 +82,8 @@ class SaveUploadTest extends FileManagedTestBase { ]; $this->drupalPostForm('file-test/upload', $edit, t('Submit')); $this->assertSession()->statusCodeEquals(200); - $this->assertRaw(t('You WIN!'), 'Found the success message.'); + // Check that the success message is present. + $this->assertRaw(t('You WIN!')); // Check that the correct hooks were called then clean out the hook // counters. @@ -186,8 +187,8 @@ class SaveUploadTest extends FileManagedTestBase { $this->drupalPostForm('file-test/upload', $edit, t('Submit')); $this->assertSession()->statusCodeEquals(200); $message = t('Only files with the following extensions are allowed:') . ' ' . $extensions . ''; - $this->assertRaw($message, 'Cannot upload a disallowed extension'); - $this->assertRaw(t('Epic upload FAIL!'), 'Found the failure message.'); + $this->assertRaw($message); + $this->assertRaw(t('Epic upload FAIL!')); // Check that the correct hooks were called. $this->assertFileHooksCalled(['validate']); @@ -205,8 +206,8 @@ class SaveUploadTest extends FileManagedTestBase { $this->drupalPostForm('file-test/upload', $edit, t('Submit')); $this->assertSession()->statusCodeEquals(200); - $this->assertNoRaw(t('Only files with the following extensions are allowed:'), 'Can upload an allowed extension.'); - $this->assertRaw(t('You WIN!'), 'Found the success message.'); + $this->assertNoRaw(t('Only files with the following extensions are allowed:')); + $this->assertRaw(t('You WIN!')); // Check that the correct hooks were called. $this->assertFileHooksCalled(['validate', 'load', 'update']); @@ -222,8 +223,8 @@ class SaveUploadTest extends FileManagedTestBase { ]; $this->drupalPostForm('file-test/upload', $edit, t('Submit')); $this->assertSession()->statusCodeEquals(200); - $this->assertNoRaw(t('Only files with the following extensions are allowed:'), 'Can upload any extension.'); - $this->assertRaw(t('You WIN!'), 'Found the success message.'); + $this->assertNoRaw(t('Only files with the following extensions are allowed:')); + $this->assertRaw(t('You WIN!')); // Check that the correct hooks were called. $this->assertFileHooksCalled(['validate', 'load', 'update']); @@ -246,10 +247,10 @@ class SaveUploadTest extends FileManagedTestBase { $this->drupalPostForm('file-test/upload', $edit, t('Submit')); $this->assertSession()->statusCodeEquals(200); $message = t('For security reasons, your upload has been renamed to') . ' ' . $this->phpfile->filename . '.txt' . ''; - $this->assertRaw($message, 'Dangerous file was renamed.'); + $this->assertRaw($message); $this->assertSession()->pageTextContains('File name is php-2.php.txt.'); - $this->assertRaw(t('File MIME type is text/plain.'), "Dangerous file's MIME type was changed."); - $this->assertRaw(t('You WIN!'), 'Found the success message.'); + $this->assertRaw(t('File MIME type is text/plain.')); + $this->assertRaw(t('You WIN!')); // Check that the correct hooks were called. $this->assertFileHooksCalled(['validate', 'insert']); @@ -262,9 +263,9 @@ class SaveUploadTest extends FileManagedTestBase { $this->drupalPostForm('file-test/upload', $edit, t('Submit')); $this->assertSession()->statusCodeEquals(200); - $this->assertNoRaw(t('For security reasons, your upload has been renamed'), 'Found no security message.'); + $this->assertNoRaw(t('For security reasons, your upload has been renamed')); $this->assertSession()->pageTextContains('File name is php-2.php.'); - $this->assertRaw(t('You WIN!'), 'Found the success message.'); + $this->assertRaw(t('You WIN!')); // Check that the correct hooks were called. $this->assertFileHooksCalled(['validate', 'insert']); @@ -296,9 +297,9 @@ class SaveUploadTest extends FileManagedTestBase { $this->drupalPostForm('file-test/upload', $edit, t('Submit')); $this->assertSession()->statusCodeEquals(200); - $this->assertRaw(t('For security reasons, your upload has been renamed'), 'Found security message.'); - $this->assertRaw(t('File name is @filename', ['@filename' => $munged_filename]), 'File was successfully munged.'); - $this->assertRaw(t('You WIN!'), 'Found the success message.'); + $this->assertRaw(t('For security reasons, your upload has been renamed')); + $this->assertRaw(t('File name is @filename', ['@filename' => $munged_filename])); + $this->assertRaw(t('You WIN!')); // Check that the correct hooks were called. $this->assertFileHooksCalled(['validate', 'insert']); @@ -314,9 +315,9 @@ class SaveUploadTest extends FileManagedTestBase { $this->drupalPostForm('file-test/upload', $edit, t('Submit')); $this->assertSession()->statusCodeEquals(200); - $this->assertNoRaw(t('For security reasons, your upload has been renamed'), 'Found no security message.'); - $this->assertRaw(t('File name is @filename', ['@filename' => $this->image->getFilename()]), 'File was not munged when allowing any extension.'); - $this->assertRaw(t('You WIN!'), 'Found the success message.'); + $this->assertNoRaw(t('For security reasons, your upload has been renamed')); + $this->assertRaw(t('File name is @filename', ['@filename' => $this->image->getFilename()])); + $this->assertRaw(t('You WIN!')); // Check that the correct hooks were called. $this->assertFileHooksCalled(['validate', 'insert']); @@ -332,7 +333,7 @@ class SaveUploadTest extends FileManagedTestBase { ]; $this->drupalPostForm('file-test/upload', $edit, t('Submit')); $this->assertSession()->statusCodeEquals(200); - $this->assertRaw(t('You WIN!'), 'Found the success message.'); + $this->assertRaw(t('You WIN!')); $this->assertSession()->pageTextContains('File name is image-test_0.png.'); // Check that the correct hooks were called. @@ -349,7 +350,7 @@ class SaveUploadTest extends FileManagedTestBase { ]; $this->drupalPostForm('file-test/upload', $edit, t('Submit')); $this->assertSession()->statusCodeEquals(200); - $this->assertRaw(t('You WIN!'), 'Found the success message.'); + $this->assertRaw(t('You WIN!')); $this->assertSession()->pageTextContains('File name is image-test.png.'); // Check that the correct hooks were called. @@ -366,7 +367,7 @@ class SaveUploadTest extends FileManagedTestBase { ]; $this->drupalPostForm('file-test/upload', $edit, t('Submit')); $this->assertSession()->statusCodeEquals(200); - $this->assertRaw(t('Epic upload FAIL!'), 'Found the failure message.'); + $this->assertRaw(t('Epic upload FAIL!')); // Check that the no hooks were called while failing. $this->assertFileHooksCalled([]); @@ -377,7 +378,7 @@ class SaveUploadTest extends FileManagedTestBase { */ public function testNoUpload() { $this->drupalPostForm('file-test/upload', [], t('Submit')); - $this->assertNoRaw(t('Epic upload FAIL!'), 'Failure message not found.'); + $this->assertNoRaw(t('Epic upload FAIL!')); } /** @@ -399,8 +400,8 @@ class SaveUploadTest extends FileManagedTestBase { \Drupal::state()->set('file_test.disable_error_collection', TRUE); $this->drupalPostForm('file-test/upload', $edit, t('Submit')); $this->assertSession()->statusCodeEquals(200); - $this->assertRaw(t('File upload error. Could not move uploaded file.'), 'Found the failure message.'); - $this->assertRaw(t('Epic upload FAIL!'), 'Found the failure message.'); + $this->assertRaw(t('File upload error. Could not move uploaded file.')); + $this->assertRaw(t('Epic upload FAIL!')); // Uploading failed. Now check the log. $this->drupalGet('admin/reports/dblog'); @@ -408,7 +409,7 @@ class SaveUploadTest extends FileManagedTestBase { $this->assertRaw(t('Upload error. Could not move uploaded file @file to destination @destination.', [ '@file' => $this->image->getFilename(), '@destination' => 'temporary://' . $test_directory . '/' . $this->image->getFilename(), - ]), 'Found upload error log entry.'); + ])); } /** diff --git a/core/modules/filter/tests/src/Functional/FilterAdminTest.php b/core/modules/filter/tests/src/Functional/FilterAdminTest.php index 9ddc4f204ad..452df147885 100644 --- a/core/modules/filter/tests/src/Functional/FilterAdminTest.php +++ b/core/modules/filter/tests/src/Functional/FilterAdminTest.php @@ -204,7 +204,7 @@ class FilterAdminTest extends BrowserTestBase { // Check that the fallback format exists and cannot be disabled. $this->assertTrue($plain == filter_fallback_format(), 'The fallback format is set to plain text.'); $this->drupalGet('admin/config/content/formats'); - $this->assertNoRaw('admin/config/content/formats/manage/' . $plain . '/disable', 'Disable link for the fallback format not found.'); + $this->assertNoRaw('admin/config/content/formats/manage/' . $plain . '/disable'); $this->drupalGet('admin/config/content/formats/manage/' . $plain . '/disable'); $this->assertSession()->statusCodeEquals(403); @@ -261,7 +261,7 @@ class FilterAdminTest extends BrowserTestBase { $edit['filters[' . $first_filter . '][status]'] = TRUE; $this->drupalPostForm('admin/config/content/formats/add', $edit, t('Save configuration')); $this->assertSession()->addressEquals('admin/config/content/formats'); - $this->assertRaw(t('Added text format %format.', ['%format' => $edit['name']]), 'New filter created.'); + $this->assertRaw(t('Added text format %format.', ['%format' => $edit['name']])); filter_formats_reset(); $format = FilterFormat::load($edit['format']); @@ -274,7 +274,7 @@ class FilterAdminTest extends BrowserTestBase { // Disable new filter. $this->drupalPostForm('admin/config/content/formats/manage/' . $format->id() . '/disable', [], t('Disable')); $this->assertSession()->addressEquals('admin/config/content/formats'); - $this->assertRaw(t('Disabled text format %format.', ['%format' => $edit['name']]), 'Format successfully disabled.'); + $this->assertRaw(t('Disabled text format %format.', ['%format' => $edit['name']])); // Allow authenticated users on full HTML. $format = FilterFormat::load($full); @@ -283,13 +283,13 @@ class FilterAdminTest extends BrowserTestBase { $edit['roles[' . RoleInterface::AUTHENTICATED_ID . ']'] = 1; $this->drupalPostForm('admin/config/content/formats/manage/' . $full, $edit, t('Save configuration')); $this->assertSession()->addressEquals('admin/config/content/formats/manage/' . $full); - $this->assertRaw(t('The text format %format has been updated.', ['%format' => $format->label()]), 'Full HTML format successfully updated.'); + $this->assertRaw(t('The text format %format has been updated.', ['%format' => $format->label()])); // Switch user. $this->drupalLogin($this->webUser); $this->drupalGet('node/add/page'); - $this->assertRaw('', 'Full HTML filter accessible.'); + $this->assertRaw(''); // Use basic HTML and see if it removes tags that are not allowed. $body = '' . $this->randomMachineName() . ''; @@ -311,7 +311,8 @@ class FilterAdminTest extends BrowserTestBase { $this->assertNotEmpty($node, 'Node found in database.'); $this->drupalGet('node/' . $node->id()); - $this->assertRaw($body . $extra_text, 'Filter removed invalid tag.'); + // Check that filter removed invalid tag. + $this->assertRaw($body . $extra_text); // Use plain text and see if it escapes all tags, whether allowed or not. // In order to test plain text, we have to enable the hidden variable for @@ -345,7 +346,7 @@ class FilterAdminTest extends BrowserTestBase { $edit['roles[' . RoleInterface::AUTHENTICATED_ID . ']'] = FALSE; $this->drupalPostForm('admin/config/content/formats/manage/' . $full, $edit, t('Save configuration')); $this->assertSession()->addressEquals('admin/config/content/formats/manage/' . $full); - $this->assertRaw(t('The text format %format has been updated.', ['%format' => $format->label()]), 'Full HTML format successfully reverted.'); + $this->assertRaw(t('The text format %format has been updated.', ['%format' => $format->label()])); $this->drupalGet('admin/config/content/formats/manage/' . $full); $this->assertFieldByName('roles[' . RoleInterface::AUTHENTICATED_ID . ']', $edit['roles[' . RoleInterface::AUTHENTICATED_ID . ']'], 'Changes reverted.'); diff --git a/core/modules/forum/tests/src/Functional/ForumTest.php b/core/modules/forum/tests/src/Functional/ForumTest.php index 28ceb971809..790b88426b2 100644 --- a/core/modules/forum/tests/src/Functional/ForumTest.php +++ b/core/modules/forum/tests/src/Functional/ForumTest.php @@ -135,7 +135,7 @@ class ForumTest extends BrowserTestBase { // Check that the basic forum install creates a default forum topic $this->drupalGet('/forum'); // Look for the "General discussion" default forum - $this->assertRaw(Link::createFromRoute(t('General discussion'), 'forum.page', ['taxonomy_term' => 1])->toString(), "Found the default forum at the /forum listing"); + $this->assertRaw(Link::createFromRoute(t('General discussion'), 'forum.page', ['taxonomy_term' => 1])->toString()); // Check the presence of expected cache tags. $this->assertSession()->responseHeaderContains('X-Drupal-Cache-Tags', 'config:forum.settings'); @@ -326,13 +326,13 @@ class ForumTest extends BrowserTestBase { $this->assertSession()->linkExists('Add forum'); $this->assertSession()->linkExists('Add container'); $this->clickLink('edit container'); - $this->assertRaw('Edit container', 'Followed the link to edit the container'); + $this->assertRaw('Edit container'); // Create forum inside the forum container. $this->forum = $this->createForum('forum', $this->forumContainer['tid']); // Verify the "edit forum" link exists and functions correctly. $this->drupalGet('admin/structure/forum'); $this->clickLink('edit forum'); - $this->assertRaw('Edit forum', 'Followed the link to edit the forum'); + $this->assertRaw('Edit forum'); // Navigate back to forum structure page. $this->drupalGet('admin/structure/forum'); // Create second forum in container, destined to be deleted below. @@ -395,7 +395,7 @@ class ForumTest extends BrowserTestBase { // Edit the vocabulary. $this->drupalPostForm('admin/structure/taxonomy/manage/' . $original_vocabulary->id(), $edit, t('Save')); $this->assertSession()->statusCodeEquals(200); - $this->assertRaw(t('Updated vocabulary %name.', ['%name' => $edit['name']]), 'Vocabulary was edited'); + $this->assertRaw(t('Updated vocabulary %name.', ['%name' => $edit['name']])); // Grab the newly edited vocabulary. $current_vocabulary = Vocabulary::load($vid); @@ -581,12 +581,12 @@ class ForumTest extends BrowserTestBase { $type = t('Forum topic'); if ($container) { $this->assertNoText("$type $title has been created.", 'Forum topic was not created'); - $this->assertRaw(t('The item %title is a forum container, not a forum.', ['%title' => $forum['name']]), 'Error message was shown'); + $this->assertRaw(t('The item %title is a forum container, not a forum.', ['%title' => $forum['name']])); return; } else { $this->assertText(t('@type @title has been created.', ['@type' => $type, '@title' => $title]), 'Forum topic was created'); - $this->assertNoRaw(t('The item %title is a forum container, not a forum.', ['%title' => $forum['name']]), 'No error message was shown'); + $this->assertNoRaw(t('The item %title is a forum container, not a forum.', ['%title' => $forum['name']])); // Verify that the creation message contains a link to a node. $this->assertSession()->elementExists('xpath', '//div[@data-drupal-messages]//a[contains(@href, "node/")]'); @@ -599,8 +599,8 @@ class ForumTest extends BrowserTestBase { // View forum topic. $this->drupalGet('node/' . $node->id()); - $this->assertRaw($title, 'Subject was found'); - $this->assertRaw($body, 'Body was found'); + $this->assertRaw($title); + $this->assertRaw($body); return $node; } @@ -647,7 +647,7 @@ class ForumTest extends BrowserTestBase { '#theme' => 'breadcrumb', '#links' => $breadcrumb_build, ]; - $this->assertRaw(\Drupal::service('renderer')->renderRoot($breadcrumb), 'Breadcrumbs were displayed'); + $this->assertRaw(\Drupal::service('renderer')->renderRoot($breadcrumb)); // View forum edit node. $this->drupalGet('node/' . $node->id() . '/edit'); @@ -681,7 +681,7 @@ class ForumTest extends BrowserTestBase { // Delete forum node. $this->drupalPostForm('node/' . $node->id() . '/delete', [], t('Delete')); $this->assertSession()->statusCodeEquals($response); - $this->assertRaw(t('Forum topic %title has been deleted.', ['%title' => $edit['title[0][value]']]), 'Forum node was deleted'); + $this->assertRaw(t('Forum topic %title has been deleted.', ['%title' => $edit['title[0][value]']])); } } @@ -711,7 +711,7 @@ class ForumTest extends BrowserTestBase { '#theme' => 'breadcrumb', '#links' => $breadcrumb_build, ]; - $this->assertRaw(\Drupal::service('renderer')->renderRoot($breadcrumb), 'Breadcrumbs were displayed'); + $this->assertRaw(\Drupal::service('renderer')->renderRoot($breadcrumb)); } /** diff --git a/core/modules/help/tests/src/Functional/HelpTest.php b/core/modules/help/tests/src/Functional/HelpTest.php index a6beca0cc6a..541211c8766 100644 --- a/core/modules/help/tests/src/Functional/HelpTest.php +++ b/core/modules/help/tests/src/Functional/HelpTest.php @@ -77,11 +77,11 @@ class HelpTest extends BrowserTestBase { // Verify that hook_help() section title and description appear. $this->assertRaw('

' . t('Module overviews') . '

'); - $this->assertRaw('

' . t('Module overviews are provided by modules. Overviews available for your installed modules:'), '

'); + $this->assertRaw('

' . t('Module overviews are provided by modules. Overviews available for your installed modules:') . '

'); // Verify that an empty section is handled correctly. $this->assertRaw('

' . t('Empty section') . '

'); - $this->assertRaw('

' . t('This description should appear.'), '

'); + $this->assertRaw('

' . t('This description should appear.') . '

'); $this->assertText(t('There is currently nothing in this section.')); // Make sure links are properly added for modules implementing hook_help(). diff --git a/core/modules/image/tests/src/Functional/ImageAdminStylesTest.php b/core/modules/image/tests/src/Functional/ImageAdminStylesTest.php index 394fd4d7700..8d1e4ef7929 100644 --- a/core/modules/image/tests/src/Functional/ImageAdminStylesTest.php +++ b/core/modules/image/tests/src/Functional/ImageAdminStylesTest.php @@ -338,7 +338,7 @@ class ImageAdminStylesTest extends ImageFieldTestBase { // Test that image is displayed using newly created style. $this->drupalGet('node/' . $nid); - $this->assertRaw(file_url_transform_relative($style->buildUrl($original_uri)), new FormattableMarkup('Image displayed using style @style.', ['@style' => $style_name])); + $this->assertRaw(file_url_transform_relative($style->buildUrl($original_uri))); // Rename the style and make sure the image field is updated. $new_style_name = strtolower($this->randomMachineName(10)); @@ -353,7 +353,7 @@ class ImageAdminStylesTest extends ImageFieldTestBase { // Reload the image style using the new name. $style = ImageStyle::load($new_style_name); - $this->assertRaw(file_url_transform_relative($style->buildUrl($original_uri)), 'Image displayed using style replacement style.'); + $this->assertRaw(file_url_transform_relative($style->buildUrl($original_uri))); // Delete the style and choose a replacement style. $edit = [ @@ -365,7 +365,7 @@ class ImageAdminStylesTest extends ImageFieldTestBase { $replacement_style = ImageStyle::load('thumbnail'); $this->drupalGet('node/' . $nid); - $this->assertRaw(file_url_transform_relative($replacement_style->buildUrl($original_uri)), 'Image displayed using style replacement style.'); + $this->assertRaw(file_url_transform_relative($replacement_style->buildUrl($original_uri))); } /** @@ -484,7 +484,7 @@ class ImageAdminStylesTest extends ImageFieldTestBase { // Test that image is displayed using newly created style. $this->drupalGet('node/' . $nid); - $this->assertRaw(file_url_transform_relative($style->buildUrl($original_uri)), new FormattableMarkup('Image displayed using style @style.', ['@style' => $style_name])); + $this->assertRaw(file_url_transform_relative($style->buildUrl($original_uri))); // Copy config to sync, and delete the image style. $sync = $this->container->get('config.storage.sync'); diff --git a/core/modules/image/tests/src/Functional/ImageFieldDisplayTest.php b/core/modules/image/tests/src/Functional/ImageFieldDisplayTest.php index 568db12d0f7..d3a6a8b2fed 100644 --- a/core/modules/image/tests/src/Functional/ImageFieldDisplayTest.php +++ b/core/modules/image/tests/src/Functional/ImageFieldDisplayTest.php @@ -117,7 +117,7 @@ class ImageFieldDisplayTest extends ImageFieldTestBase { '#alt' => $alt, ]; $default_output = str_replace("\n", NULL, $renderer->renderRoot($image)); - $this->assertRaw($default_output, 'Default formatter displaying correctly on full node view.'); + $this->assertRaw($default_output); // Test the image linked to file formatter. $display_options = [ @@ -143,7 +143,7 @@ class ImageFieldDisplayTest extends ImageFieldTestBase { $this->assertCacheContext('url.site'); // Verify that no image style cache tags are found. $this->assertSession()->responseHeaderNotContains('X-Drupal-Cache-Tags', 'image_style:'); - $this->assertRaw($default_output, 'Image linked to file formatter displaying correctly on full node view.'); + $this->assertRaw($default_output); // Verify that the image can be downloaded. $this->assertEqual(file_get_contents($test_image->uri), $this->drupalGet(file_create_url($image_uri)), 'File was downloaded successfully.'); if ($scheme == 'private') { @@ -208,7 +208,7 @@ class ImageFieldDisplayTest extends ImageFieldTestBase { $this->drupalGet('node/' . $nid); $image_style = ImageStyle::load('thumbnail'); $this->assertSession()->responseHeaderContains('X-Drupal-Cache-Tags', $image_style->getCacheTags()[0]); - $this->assertRaw($default_output, 'Image style thumbnail formatter displaying correctly on full node view.'); + $this->assertRaw($default_output); if ($scheme == 'private') { // Log out and ensure the file cannot be accessed. @@ -304,7 +304,7 @@ class ImageFieldDisplayTest extends ImageFieldTestBase { ]; $this->drupalPostForm('node/' . $nid . '/edit', $edit, t('Save')); $default_output = str_replace("\n", NULL, $renderer->renderRoot($image)); - $this->assertRaw($default_output, 'Image displayed using user supplied alt and title attributes.'); + $this->assertRaw($default_output); // Verify that alt/title longer than allowed results in a validation error. $test_size = 2000; @@ -401,7 +401,7 @@ class ImageFieldDisplayTest extends ImageFieldTestBase { $this->assertSession()->responseHeaderContains('X-Drupal-Cache-Tags', $file->getCacheTags()[0]); // Verify that no image style cache tags are found. $this->assertSession()->responseHeaderNotContains('X-Drupal-Cache-Tags', 'image_style:'); - $this->assertRaw($default_output, 'Default image displayed when no user supplied image is present.'); + $this->assertRaw($default_output); // Create a node with an image attached and ensure that the default image // is not displayed. @@ -426,8 +426,10 @@ class ImageFieldDisplayTest extends ImageFieldTestBase { $this->assertSession()->responseHeaderContains('X-Drupal-Cache-Tags', $file->getCacheTags()[0]); // Verify that no image style cache tags are found. $this->assertSession()->responseHeaderNotContains('X-Drupal-Cache-Tags', 'image_style:'); - $this->assertNoRaw($default_output, 'Default image is not displayed when user supplied image is present.'); - $this->assertRaw($image_output, 'User supplied image is displayed.'); + // Default image should not be displayed. + $this->assertNoRaw($default_output); + // User supplied image should be displayed. + $this->assertRaw($image_output); // Remove default image from the field and make sure it is no longer used. // Can't use fillField cause Mink can't fill hidden fields. @@ -477,7 +479,9 @@ class ImageFieldDisplayTest extends ImageFieldTestBase { $this->assertSession()->responseHeaderContains('X-Drupal-Cache-Tags', $file->getCacheTags()[0]); // Verify that no image style cache tags are found. $this->assertSession()->responseHeaderNotContains('X-Drupal-Cache-Tags', 'image_style:'); - $this->assertRaw($default_output, 'Default private image displayed when no user supplied image is present.'); + // Default private image should be displayed when no user supplied image + // is present. + $this->assertRaw($default_output); } } diff --git a/core/modules/language/tests/src/Functional/LanguageBrowserDetectionTest.php b/core/modules/language/tests/src/Functional/LanguageBrowserDetectionTest.php index 9d66dc69c15..c926f1e32f0 100644 --- a/core/modules/language/tests/src/Functional/LanguageBrowserDetectionTest.php +++ b/core/modules/language/tests/src/Functional/LanguageBrowserDetectionTest.php @@ -56,7 +56,7 @@ class LanguageBrowserDetectionTest extends BrowserTestBase { $t_args = [ '%browser' => $browser_langcode, ]; - $this->assertRaw(t('The mapping for the %browser browser language code has been deleted.', $t_args), 'The test browser language code has been deleted.'); + $this->assertRaw(t('The mapping for the %browser browser language code has been deleted.', $t_args)); // Check we went back to the browser negotiation mapping overview. $this->assertSession()->addressEquals(Url::fromRoute('language.negotiation_browser')); diff --git a/core/modules/language/tests/src/Functional/LanguageListTest.php b/core/modules/language/tests/src/Functional/LanguageListTest.php index 778e6e56283..4449d5fd325 100644 --- a/core/modules/language/tests/src/Functional/LanguageListTest.php +++ b/core/modules/language/tests/src/Functional/LanguageListTest.php @@ -70,7 +70,7 @@ class LanguageListTest extends BrowserTestBase { ]; $this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add custom language')); $this->assertSession()->addressEquals(Url::fromRoute('entity.configurable_language.collection')); - $this->assertRaw('"edit-languages-' . $langcode . '-weight"', 'Language code found.'); + $this->assertRaw('"edit-languages-' . $langcode . '-weight"'); $this->assertText(t($name), 'Test language added.'); $language = \Drupal::service('language_manager')->getLanguage($langcode); @@ -103,7 +103,7 @@ class LanguageListTest extends BrowserTestBase { 'label' => $name, ]; $this->drupalPostForm('admin/config/regional/language/edit/' . $langcode, $edit, t('Save language')); - $this->assertRaw($name, 'The language has been updated.'); + $this->assertRaw($name); $this->assertSession()->addressEquals(Url::fromRoute('entity.configurable_language.collection', [], ['language' => $language])); // Change back the default language. @@ -121,13 +121,13 @@ class LanguageListTest extends BrowserTestBase { // First test the 'cancel' link. $this->clickLink(t('Cancel')); $this->assertSession()->addressEquals(Url::fromRoute('entity.configurable_language.collection', [], ['language' => $english])); - $this->assertRaw($name, 'The language was not deleted.'); + $this->assertRaw($name); // Delete the language for real. This a confirm form, we do not need any // fields changed. $this->drupalPostForm('admin/config/regional/language/delete/' . $langcode, [], t('Delete')); // We need raw here because %language and %langcode will add HTML. $t_args = ['%language' => $name, '%langcode' => $langcode]; - $this->assertRaw(t('The %language (%langcode) language has been removed.', $t_args), 'The test language has been removed.'); + $this->assertRaw(t('The %language (%langcode) language has been removed.', $t_args)); $this->assertSession()->addressEquals(Url::fromRoute('entity.configurable_language.collection', [], ['language' => $english])); // Verify that language is no longer found. $this->drupalGet('admin/config/regional/language/delete/' . $langcode); @@ -139,7 +139,7 @@ class LanguageListTest extends BrowserTestBase { $this->rebuildContainer(); // We need raw here because %language and %langcode will add HTML. $t_args = ['%language' => 'French', '%langcode' => 'fr']; - $this->assertRaw(t('The %language (%langcode) language has been removed.', $t_args), 'The French language has been removed.'); + $this->assertRaw(t('The %language (%langcode) language has been removed.', $t_args)); $this->assertSession()->addressEquals(Url::fromRoute('entity.configurable_language.collection')); // Verify that language is no longer found. $this->drupalGet('admin/config/regional/language/delete/fr'); @@ -177,7 +177,7 @@ class LanguageListTest extends BrowserTestBase { $this->drupalPostForm('admin/config/regional/language/delete/en', [], t('Delete')); // We need raw here because %language and %langcode will add HTML. $t_args = ['%language' => 'English', '%langcode' => 'en']; - $this->assertRaw(t('The %language (%langcode) language has been removed.', $t_args), 'The English language has been removed.'); + $this->assertRaw(t('The %language (%langcode) language has been removed.', $t_args)); $this->rebuildContainer(); // Ensure we can't delete a locked language. diff --git a/core/modules/language/tests/src/Functional/LanguageNegotiationInfoTest.php b/core/modules/language/tests/src/Functional/LanguageNegotiationInfoTest.php index 2a3c5d9c695..2deb282df0d 100644 --- a/core/modules/language/tests/src/Functional/LanguageNegotiationInfoTest.php +++ b/core/modules/language/tests/src/Functional/LanguageNegotiationInfoTest.php @@ -159,8 +159,8 @@ class LanguageNegotiationInfoTest extends BrowserTestBase { $this->assertFalse(isset($negotiation[$test_method_id]), 'The disabled test language negotiation method is not part of the content language negotiation settings.'); // Check that configuration page presents the correct options and settings. - $this->assertNoRaw(t('Test language detection'), 'No test language type configuration available.'); - $this->assertNoRaw(t('This is a test language negotiation method'), 'No test language negotiation method available.'); + $this->assertNoRaw(t('Test language detection')); + $this->assertNoRaw(t('This is a test language negotiation method')); } /** diff --git a/core/modules/language/tests/src/Functional/LanguageUrlRewritingTest.php b/core/modules/language/tests/src/Functional/LanguageUrlRewritingTest.php index 22eeaadb61a..399425379c7 100644 --- a/core/modules/language/tests/src/Functional/LanguageUrlRewritingTest.php +++ b/core/modules/language/tests/src/Functional/LanguageUrlRewritingTest.php @@ -56,7 +56,7 @@ class LanguageUrlRewritingTest extends BrowserTestBase { // Check that drupalSettings contains path prefix. $this->drupalGet('fr/admin/config/regional/language/detection'); - $this->assertRaw('"pathPrefix":"fr\/"', 'drupalSettings path prefix contains language code.'); + $this->assertRaw('"pathPrefix":"fr\/"'); } /** diff --git a/core/modules/locale/tests/src/Functional/LocaleContentTest.php b/core/modules/locale/tests/src/Functional/LocaleContentTest.php index 9f93136c0dc..0e5352842ba 100644 --- a/core/modules/locale/tests/src/Functional/LocaleContentTest.php +++ b/core/modules/locale/tests/src/Functional/LocaleContentTest.php @@ -131,7 +131,7 @@ class LocaleContentTest extends BrowserTestBase { // Edit the content and ensure correct language is selected. $path = 'node/' . $node->id() . '/edit'; $this->drupalGet($path); - $this->assertRaw('', 'Correct language selected.'); + $this->assertRaw(''); // Ensure we can change the node language. $edit = [ 'langcode[0][value]' => 'en', diff --git a/core/modules/locale/tests/src/Functional/LocaleExportTest.php b/core/modules/locale/tests/src/Functional/LocaleExportTest.php index 0088c29512a..e6412c38538 100644 --- a/core/modules/locale/tests/src/Functional/LocaleExportTest.php +++ b/core/modules/locale/tests/src/Functional/LocaleExportTest.php @@ -68,9 +68,9 @@ class LocaleExportTest extends BrowserTestBase { ], t('Export')); // Ensure we have a translation file. - $this->assertRaw('# French translation of Drupal', 'Exported French translation file.'); + $this->assertRaw('# French translation of Drupal'); // Ensure our imported translations exist in the file. - $this->assertRaw('msgstr "lundi"', 'French translations present in exported file.'); + $this->assertRaw('msgstr "lundi"'); // Import some more French translations which will be marked as customized. $name = $file_system->tempnam('temporary://', "po2_") . '.po'; @@ -98,11 +98,11 @@ class LocaleExportTest extends BrowserTestBase { ], t('Export')); // Ensure we have a translation file. - $this->assertRaw('# French translation of Drupal', 'Exported French translation file with only customized strings.'); + $this->assertRaw('# French translation of Drupal'); // Ensure the customized translations exist in the file. - $this->assertRaw('msgstr "janvier"', 'French custom translation present in exported file.'); + $this->assertRaw('msgstr "janvier"'); // Ensure no untranslated strings exist in the file. - $this->assertNoRaw('msgid "February"', 'Untranslated string not present in exported file.'); + $this->assertNoRaw('msgid "February"'); // Export only untranslated French translations. $this->drupalPostForm('admin/config/regional/translate/export', [ @@ -113,11 +113,11 @@ class LocaleExportTest extends BrowserTestBase { ], t('Export')); // Ensure we have a translation file. - $this->assertRaw('# French translation of Drupal', 'Exported French translation file with only untranslated strings.'); + $this->assertRaw('# French translation of Drupal'); // Ensure no customized translations exist in the file. - $this->assertNoRaw('msgstr "janvier"', 'French custom translation not present in exported file.'); + $this->assertNoRaw('msgstr "janvier"'); // Ensure the untranslated strings exist in the file, and with right quotes. - $this->assertRaw($this->getUntranslatedString(), 'Empty string present in exported file.'); + $this->assertRaw($this->getUntranslatedString()); } /** @@ -131,7 +131,7 @@ class LocaleExportTest extends BrowserTestBase { // Get the translation template file. $this->drupalPostForm('admin/config/regional/translate/export', [], t('Export')); // Ensure we have a translation file. - $this->assertRaw('# LANGUAGE translation of PROJECT', 'Exported translation template file.'); + $this->assertRaw('# LANGUAGE translation of PROJECT'); } /** diff --git a/core/modules/locale/tests/src/Functional/LocaleImportFunctionalTest.php b/core/modules/locale/tests/src/Functional/LocaleImportFunctionalTest.php index 10c03f97e09..544ce7dfdbc 100644 --- a/core/modules/locale/tests/src/Functional/LocaleImportFunctionalTest.php +++ b/core/modules/locale/tests/src/Functional/LocaleImportFunctionalTest.php @@ -86,10 +86,10 @@ class LocaleImportFunctionalTest extends BrowserTestBase { ]); $this->config('locale.settings'); // The import should automatically create the corresponding language. - $this->assertRaw(t('The language %language has been created.', ['%language' => 'French']), 'The language has been automatically created.'); + $this->assertRaw(t('The language %language has been created.', ['%language' => 'French'])); // The import should have created 8 strings. - $this->assertRaw(t('One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.', ['%number' => 8, '%update' => 0, '%delete' => 0]), 'The translation file was successfully imported.'); + $this->assertRaw(t('One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.', ['%number' => 8, '%update' => 0, '%delete' => 0])); // This import should have saved plural forms to have 2 variants. $locale_plurals = \Drupal::service('locale.plural.formula')->getNumberOfPlurals('fr'); @@ -104,10 +104,10 @@ class LocaleImportFunctionalTest extends BrowserTestBase { ]); // The import should have created 1 string and rejected 2. - $this->assertRaw(t('One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.', ['%number' => 1, '%update' => 0, '%delete' => 0]), 'The translation file was successfully imported.'); + $this->assertRaw(t('One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.', ['%number' => 1, '%update' => 0, '%delete' => 0])); $skip_message = \Drupal::translation()->formatPlural(2, 'One translation string was skipped because of disallowed or malformed HTML. See the log for details.', '@count translation strings were skipped because of disallowed or malformed HTML. See the log for details.', [':url' => Url::fromRoute('dblog.overview')->toString()]); - $this->assertRaw($skip_message, 'Unsafe strings were skipped.'); + $this->assertRaw($skip_message); // Repeat the process with a user that can access site reports, and this // time the different warnings must contain links to the log. @@ -119,7 +119,7 @@ class LocaleImportFunctionalTest extends BrowserTestBase { ]); $skip_message = \Drupal::translation()->formatPlural(2, 'One translation string was skipped because of disallowed or malformed HTML. See the log for details.', '@count translation strings were skipped because of disallowed or malformed HTML. See the log for details.', [':url' => Url::fromRoute('dblog.overview')->toString()]); - $this->assertRaw($skip_message, 'Unsafe strings were skipped.'); + $this->assertRaw($skip_message); // Check empty files import with a user that cannot access site reports.. $this->drupalLogin($this->adminUser); @@ -128,7 +128,7 @@ class LocaleImportFunctionalTest extends BrowserTestBase { 'langcode' => 'fr', ]); // The import should have created 0 string and rejected 0. - $this->assertRaw(t('One translation file could not be imported. See the log for details.'), 'The empty translation file import reported no translations imported.'); + $this->assertRaw(t('One translation file could not be imported. See the log for details.')); // Repeat the process with a user that can access site reports, and this // time the different warnings must contain links to the log. @@ -138,7 +138,7 @@ class LocaleImportFunctionalTest extends BrowserTestBase { 'langcode' => 'fr', ]); // The import should have created 0 string and rejected 0. - $this->assertRaw(t('One translation file could not be imported. See the log for details.', [':url' => Url::fromRoute('dblog.overview')->toString()]), 'The empty translation file import reported no translations imported.'); + $this->assertRaw(t('One translation file could not be imported. See the log for details.', [':url' => Url::fromRoute('dblog.overview')->toString()])); // Try importing a .po file which doesn't exist. $name = $this->randomMachineName(16); @@ -156,7 +156,7 @@ class LocaleImportFunctionalTest extends BrowserTestBase { ]); // The import should have created 1 string. - $this->assertRaw(t('One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.', ['%number' => 1, '%update' => 0, '%delete' => 0]), 'The translation file was successfully imported.'); + $this->assertRaw(t('One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.', ['%number' => 1, '%update' => 0, '%delete' => 0])); // Ensure string wasn't overwritten. $search = [ 'string' => 'Montag', @@ -178,7 +178,7 @@ class LocaleImportFunctionalTest extends BrowserTestBase { ]); // The import should have updated 2 strings. - $this->assertRaw(t('One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.', ['%number' => 0, '%update' => 2, '%delete' => 0]), 'The translation file was successfully imported.'); + $this->assertRaw(t('One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.', ['%number' => 0, '%update' => 2, '%delete' => 0])); // Ensure string was overwritten. $search = [ 'string' => 'Montag', @@ -198,7 +198,7 @@ class LocaleImportFunctionalTest extends BrowserTestBase { ]); // The import should have created 6 strings. - $this->assertRaw(t('One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.', ['%number' => 6, '%update' => 0, '%delete' => 0]), 'The customized translation file was successfully imported.'); + $this->assertRaw(t('One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.', ['%number' => 6, '%update' => 0, '%delete' => 0])); // The database should now contain 6 customized strings (two imported // strings are not translated). @@ -218,7 +218,7 @@ class LocaleImportFunctionalTest extends BrowserTestBase { ]); // The import should have created 1 string. - $this->assertRaw(t('One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.', ['%number' => 1, '%update' => 0, '%delete' => 0]), 'The customized translation file was successfully imported.'); + $this->assertRaw(t('One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.', ['%number' => 1, '%update' => 0, '%delete' => 0])); // Ensure string wasn't overwritten. $search = [ 'string' => 'januari', @@ -237,7 +237,7 @@ class LocaleImportFunctionalTest extends BrowserTestBase { ]); // The import should have updated 2 strings. - $this->assertRaw(t('One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.', ['%number' => 0, '%update' => 2, '%delete' => 0]), 'The customized translation file was successfully imported.'); + $this->assertRaw(t('One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.', ['%number' => 0, '%update' => 2, '%delete' => 0])); // Ensure string was overwritten. $search = [ 'string' => 'januari', @@ -275,7 +275,7 @@ class LocaleImportFunctionalTest extends BrowserTestBase { 'langcode' => $langcode, ]); - $this->assertRaw(t('One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.', ['%number' => 1, '%update' => 0, '%delete' => 0]), 'The translation file was successfully imported.'); + $this->assertRaw(t('One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.', ['%number' => 1, '%update' => 0, '%delete' => 0])); $this->assertIdentical((string) t('Operations', [], ['langcode' => $langcode]), 'Műveletek', 'String imported and translated.'); // Try importing a .po file. @@ -283,7 +283,7 @@ class LocaleImportFunctionalTest extends BrowserTestBase { 'langcode' => $langcode, 'overwrite_options[not_customized]' => TRUE, ]); - $this->assertRaw(t('One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.', ['%number' => 0, '%update' => 0, '%delete' => 1]), 'The translation file was successfully imported.'); + $this->assertRaw(t('One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.', ['%number' => 0, '%update' => 0, '%delete' => 1])); $str = "Operations"; $search = [ diff --git a/core/modules/locale/tests/src/Functional/LocalePluralFormatTest.php b/core/modules/locale/tests/src/Functional/LocalePluralFormatTest.php index 9a6428ed9a5..fad503dc383 100644 --- a/core/modules/locale/tests/src/Functional/LocalePluralFormatTest.php +++ b/core/modules/locale/tests/src/Functional/LocalePluralFormatTest.php @@ -246,22 +246,22 @@ class LocalePluralFormatTest extends BrowserTestBase { 'langcode' => 'fr', ], t('Export')); // Ensure we have a translation file. - $this->assertRaw('# French translation of Drupal', 'Exported French translation file.'); + $this->assertRaw('# French translation of Drupal'); // Ensure our imported translations exist in the file. - $this->assertRaw("msgid \"Monday\"\nmsgstr \"lundi\"", 'French translations present in exported file.'); + $this->assertRaw("msgid \"Monday\"\nmsgstr \"lundi\""); // Check for plural export specifically. - $this->assertRaw("msgid \"1 hour\"\nmsgid_plural \"@count hours\"\nmsgstr[0] \"@count heure\"\nmsgstr[1] \"@count heures\"", 'Plural translations exported properly.'); + $this->assertRaw("msgid \"1 hour\"\nmsgid_plural \"@count hours\"\nmsgstr[0] \"@count heure\"\nmsgstr[1] \"@count heures\""); // Get the Croatian translations. $this->drupalPostForm('admin/config/regional/translate/export', [ 'langcode' => 'hr', ], t('Export')); // Ensure we have a translation file. - $this->assertRaw('# Croatian translation of Drupal', 'Exported Croatian translation file.'); + $this->assertRaw('# Croatian translation of Drupal'); // Ensure our imported translations exist in the file. - $this->assertRaw("msgid \"Monday\"\nmsgstr \"Ponedjeljak\"", 'Croatian translations present in exported file.'); + $this->assertRaw("msgid \"Monday\"\nmsgstr \"Ponedjeljak\""); // Check for plural export specifically. - $this->assertRaw("msgid \"1 hour\"\nmsgid_plural \"@count hours\"\nmsgstr[0] \"@count sat\"\nmsgstr[1] \"@count sata\"\nmsgstr[2] \"@count sati\"", 'Plural translations exported properly.'); + $this->assertRaw("msgid \"1 hour\"\nmsgid_plural \"@count hours\"\nmsgstr[0] \"@count sat\"\nmsgstr[1] \"@count sata\"\nmsgstr[2] \"@count sati\""); // Check if the source appears on the translation page. $this->drupalGet('admin/config/regional/translate'); @@ -357,16 +357,16 @@ class LocalePluralFormatTest extends BrowserTestBase { 'langcode' => 'fr', ], t('Export')); // Check for plural export specifically. - $this->assertRaw("msgid \"1 hour\"\nmsgid_plural \"@count hours\"\nmsgstr[0] \"@count heure edited\"\nmsgstr[1] \"@count heures\"", 'Edited French plural translations for hours exported properly.'); - $this->assertRaw("msgid \"1 day\"\nmsgid_plural \"@count days\"\nmsgstr[0] \"1 jour\"\nmsgstr[1] \"@count jours\"", 'Added French plural translations for days exported properly.'); + $this->assertRaw("msgid \"1 hour\"\nmsgid_plural \"@count hours\"\nmsgstr[0] \"@count heure edited\"\nmsgstr[1] \"@count heures\""); + $this->assertRaw("msgid \"1 day\"\nmsgid_plural \"@count days\"\nmsgstr[0] \"1 jour\"\nmsgstr[1] \"@count jours\""); // Get the Croatian translations. $this->drupalPostForm('admin/config/regional/translate/export', [ 'langcode' => 'hr', ], t('Export')); // Check for plural export specifically. - $this->assertRaw("msgid \"1 hour\"\nmsgid_plural \"@count hours\"\nmsgstr[0] \"@count sat\"\nmsgstr[1] \"@count sata edited\"\nmsgstr[2] \"@count sati\"", 'Edited Croatian plural translations exported properly.'); - $this->assertRaw("msgid \"1 day\"\nmsgid_plural \"@count days\"\nmsgstr[0] \"@count dan\"\nmsgstr[1] \"@count dana\"\nmsgstr[2] \"@count dana\"", 'Added Croatian plural translations exported properly.'); + $this->assertRaw("msgid \"1 hour\"\nmsgid_plural \"@count hours\"\nmsgstr[0] \"@count sat\"\nmsgstr[1] \"@count sata edited\"\nmsgstr[2] \"@count sati\""); + $this->assertRaw("msgid \"1 day\"\nmsgid_plural \"@count days\"\nmsgstr[0] \"@count dan\"\nmsgstr[1] \"@count dana\"\nmsgstr[2] \"@count dana\""); } /** diff --git a/core/modules/locale/tests/src/Functional/LocaleTranslatedSchemaDefinitionTest.php b/core/modules/locale/tests/src/Functional/LocaleTranslatedSchemaDefinitionTest.php index 816b158a20b..778ee34cae9 100644 --- a/core/modules/locale/tests/src/Functional/LocaleTranslatedSchemaDefinitionTest.php +++ b/core/modules/locale/tests/src/Functional/LocaleTranslatedSchemaDefinitionTest.php @@ -93,7 +93,7 @@ class LocaleTranslatedSchemaDefinitionTest extends BrowserTestBase { $this->drupalGet($update_url . '/selection', ['external' => TRUE]); $this->updateRequirementsProblem(); $this->drupalGet($update_url . '/selection', ['external' => TRUE]); - $this->assertRaw('messages--status', 'No pending updates.'); + $this->assertRaw('messages--status'); $this->assertSession()->linkByHrefNotExists('fr/update.php/run', 'No link to run updates.'); } diff --git a/core/modules/locale/tests/src/Functional/LocaleTranslationUiTest.php b/core/modules/locale/tests/src/Functional/LocaleTranslationUiTest.php index 832527774ca..c0c0654c5d4 100644 --- a/core/modules/locale/tests/src/Functional/LocaleTranslationUiTest.php +++ b/core/modules/locale/tests/src/Functional/LocaleTranslationUiTest.php @@ -77,7 +77,7 @@ class LocaleTranslationUiTest extends BrowserTestBase { t($name, [], ['langcode' => $langcode])->render(); // Reset locale cache. $this->container->get('string_translation')->reset(); - $this->assertRaw('"edit-languages-' . $langcode . '-weight"', 'Language code found.'); + $this->assertRaw('"edit-languages-' . $langcode . '-weight"'); $this->assertText(t($name), 'Test language added.'); $this->drupalLogout(); @@ -119,7 +119,7 @@ class LocaleTranslationUiTest extends BrowserTestBase { 'translation' => 'translated', ]; $this->drupalPostForm('admin/config/regional/translate', $search, t('Filter')); - $this->assertRaw($translation, 'Non-English translation properly saved.'); + $this->assertRaw($translation); $search = [ 'string' => $name, @@ -139,7 +139,7 @@ class LocaleTranslationUiTest extends BrowserTestBase { 'translation' => 'translated', ]; $this->drupalPostForm('admin/config/regional/translate', $search, t('Filter')); - $this->assertRaw($translation_to_en, 'English translation properly saved.'); + $this->assertRaw($translation_to_en); $this->assertTrue($name != $translation && t($name, [], ['langcode' => $langcode]) == $translation, 't() works for non-English.'); // Refresh the locale() cache to get fresh data from t() below. We are in @@ -188,7 +188,7 @@ class LocaleTranslationUiTest extends BrowserTestBase { $this->drupalPostForm($path, [], t('Delete')); // We need raw here because %language and %langcode will add HTML. $t_args = ['%language' => $name, '%langcode' => $langcode]; - $this->assertRaw(t('The %language (%langcode) language has been removed.', $t_args), 'The test language has been removed.'); + $this->assertRaw(t('The %language (%langcode) language has been removed.', $t_args)); // Reload to remove $name. $this->drupalGet($path); // Verify that language is no longer found. @@ -210,7 +210,7 @@ class LocaleTranslationUiTest extends BrowserTestBase { $lid => '', ]; $this->drupalPostForm('admin/config/regional/translate', $edit, t('Save translations')); - $this->assertRaw($name, 'The strings have been saved.'); + $this->assertRaw($name); $this->drupalLogin($translate_user); $search = [ 'string' => $name, diff --git a/core/modules/locale/tests/src/Functional/LocaleUpdateInterfaceTest.php b/core/modules/locale/tests/src/Functional/LocaleUpdateInterfaceTest.php index af153867795..54f1ceb6427 100644 --- a/core/modules/locale/tests/src/Functional/LocaleUpdateInterfaceTest.php +++ b/core/modules/locale/tests/src/Functional/LocaleUpdateInterfaceTest.php @@ -52,7 +52,7 @@ class LocaleUpdateInterfaceTest extends LocaleUpdateBase { $this->assertNoText('Translation update status', 'No status message'); $this->drupalGet('admin/reports/translations'); - $this->assertRaw(t('No translatable languages available. Add a language first.', [':add_language' => Url::fromRoute('entity.configurable_language.collection')->toString()]), 'Language message'); + $this->assertRaw(t('No translatable languages available. Add a language first.', [':add_language' => Url::fromRoute('entity.configurable_language.collection')->toString()])); // Add German language. $this->addLanguage('de'); @@ -77,7 +77,7 @@ class LocaleUpdateInterfaceTest extends LocaleUpdateBase { // Check if updates are available for German. $this->drupalGet('admin/reports/status'); $this->assertText(t('Translation update status'), 'Status message'); - $this->assertRaw(t('Updates available for: @languages. See the Available translation updates page for more information.', ['@languages' => t('German'), ':updates' => Url::fromRoute('locale.translate_status')->toString()]), 'Updates available message'); + $this->assertRaw(t('Updates available for: @languages. See the Available translation updates page for more information.', ['@languages' => t('German'), ':updates' => Url::fromRoute('locale.translate_status')->toString()])); $this->drupalGet('admin/reports/translations'); $this->assertText(t('Updates for: @modules', ['@modules' => 'Locale test translate']), 'Translations available'); @@ -91,7 +91,7 @@ class LocaleUpdateInterfaceTest extends LocaleUpdateBase { // Check if no updates were found. $this->drupalGet('admin/reports/status'); $this->assertText(t('Translation update status'), 'Status message'); - $this->assertRaw(t('Missing translations for: @languages. See the Available translation updates page for more information.', ['@languages' => t('German'), ':updates' => Url::fromRoute('locale.translate_status')->toString()]), 'Missing translations message'); + $this->assertRaw(t('Missing translations for: @languages. See the Available translation updates page for more information.', ['@languages' => t('German'), ':updates' => Url::fromRoute('locale.translate_status')->toString()])); $this->drupalGet('admin/reports/translations'); $this->assertText(t('Missing translations for one project'), 'No translations found'); $release_details = new FormattableMarkup('@module (@version). @info', [ @@ -99,7 +99,7 @@ class LocaleUpdateInterfaceTest extends LocaleUpdateBase { '@version' => '1.3-dev', '@info' => t('File not found at %local_path', ['%local_path' => 'core/modules/locale/tests/test.de.po']), ]); - $this->assertRaw($release_details->__toString(), 'Release details'); + $this->assertRaw($release_details->__toString()); // Override Drupal core translation status as 'no translations found'. $status = locale_translation_get_status(); diff --git a/core/modules/locale/tests/src/Functional/LocaleUpdateTest.php b/core/modules/locale/tests/src/Functional/LocaleUpdateTest.php index 46c7349817d..fd28eaa3274 100644 --- a/core/modules/locale/tests/src/Functional/LocaleUpdateTest.php +++ b/core/modules/locale/tests/src/Functional/LocaleUpdateTest.php @@ -127,7 +127,7 @@ class LocaleUpdateTest extends LocaleUpdateBase { $this->drupalGet('admin/reports/translations/check'); // Check the status on the Available translation status page. - $this->assertRaw('', 'German language found'); + $this->assertRaw(''); $this->assertText('Updates for: Contributed module one, Contributed module two, Custom module one, Locale test', 'Updates found'); /** @var \Drupal\Core\Datetime\DateFormatterInterface $date_formatter */ $date_formatter = $this->container->get('date.formatter'); @@ -317,7 +317,7 @@ class LocaleUpdateTest extends LocaleUpdateBase { // Check if translations have been imported. $this->assertRaw(t('One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.', - ['%number' => 7, '%update' => 0, '%delete' => 0]), 'One translation file imported.'); + ['%number' => 7, '%update' => 0, '%delete' => 0])); // cSpell:disable-next-line $this->assertTranslation('Tuesday', 'Dienstag', 'de'); @@ -364,7 +364,7 @@ class LocaleUpdateTest extends LocaleUpdateBase { // Check if the right number of translations are added. $this->assertRaw(t('One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.', - ['%number' => 8, '%update' => 0, '%delete' => 0]), 'One language added.'); + ['%number' => 8, '%update' => 0, '%delete' => 0])); // cSpell:disable-next-line $this->assertTranslation('Extraday', 'extra dag', 'nl'); diff --git a/core/modules/menu_link_content/tests/src/Functional/MenuLinkContentTranslationUITest.php b/core/modules/menu_link_content/tests/src/Functional/MenuLinkContentTranslationUITest.php index 231deba2395..20eeb7a1132 100644 --- a/core/modules/menu_link_content/tests/src/Functional/MenuLinkContentTranslationUITest.php +++ b/core/modules/menu_link_content/tests/src/Functional/MenuLinkContentTranslationUITest.php @@ -97,10 +97,12 @@ class MenuLinkContentTranslationUITest extends ContentTranslationUITestBase { $edit = []; $edit['admin_theme'] = 'seven'; $this->drupalPostForm('admin/appearance', $edit, t('Save configuration')); + // Check that edit uses the admin theme. $this->drupalGet('admin/structure/menu/item/' . $entityId . '/edit'); - $this->assertRaw('core/themes/seven/css/base/elements.css', 'Edit uses admin theme.'); + $this->assertRaw('core/themes/seven/css/base/elements.css'); + // Check that translation uses admin theme as well. $this->drupalGet('admin/structure/menu/item/' . $entityId . '/edit/translations'); - $this->assertRaw('core/themes/seven/css/base/elements.css', 'Translation uses admin theme as well.'); + $this->assertRaw('core/themes/seven/css/base/elements.css'); } /** diff --git a/core/modules/menu_ui/tests/src/Functional/MenuUiTest.php b/core/modules/menu_ui/tests/src/Functional/MenuUiTest.php index 905a82e4a50..b3048a06c6a 100644 --- a/core/modules/menu_ui/tests/src/Functional/MenuUiTest.php +++ b/core/modules/menu_ui/tests/src/Functional/MenuUiTest.php @@ -185,14 +185,14 @@ class MenuUiTest extends BrowserTestBase { // Assert the new menu. $this->drupalGet('admin/structure/menu/manage/' . $menu_name); - $this->assertRaw($label, 'Custom menu was added.'); + $this->assertRaw($label); // Edit the menu. $new_label = $this->randomMachineName(16); $menu->set('label', $new_label); $menu->save(); $this->drupalGet('admin/structure/menu/manage/' . $menu_name); - $this->assertRaw($new_label, 'Custom menu was edited.'); + $this->assertRaw($new_label); } /** @@ -261,7 +261,7 @@ class MenuUiTest extends BrowserTestBase { // Delete custom menu. $this->drupalPostForm("admin/structure/menu/manage/$menu_name/delete", [], t('Delete')); $this->assertSession()->statusCodeEquals(200); - $this->assertRaw(t('The menu %title has been deleted.', ['%title' => $label]), 'Custom menu was deleted'); + $this->assertRaw(t('The menu %title has been deleted.', ['%title' => $label])); $this->assertNull(Menu::load($menu_name), 'Custom menu was deleted'); // Test if all menu links associated with the menu were removed from // database. @@ -270,7 +270,7 @@ class MenuUiTest extends BrowserTestBase { // Make sure there's no delete button on system menus. $this->drupalGet('admin/structure/menu/manage/main'); - $this->assertNoRaw('edit-delete', 'The delete button was not found'); + $this->assertNoRaw('edit-delete'); // Try to delete the main menu. $this->drupalGet('admin/structure/menu/manage/main/delete'); @@ -648,7 +648,7 @@ class MenuUiTest extends BrowserTestBase { 'title[0][value]' => 'title', ]; $this->drupalPostForm("admin/structure/menu/manage/{$this->menu->id()}/add", $edit, t('Save')); - $this->assertRaw(t("The path '@link_path' is inaccessible.", ['@link_path' => $link_path]), 'Menu link was not created'); + $this->assertRaw(t("The path '@link_path' is inaccessible.", ['@link_path' => $link_path])); } } @@ -788,7 +788,7 @@ class MenuUiTest extends BrowserTestBase { // Reset menu link. $this->drupalPostForm("admin/structure/menu/link/{$menu_link->getPluginId()}/reset", [], t('Reset')); $this->assertSession()->statusCodeEquals(200); - $this->assertRaw(t('The menu link was reset to its default settings.'), 'Menu link was reset'); + $this->assertRaw(t('The menu link was reset to its default settings.')); // Verify menu link. $instance = \Drupal::service('plugin.manager.menu.link')->createInstance($menu_link->getPluginId()); @@ -808,7 +808,7 @@ class MenuUiTest extends BrowserTestBase { // Delete menu link. $this->drupalPostForm("admin/structure/menu/item/$mlid/delete", [], t('Delete')); $this->assertSession()->statusCodeEquals(200); - $this->assertRaw(t('The menu link %title has been deleted.', ['%title' => $title]), 'Menu link was deleted'); + $this->assertRaw(t('The menu link %title has been deleted.', ['%title' => $title])); // Verify deletion. $this->drupalGet(''); diff --git a/core/modules/node/tests/src/Functional/NodeAccessFieldTest.php b/core/modules/node/tests/src/Functional/NodeAccessFieldTest.php index 938fe98d746..069d812891f 100644 --- a/core/modules/node/tests/src/Functional/NodeAccessFieldTest.php +++ b/core/modules/node/tests/src/Functional/NodeAccessFieldTest.php @@ -121,7 +121,7 @@ class NodeAccessFieldTest extends NodeTestBase { // Confirm that the new default value appears when creating a new node. $this->drupalGet('node/add/page'); - $this->assertRaw($default, 'The updated default value is displayed when creating a new node.'); + $this->assertRaw($default); } } diff --git a/core/modules/node/tests/src/Functional/NodeActionsConfigurationTest.php b/core/modules/node/tests/src/Functional/NodeActionsConfigurationTest.php index e696e001731..3ca3ababfaf 100644 --- a/core/modules/node/tests/src/Functional/NodeActionsConfigurationTest.php +++ b/core/modules/node/tests/src/Functional/NodeActionsConfigurationTest.php @@ -78,7 +78,7 @@ class NodeActionsConfigurationTest extends BrowserTestBase { $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]), 'The delete confirmation message appears after deleting the node_assign_owner_action action.'); + $this->assertRaw(t('The action %action has been deleted.', ['%action' => $new_action_label])); $this->drupalGet('admin/config/system/actions'); $this->assertSession()->statusCodeEquals(200); $this->assertNoText($new_action_label, 'The label for the node_assign_owner_action action does not appear on the actions administration page after deleting.'); diff --git a/core/modules/node/tests/src/Functional/NodeEditFormTest.php b/core/modules/node/tests/src/Functional/NodeEditFormTest.php index 29d0f72ce0b..b630655340e 100644 --- a/core/modules/node/tests/src/Functional/NodeEditFormTest.php +++ b/core/modules/node/tests/src/Functional/NodeEditFormTest.php @@ -85,7 +85,7 @@ class NodeEditFormTest extends NodeTestBase { // Check that the title and body fields are displayed with the correct values. // @todo Ideally assertLink would support HTML, but it doesn't. - $this->assertRaw('Edit(active tab)', 'Edit tab found and marked active.'); + $this->assertRaw('Edit(active tab)'); $this->assertFieldByName($title_key, $edit[$title_key], 'Title field displayed.'); $this->assertFieldByName($body_key, $edit[$body_key], 'Body field displayed.'); diff --git a/core/modules/node/tests/src/Functional/NodeFieldMultilingualTest.php b/core/modules/node/tests/src/Functional/NodeFieldMultilingualTest.php index 1bd314b8ff1..844ed95a57a 100644 --- a/core/modules/node/tests/src/Functional/NodeFieldMultilingualTest.php +++ b/core/modules/node/tests/src/Functional/NodeFieldMultilingualTest.php @@ -55,7 +55,7 @@ class NodeFieldMultilingualTest extends BrowserTestBase { 'language_configuration[language_alterable]' => TRUE, ]; $this->drupalPostForm('admin/structure/types/manage/page', $edit, t('Save content type')); - $this->assertRaw(t('The content type %type has been updated.', ['%type' => 'Basic page']), 'Basic page content type has been updated.'); + $this->assertRaw(t('The content type %type has been updated.', ['%type' => 'Basic page'])); // Make node body translatable. $field_storage = FieldStorageConfig::loadByName('node', 'body'); @@ -102,10 +102,14 @@ class NodeFieldMultilingualTest extends BrowserTestBase { // Test multilingual field language fallback logic. $this->drupalGet("it/node/{$node->id()}"); - $this->assertRaw($body_value, 'Body correctly displayed using Italian as requested language'); + // Verify that body is correctly displayed using Italian as requested + // language. + $this->assertRaw($body_value); $this->drupalGet("node/{$node->id()}"); - $this->assertRaw($body_value, 'Body correctly displayed using English as requested language'); + // Verify that body is correctly displayed using English as requested + // language. + $this->assertRaw($body_value); } /** diff --git a/core/modules/node/tests/src/Functional/NodeRSSContentTest.php b/core/modules/node/tests/src/Functional/NodeRSSContentTest.php index 92bf08a5947..42cb7ef1438 100644 --- a/core/modules/node/tests/src/Functional/NodeRSSContentTest.php +++ b/core/modules/node/tests/src/Functional/NodeRSSContentTest.php @@ -62,8 +62,8 @@ class NodeRSSContentTest extends NodeTestBase { // Check that extra RSS elements and namespaces are added to RSS feed. $test_element = '' . t('Value of testElement RSS element for node @nid.', ['@nid' => $node->id()]) . ''; $test_ns = 'xmlns:drupaltest="http://example.com/test-namespace"'; - $this->assertRaw($test_element, 'Extra RSS elements appear in RSS feed.'); - $this->assertRaw($test_ns, 'Extra namespaces appear in RSS feed.'); + $this->assertRaw($test_element); + $this->assertRaw($test_ns); // Check that content added in 'rss' view mode doesn't appear when // viewing node. @@ -109,9 +109,12 @@ class NodeRSSContentTest extends NodeTestBase { ]); $this->drupalGet('rss.xml'); - $this->assertRaw(file_create_url('public://root-relative'), 'Root-relative URL is transformed to absolute.'); - $this->assertRaw($protocol_relative_url, 'Protocol-relative URL is left untouched.'); - $this->assertRaw($absolute_url, 'Absolute URL is left untouched.'); + // Verify that root-relative URL is transformed to absolute. + $this->assertRaw(file_create_url('public://root-relative')); + // Verify that protocol-relative URL is left untouched. + $this->assertRaw($protocol_relative_url); + // Verify that absolute URL is left untouched. + $this->assertRaw($absolute_url); } } diff --git a/core/modules/node/tests/src/Functional/NodeRevisionsAllTest.php b/core/modules/node/tests/src/Functional/NodeRevisionsAllTest.php index 7b24ad92b46..43bb0ee53d5 100644 --- a/core/modules/node/tests/src/Functional/NodeRevisionsAllTest.php +++ b/core/modules/node/tests/src/Functional/NodeRevisionsAllTest.php @@ -154,8 +154,7 @@ class NodeRevisionsAllTest extends NodeTestBase { '@type' => 'Basic page', '%title' => $nodes[1]->getTitle(), '%revision-date' => $this->container->get('date.formatter')->format($nodes[1]->getRevisionCreationTime()), - ]), - 'Revision reverted.'); + ])); $node_storage->resetCache([$node->id()]); $reverted_node = $node_storage->load($node->id()); $this->assertTrue(($nodes[1]->body->value == $reverted_node->body->value), 'Node reverted correctly.'); @@ -181,8 +180,7 @@ class NodeRevisionsAllTest extends NodeTestBase { '%revision-date' => $this->container->get('date.formatter')->format($nodes[1]->getRevisionCreationTime()), '@type' => 'Basic page', '%title' => $nodes[1]->getTitle(), - ]), - 'Revision deleted.'); + ])); $nids = \Drupal::entityQuery('node') ->allRevisions() ->accessCheck(FALSE) diff --git a/core/modules/node/tests/src/Functional/NodeRevisionsTest.php b/core/modules/node/tests/src/Functional/NodeRevisionsTest.php index 77951ac1756..1a7a591d626 100644 --- a/core/modules/node/tests/src/Functional/NodeRevisionsTest.php +++ b/core/modules/node/tests/src/Functional/NodeRevisionsTest.php @@ -176,7 +176,7 @@ class NodeRevisionsTest extends NodeTestBase { '@type' => 'Basic page', '%title' => $nodes[1]->label(), '%revision-date' => $this->container->get('date.formatter')->format($nodes[1]->getRevisionCreationTime()), - ]), 'Revision reverted.'); + ])); $node_storage->resetCache([$node->id()]); $reverted_node = $node_storage->load($node->id()); $this->assertTrue(($nodes[1]->body->value == $reverted_node->body->value), 'Node reverted correctly.'); @@ -195,7 +195,7 @@ class NodeRevisionsTest extends NodeTestBase { '%revision-date' => $this->container->get('date.formatter')->format($nodes[1]->getRevisionCreationTime()), '@type' => 'Basic page', '%title' => $nodes[1]->label(), - ]), 'Revision deleted.'); + ])); $connection = Database::getConnection(); $nids = \Drupal::entityQuery('node') ->accessCheck(FALSE) diff --git a/core/modules/node/tests/src/Functional/NodeTitleTest.php b/core/modules/node/tests/src/Functional/NodeTitleTest.php index 5889816d3c7..4f048e63839 100644 --- a/core/modules/node/tests/src/Functional/NodeTitleTest.php +++ b/core/modules/node/tests/src/Functional/NodeTitleTest.php @@ -103,11 +103,11 @@ class NodeTitleTest extends NodeTestBase { // the page. $edge_case_title_escaped = Html::escape($edge_case_title); $this->drupalGet('node/' . $node->id()); - $this->assertRaw('' . $edge_case_title_escaped . ' | Drupal', 'Page title is equal to article\'s "title".', 'Node'); + $this->assertRaw('' . $edge_case_title_escaped . ' | Drupal'); // Test that the title appears as when reloading the node page. $this->drupalGet('node/' . $node->id()); - $this->assertRaw('<title>' . $edge_case_title_escaped . ' | Drupal', 'Page title is equal to article\'s "title".', 'Node'); + $this->assertRaw('' . $edge_case_title_escaped . ' | Drupal'); } diff --git a/core/modules/node/tests/src/Functional/NodeTitleXSSTest.php b/core/modules/node/tests/src/Functional/NodeTitleXSSTest.php index 6207a0bbf63..7a61a01f9fc 100644 --- a/core/modules/node/tests/src/Functional/NodeTitleXSSTest.php +++ b/core/modules/node/tests/src/Functional/NodeTitleXSSTest.php @@ -34,18 +34,19 @@ class NodeTitleXSSTest extends NodeTestBase { $edit['title[0][value]'] = $title; $this->drupalPostForm('node/add/page', $edit, t('Preview')); - $this->assertNoRaw($xss, 'Harmful tags are escaped when previewing a node.'); + // Verify that harmful tags are escaped when previewing a node. + $this->assertNoRaw($xss); $settings = ['title' => $title]; $node = $this->drupalCreateNode($settings); $this->drupalGet('node/' . $node->id()); // Titles should be escaped. - $this->assertRaw('' . Html::escape($title) . ' | Drupal', 'Title is displayed when viewing a node.'); - $this->assertNoRaw($xss, 'Harmful tags are escaped when viewing a node.'); + $this->assertRaw('' . Html::escape($title) . ' | Drupal'); + $this->assertNoRaw($xss); $this->drupalGet('node/' . $node->id() . '/edit'); - $this->assertNoRaw($xss, 'Harmful tags are escaped when editing a node.'); + $this->assertNoRaw($xss); } } diff --git a/core/modules/node/tests/src/Functional/NodeTranslationUITest.php b/core/modules/node/tests/src/Functional/NodeTranslationUITest.php index 9c64abe555d..d8cb9e3e3e7 100644 --- a/core/modules/node/tests/src/Functional/NodeTranslationUITest.php +++ b/core/modules/node/tests/src/Functional/NodeTranslationUITest.php @@ -251,13 +251,15 @@ class NodeTranslationUITest extends ContentTranslationUITestBase { $edit['use_admin_theme'] = TRUE; $this->drupalPostForm('admin/appearance', $edit, t('Save configuration')); $this->drupalGet('node/' . $article->id() . '/translations'); - $this->assertRaw('core/themes/seven/css/base/elements.css', 'Translation uses admin theme if edit is admin.'); + // Verify that translation uses the admin theme if edit is admin. + $this->assertRaw('core/themes/seven/css/base/elements.css'); // Turn off admin theme for editing, assert inheritance to translations. $edit['use_admin_theme'] = FALSE; $this->drupalPostForm('admin/appearance', $edit, t('Save configuration')); $this->drupalGet('node/' . $article->id() . '/translations'); - $this->assertNoRaw('core/themes/seven/css/base/elements.css', 'Translation uses frontend theme if edit is frontend.'); + // Verify that translation uses the frontend theme if edit is frontend. + $this->assertNoRaw('core/themes/seven/css/base/elements.css'); // Assert presence of translation page itself (vs. DisabledBundle below). $this->assertSession()->statusCodeEquals(200); diff --git a/core/modules/node/tests/src/Functional/NodeTypeTest.php b/core/modules/node/tests/src/Functional/NodeTypeTest.php index 3871d6bcdda..f1eed3f9987 100644 --- a/core/modules/node/tests/src/Functional/NodeTypeTest.php +++ b/core/modules/node/tests/src/Functional/NodeTypeTest.php @@ -186,8 +186,7 @@ class NodeTypeTest extends NodeTestBase { // Attempt to delete the content type, which should not be allowed. $this->drupalGet('admin/structure/types/manage/' . $type->label() . '/delete'); $this->assertRaw( - t('%type is used by 1 piece of content on your site. You can not remove this content type until you have removed all of the %type content.', ['%type' => $type->label()]), - 'The content type will not be deleted until all nodes of that type are removed.' + t('%type is used by 1 piece of content on your site. You can not remove this content type until you have removed all of the %type content.', ['%type' => $type->label()]) ); $this->assertNoText('This action cannot be undone.', 'The node type deletion confirmation form is not available.'); @@ -196,8 +195,7 @@ class NodeTypeTest extends NodeTestBase { // Attempt to delete the content type, which should now be allowed. $this->drupalGet('admin/structure/types/manage/' . $type->label() . '/delete'); $this->assertRaw( - t('Are you sure you want to delete the content type %type?', ['%type' => $type->label()]), - 'The content type is available for deletion.' + t('Are you sure you want to delete the content type %type?', ['%type' => $type->label()]) ); $this->assertText(t('This action cannot be undone.'), 'The node type deletion confirmation form is available.'); @@ -273,7 +271,7 @@ class NodeTypeTest extends NodeTestBase { $this->drupalGet('admin/structure/types'); $this->assertRaw(t('No content types available. Add content type.', [ ':link' => Url::fromRoute('node.type_add')->toString(), - ]), 'Empty text when there are no content types in the system is correct.'); + ])); $bundle_info->clearCachedBundles(); $this->assertCount(0, $bundle_info->getBundleInfo('node'), 'The bundle information service has 0 bundles for the Node entity type.'); diff --git a/core/modules/node/tests/src/Functional/PagePreviewTest.php b/core/modules/node/tests/src/Functional/PagePreviewTest.php index 525134d6b07..806725efad8 100644 --- a/core/modules/node/tests/src/Functional/PagePreviewTest.php +++ b/core/modules/node/tests/src/Functional/PagePreviewTest.php @@ -227,7 +227,7 @@ class PagePreviewTest extends NodeTestBase { $view_mode_edit = ['view_mode' => 'teaser']; $this->drupalPostForm('node/preview/' . $uuid . '/full', $view_mode_edit, t('Switch')); - $this->assertRaw('view-mode-teaser', 'View mode teaser class found.'); + $this->assertRaw('view-mode-teaser'); $this->assertNoText($edit[$body_key], 'Body not displayed.'); // Check that the title, body and term fields are displayed with the @@ -275,8 +275,8 @@ class PagePreviewTest extends NodeTestBase { $newterm2 = $this->randomMachineName(8); $edit[$term_key] = $this->term->getName() . ', ' . $newterm1 . ', ' . $newterm2; $this->drupalPostForm('node/' . $node->id() . '/edit', $edit, t('Preview')); - $this->assertRaw('>' . $newterm1 . '<', 'First new term displayed.'); - $this->assertRaw('>' . $newterm2 . '<', 'Second new term displayed.'); + $this->assertRaw('>' . $newterm1 . '<'); + $this->assertRaw('>' . $newterm2 . '<'); // The first term should be displayed as link, the others not. $this->assertSession()->linkExists($this->term->getName()); $this->assertSession()->linkNotExists($newterm1); @@ -290,9 +290,9 @@ class PagePreviewTest extends NodeTestBase { $newterm3 = $this->randomMachineName(8); $edit[$term_key] = $newterm1 . ', ' . $newterm3 . ', ' . $newterm2; $this->drupalPostForm('node/' . $node->id() . '/edit', $edit, t('Preview')); - $this->assertRaw('>' . $newterm1 . '<', 'First existing term displayed.'); - $this->assertRaw('>' . $newterm2 . '<', 'Second existing term displayed.'); - $this->assertRaw('>' . $newterm3 . '<', 'Third new term displayed.'); + $this->assertRaw('>' . $newterm1 . '<'); + $this->assertRaw('>' . $newterm2 . '<'); + $this->assertRaw('>' . $newterm3 . '<'); $this->assertNoText($this->term->getName()); $this->assertSession()->linkExists($newterm1); $this->assertSession()->linkExists($newterm2); diff --git a/core/modules/options/tests/src/Functional/OptionsFieldUITest.php b/core/modules/options/tests/src/Functional/OptionsFieldUITest.php index 13f730ba1ef..2e046828662 100644 --- a/core/modules/options/tests/src/Functional/OptionsFieldUITest.php +++ b/core/modules/options/tests/src/Functional/OptionsFieldUITest.php @@ -319,7 +319,8 @@ class OptionsFieldUITest extends FieldTestBase { public function assertAllowedValuesInput($input_string, $result, $message) { $edit = ['settings[allowed_values]' => $input_string]; $this->drupalPostForm($this->adminPath, $edit, t('Save field settings')); - $this->assertNoRaw('&lt;', 'The page does not have double escaped HTML tags.'); + // Verify that the page does not have double escaped HTML tags. + $this->assertNoRaw('&lt;'); if (is_string($result)) { $this->assertText($result, $message); diff --git a/core/modules/options/tests/src/Functional/OptionsWidgetsTest.php b/core/modules/options/tests/src/Functional/OptionsWidgetsTest.php index 1b3511fa723..8a11c4761d4 100644 --- a/core/modules/options/tests/src/Functional/OptionsWidgetsTest.php +++ b/core/modules/options/tests/src/Functional/OptionsWidgetsTest.php @@ -148,7 +148,7 @@ class OptionsWidgetsTest extends FieldTestBase { $this->assertSession()->checkboxNotChecked('edit-card-1-0'); $this->assertSession()->checkboxNotChecked('edit-card-1-1'); $this->assertSession()->checkboxNotChecked('edit-card-1-2'); - $this->assertRaw('Some dangerous & unescaped markup', 'Option text was properly filtered.'); + $this->assertRaw('Some dangerous & unescaped markup'); $this->assertRaw('Some HTML encoded markup with < & >'); // Select first option. @@ -206,7 +206,7 @@ class OptionsWidgetsTest extends FieldTestBase { $this->assertSession()->checkboxNotChecked('edit-card-2-0'); $this->assertSession()->checkboxNotChecked('edit-card-2-1'); $this->assertSession()->checkboxNotChecked('edit-card-2-2'); - $this->assertRaw('Some dangerous & unescaped markup', 'Option text was properly filtered.'); + $this->assertRaw('Some dangerous & unescaped markup'); // Submit form: select first and third options. $edit = [ @@ -302,12 +302,12 @@ class OptionsWidgetsTest extends FieldTestBase { $this->assertFalse($this->assertSession()->optionExists('card_1', 0)->isSelected()); $this->assertFalse($this->assertSession()->optionExists('card_1', 1)->isSelected()); $this->assertFalse($this->assertSession()->optionExists('card_1', 2)->isSelected()); - $this->assertRaw('Some dangerous & unescaped markup', 'Option text was properly filtered.'); + $this->assertRaw('Some dangerous & unescaped markup'); // Submit form: select invalid 'none' option. $edit = ['card_1' => '_none']; $this->drupalPostForm(NULL, $edit, t('Save')); - $this->assertRaw(t('@title field is required.', ['@title' => $field->getName()]), 'Cannot save a required field when selecting "none" from the select list.'); + $this->assertRaw(t('@title field is required.', ['@title' => $field->getName()])); // Submit form: select first option. $edit = ['card_1' => 0]; @@ -346,9 +346,9 @@ class OptionsWidgetsTest extends FieldTestBase { $this->assertFalse($this->assertSession()->optionExists('card_1', 0)->isSelected()); $this->assertFalse($this->assertSession()->optionExists('card_1', 1)->isSelected()); $this->assertFalse($this->assertSession()->optionExists('card_1', 2)->isSelected()); - $this->assertRaw('Some dangerous & unescaped markup', 'Option text was properly filtered.'); - $this->assertRaw('More <script>dangerous</script> markup', 'Option group text was properly filtered.'); - $this->assertRaw('Group 1', 'Option groups are displayed.'); + $this->assertRaw('Some dangerous & unescaped markup'); + $this->assertRaw('More <script>dangerous</script> markup'); + $this->assertRaw('Group 1'); // Submit form: select first option. $edit = ['card_1' => 0]; @@ -398,7 +398,7 @@ class OptionsWidgetsTest extends FieldTestBase { $this->assertFalse($this->assertSession()->optionExists('card_2', 0)->isSelected()); $this->assertFalse($this->assertSession()->optionExists('card_2', 1)->isSelected()); $this->assertFalse($this->assertSession()->optionExists('card_2', 2)->isSelected()); - $this->assertRaw('Some dangerous & unescaped markup', 'Option text was properly filtered.'); + $this->assertRaw('Some dangerous & unescaped markup'); // Submit form: select first and third options. $edit = ['card_2[]' => [0 => 0, 2 => 2]]; @@ -468,9 +468,9 @@ class OptionsWidgetsTest extends FieldTestBase { $this->assertFalse($this->assertSession()->optionExists('card_2', 0)->isSelected()); $this->assertFalse($this->assertSession()->optionExists('card_2', 1)->isSelected()); $this->assertFalse($this->assertSession()->optionExists('card_2', 2)->isSelected()); - $this->assertRaw('Some dangerous & unescaped markup', 'Option text was properly filtered.'); - $this->assertRaw('More <script>dangerous</script> markup', 'Option group text was properly filtered.'); - $this->assertRaw('Group 1', 'Option groups are displayed.'); + $this->assertRaw('Some dangerous & unescaped markup'); + $this->assertRaw('More <script>dangerous</script> markup'); + $this->assertRaw('Group 1'); // Submit form: select first option. $edit = ['card_2[]' => [0 => 0]]; diff --git a/core/modules/page_cache/tests/src/Functional/PageCacheTest.php b/core/modules/page_cache/tests/src/Functional/PageCacheTest.php index cef8b3b0426..13e427e59f0 100644 --- a/core/modules/page_cache/tests/src/Functional/PageCacheTest.php +++ b/core/modules/page_cache/tests/src/Functional/PageCacheTest.php @@ -136,7 +136,8 @@ class PageCacheTest extends BrowserTestBase { $this->drupalGet($accept_header_cache_url); // Verify that HTML page was cached. $this->assertSession()->responseHeaderEquals('X-Drupal-Cache', 'HIT'); - $this->assertRaw('

oh hai this is html.

', 'The correct HTML response was returned.'); + // Verify that the correct HTML response was returned. + $this->assertRaw('

oh hai this is html.

'); $this->drupalGet($accept_header_cache_url_with_json); // Verify that JSON response was not yet cached. @@ -144,7 +145,8 @@ class PageCacheTest extends BrowserTestBase { $this->drupalGet($accept_header_cache_url_with_json); // Verify that JSON response was cached. $this->assertSession()->responseHeaderEquals('X-Drupal-Cache', 'HIT'); - $this->assertRaw('{"content":"oh hai this is json"}', 'The correct Json response was returned.'); + // Verify that the correct JSON response was returned. + $this->assertRaw('{"content":"oh hai this is json"}'); // Enable REST support for nodes and hal+json. \Drupal::service('module_installer')->install(['node', 'rest', 'hal', 'basic_auth']); diff --git a/core/modules/path/tests/src/Functional/PathAliasTest.php b/core/modules/path/tests/src/Functional/PathAliasTest.php index 6bd0a071156..3772e2b7ede 100644 --- a/core/modules/path/tests/src/Functional/PathAliasTest.php +++ b/core/modules/path/tests/src/Functional/PathAliasTest.php @@ -142,7 +142,7 @@ class PathAliasTest extends PathTestBase { $this->drupalPostForm('admin/config/search/path/add', $edit, t('Save')); // Confirm no duplicate was created. - $this->assertRaw(t('The alias %alias is already in use in this language.', ['%alias' => $edit['alias[0][value]']]), 'Attempt to move alias was rejected.'); + $this->assertRaw(t('The alias %alias is already in use in this language.', ['%alias' => $edit['alias[0][value]']])); $edit_upper = $edit; $edit_upper['alias[0][value]'] = mb_strtoupper($edit['alias[0][value]']); @@ -150,7 +150,7 @@ class PathAliasTest extends PathTestBase { $this->assertRaw(t('The alias %alias could not be added because it is already in use in this language with different capitalization: %stored_alias.', [ '%alias' => $edit_upper['alias[0][value]'], '%stored_alias' => $edit['alias[0][value]'], - ]), 'Attempt to move upper-case alias was rejected.'); + ])); // Delete alias. $this->drupalGet('admin/config/search/path/edit/' . $pid); diff --git a/core/modules/quickedit/tests/src/FunctionalJavascript/QuickEditLoadingTest.php b/core/modules/quickedit/tests/src/FunctionalJavascript/QuickEditLoadingTest.php index ee646850042..e1fb1081392 100644 --- a/core/modules/quickedit/tests/src/FunctionalJavascript/QuickEditLoadingTest.php +++ b/core/modules/quickedit/tests/src/FunctionalJavascript/QuickEditLoadingTest.php @@ -128,8 +128,8 @@ class QuickEditLoadingTest extends WebDriverTestBase { $this->drupalGet('node/1'); // Library and in-place editors. - $this->assertNoRaw('core/modules/quickedit/js/quickedit.js', 'Quick Edit library not loaded.'); - $this->assertNoRaw('core/modules/quickedit/js/editors/formEditor.js', "'form' in-place editor not loaded."); + $this->assertNoRaw('core/modules/quickedit/js/quickedit.js'); + $this->assertNoRaw('core/modules/quickedit/js/editors/formEditor.js'); // HTML annotation and title class does not exist for users without // permission to in-place edit. diff --git a/core/modules/responsive_image/tests/src/Functional/ResponsiveImageFieldDisplayTest.php b/core/modules/responsive_image/tests/src/Functional/ResponsiveImageFieldDisplayTest.php index 84426caaf96..d3cc450c863 100644 --- a/core/modules/responsive_image/tests/src/Functional/ResponsiveImageFieldDisplayTest.php +++ b/core/modules/responsive_image/tests/src/Functional/ResponsiveImageFieldDisplayTest.php @@ -204,7 +204,7 @@ class ResponsiveImageFieldDisplayTest extends ImageFieldTestBase { '#alt' => $alt, ]; $default_output = str_replace("\n", NULL, $renderer->renderRoot($image)); - $this->assertRaw($default_output, 'Default formatter displaying correctly on full node view.'); + $this->assertRaw($default_output); // Test field not being configured. This should not cause a fatal error. $display_options = [ @@ -330,7 +330,7 @@ class ResponsiveImageFieldDisplayTest extends ImageFieldTestBase { // responsive-image.html.twig doesn't have one after the fallback image, so // we remove it here. $default_output = trim($renderer->renderRoot($fallback_image)); - $this->assertRaw($default_output, 'Image style large formatter displaying correctly on full node view.'); + $this->assertRaw($default_output); if ($scheme == 'private') { // Log out and ensure the file cannot be accessed. diff --git a/core/modules/search/tests/src/Functional/SearchCommentTest.php b/core/modules/search/tests/src/Functional/SearchCommentTest.php index 1f3933d0f0d..d3164a91f3e 100644 --- a/core/modules/search/tests/src/Functional/SearchCommentTest.php +++ b/core/modules/search/tests/src/Functional/SearchCommentTest.php @@ -172,7 +172,8 @@ class SearchCommentTest extends BrowserTestBase { // Verify that comment is rendered using proper format. $this->assertText($comment_body, 'Comment body text found in search results.'); - $this->assertNoRaw(t('n/a'), 'HTML in comment body is not hidden.'); + // Verify that HTML in comment body is not hidden. + $this->assertNoRaw(t('n/a')); $this->assertSession()->assertNoEscaped($edit_comment['comment_body[0][value]']); // Search for the evil script comment subject. diff --git a/core/modules/statistics/tests/src/Functional/StatisticsAttachedTest.php b/core/modules/statistics/tests/src/Functional/StatisticsAttachedTest.php index 719bc507be9..73f95f671ae 100644 --- a/core/modules/statistics/tests/src/Functional/StatisticsAttachedTest.php +++ b/core/modules/statistics/tests/src/Functional/StatisticsAttachedTest.php @@ -56,7 +56,7 @@ class StatisticsAttachedTest extends BrowserTestBase { $node->save(); $this->drupalGet('node/' . $node->id()); - $this->assertRaw('core/modules/statistics/statistics.js', 'Statistics library is available'); + $this->assertRaw('core/modules/statistics/statistics.js'); } } diff --git a/core/modules/statistics/tests/src/Functional/StatisticsReportsTest.php b/core/modules/statistics/tests/src/Functional/StatisticsReportsTest.php index 0b80251d6cf..c4122dfb45c 100644 --- a/core/modules/statistics/tests/src/Functional/StatisticsReportsTest.php +++ b/core/modules/statistics/tests/src/Functional/StatisticsReportsTest.php @@ -63,7 +63,7 @@ class StatisticsReportsTest extends StatisticsTestBase { $this->assertCacheContexts($contexts); // Check if the node link is displayed. - $this->assertRaw(Link::fromTextAndUrl($node->label(), $node->toUrl('canonical'))->toString(), 'Found link to visited node.'); + $this->assertRaw(Link::fromTextAndUrl($node->label(), $node->toUrl('canonical'))->toString()); } } diff --git a/core/modules/system/tests/src/Functional/Batch/PageTest.php b/core/modules/system/tests/src/Functional/Batch/PageTest.php index d63aa5acb9e..c73cc4a66c7 100644 --- a/core/modules/system/tests/src/Functional/Batch/PageTest.php +++ b/core/modules/system/tests/src/Functional/Batch/PageTest.php @@ -76,12 +76,15 @@ class PageTest extends BrowserTestBase { // Go to the initial step only. $this->maximumMetaRefreshCount = 0; $this->drupalGet('batch-test/test-title'); - $this->assertRaw('
Initializing.
 
', 'Initial progress message appears correctly.'); - $this->assertNoRaw('&nbsp;', 'Initial progress message is not double escaped.'); + // Check that the initial progress message appears correctly and is not + // double escaped. + $this->assertRaw('
Initializing.
 
'); + $this->assertNoRaw('&nbsp;'); // Now also go to the next step. $this->maximumMetaRefreshCount = 1; $this->drupalGet('batch-test/test-title'); - $this->assertRaw('
Completed 1 of 1.
', 'Progress message for second step appears correctly.'); + // Check that the progress message for second step appears correctly. + $this->assertRaw('
Completed 1 of 1.
'); } } diff --git a/core/modules/system/tests/src/Functional/Entity/EntityListBuilderTest.php b/core/modules/system/tests/src/Functional/Entity/EntityListBuilderTest.php index d132271cad2..cba5d3bcf7d 100644 --- a/core/modules/system/tests/src/Functional/Entity/EntityListBuilderTest.php +++ b/core/modules/system/tests/src/Functional/Entity/EntityListBuilderTest.php @@ -49,13 +49,13 @@ class EntityListBuilderTest extends BrowserTestBase { $this->drupalGet('entity_test/list'); // Item 51 should not be present. - $this->assertRaw('Test entity 50', 'Item 50 is shown.'); - $this->assertNoRaw('Test entity 51', 'Item 51 is on the next page.'); + $this->assertRaw('Test entity 50'); + $this->assertNoRaw('Test entity 51'); - // Browse to the next page. + // Browse to the next page, test entity 51 is shown. $this->clickLink(t('Page 2')); - $this->assertNoRaw('Test entity 50', 'Test entity 50 is on the previous page.'); - $this->assertRaw('Test entity 51', 'Test entity 51 is shown.'); + $this->assertNoRaw('Test entity 50'); + $this->assertRaw('Test entity 51'); } /** diff --git a/core/modules/system/tests/src/Functional/Entity/EntityTranslationFormTest.php b/core/modules/system/tests/src/Functional/Entity/EntityTranslationFormTest.php index 4d2372daa1e..235377a20b1 100644 --- a/core/modules/system/tests/src/Functional/Entity/EntityTranslationFormTest.php +++ b/core/modules/system/tests/src/Functional/Entity/EntityTranslationFormTest.php @@ -87,7 +87,7 @@ class EntityTranslationFormTest extends BrowserTestBase { $this->drupalGet('admin/structure/types/manage/page'); $edit = ['language_configuration[language_alterable]' => TRUE, 'language_configuration[langcode]' => LanguageInterface::LANGCODE_NOT_SPECIFIED]; $this->drupalPostForm('admin/structure/types/manage/page', $edit, t('Save content type')); - $this->assertRaw(t('The content type %type has been updated.', ['%type' => 'Basic page']), 'Basic page content type has been updated.'); + $this->assertRaw(t('The content type %type has been updated.', ['%type' => 'Basic page'])); // Create a node with language. $edit = []; diff --git a/core/modules/system/tests/src/Functional/Form/FormTest.php b/core/modules/system/tests/src/Functional/Form/FormTest.php index c0881551b7e..18762a25c11 100644 --- a/core/modules/system/tests/src/Functional/Form/FormTest.php +++ b/core/modules/system/tests/src/Functional/Form/FormTest.php @@ -233,7 +233,7 @@ class FormTest extends BrowserTestBase { ]; $this->drupalPostForm(NULL, $edit, 'Submit'); $this->assertNoFieldByXpath('//div[contains(@class, "error")]', FALSE, 'No error message is displayed when all required fields are filled.'); - $this->assertRaw("The form_test_validate_required_form form was submitted successfully.", 'Validation form submitted successfully.'); + $this->assertRaw("The form_test_validate_required_form form was submitted successfully."); } /** @@ -343,7 +343,7 @@ class FormTest extends BrowserTestBase { // Attempt to submit the form with no required field set. $edit = []; $this->drupalPostForm('form-test/validate-required-no-title', $edit, 'Submit'); - $this->assertNoRaw("The form_test_validate_required_form_no_title form was submitted successfully.", 'Validation form submitted successfully.'); + $this->assertNoRaw("The form_test_validate_required_form_no_title form was submitted successfully."); // Check the page for the error class on the textfield. $this->assertFieldByXPath('//input[contains(@class, "error")]', FALSE, 'Error input form element class found.'); @@ -358,7 +358,7 @@ class FormTest extends BrowserTestBase { ]; $this->drupalPostForm(NULL, $edit, 'Submit'); $this->assertNoFieldByXpath('//input[contains(@class, "error")]', FALSE, 'No error input form element class found.'); - $this->assertRaw("The form_test_validate_required_form_no_title form was submitted successfully.", 'Validation form submitted successfully.'); + $this->assertRaw("The form_test_validate_required_form_no_title form was submitted successfully."); } /** @@ -370,7 +370,7 @@ class FormTest extends BrowserTestBase { // First, try to submit without the required checkbox. $edit = []; $this->drupalPostForm('form-test/checkbox', $edit, t('Submit')); - $this->assertRaw(t('@name field is required.', ['@name' => 'required_checkbox']), 'A required checkbox is actually mandatory'); + $this->assertRaw(t('@name field is required.', ['@name' => 'required_checkbox'])); // Now try to submit the form correctly. $this->drupalPostForm(NULL, ['required_checkbox' => 1], t('Submit')); diff --git a/core/modules/system/tests/src/Functional/Form/StateValuesCleanAdvancedTest.php b/core/modules/system/tests/src/Functional/Form/StateValuesCleanAdvancedTest.php index e3d55f8fcf6..486e3b877ff 100644 --- a/core/modules/system/tests/src/Functional/Form/StateValuesCleanAdvancedTest.php +++ b/core/modules/system/tests/src/Functional/Form/StateValuesCleanAdvancedTest.php @@ -57,7 +57,7 @@ class StateValuesCleanAdvancedTest extends BrowserTestBase { // Expecting a 200 HTTP code. $this->assertSession()->statusCodeEquals(200); - $this->assertRaw(t('You WIN!'), 'Found the success message.'); + $this->assertRaw(t('You WIN!')); } } diff --git a/core/modules/system/tests/src/Functional/Menu/MenuRouterTest.php b/core/modules/system/tests/src/Functional/Menu/MenuRouterTest.php index d4cfa3e29de..5ef24164ad8 100644 --- a/core/modules/system/tests/src/Functional/Menu/MenuRouterTest.php +++ b/core/modules/system/tests/src/Functional/Menu/MenuRouterTest.php @@ -269,7 +269,7 @@ class MenuRouterTest extends BrowserTestBase { protected function doTestThemeCallbackAdministrative() { $this->drupalGet('menu-test/theme-callback/use-admin-theme'); $this->assertText('Active theme: seven. Actual theme: seven.', 'The administrative theme can be correctly set in a theme negotiation.'); - $this->assertRaw('seven/css/base/elements.css', "The administrative theme's CSS appears on the page."); + $this->assertRaw('seven/css/base/elements.css'); } /** @@ -281,14 +281,16 @@ class MenuRouterTest extends BrowserTestBase { // For a regular user, the fact that the site is in maintenance mode means // we expect the theme callback system to be bypassed entirely. $this->drupalGet('menu-test/theme-callback/use-admin-theme'); - $this->assertRaw('bartik/css/base/elements.css', "The maintenance theme's CSS appears on the page."); + // Check that the maintenance theme's CSS appears on the page. + $this->assertRaw('bartik/css/base/elements.css'); // An administrator, however, should continue to see the requested theme. $admin_user = $this->drupalCreateUser(['access site in maintenance mode']); $this->drupalLogin($admin_user); $this->drupalGet('menu-test/theme-callback/use-admin-theme'); $this->assertText('Active theme: seven. Actual theme: seven.', 'The theme negotiation system is correctly triggered for an administrator when the site is in maintenance mode.'); - $this->assertRaw('seven/css/base/elements.css', "The administrative theme's CSS appears on the page."); + // Check that the administrative theme's CSS appears on the page. + $this->assertRaw('seven/css/base/elements.css'); $this->container->get('state')->set('system.maintenance_mode', FALSE); } @@ -300,7 +302,8 @@ class MenuRouterTest extends BrowserTestBase { // Request a theme that is not installed. $this->drupalGet('menu-test/theme-callback/use-test-theme'); $this->assertText('Active theme: bartik. Actual theme: bartik.', 'The theme negotiation system falls back on the default theme when a theme that is not installed is requested.'); - $this->assertRaw('bartik/css/base/elements.css', "The default theme's CSS appears on the page."); + // Check that the default theme's CSS appears on the page. + $this->assertRaw('bartik/css/base/elements.css'); // Now install the theme and request it again. /** @var \Drupal\Core\Extension\ThemeInstallerInterface $theme_installer */ @@ -309,7 +312,8 @@ class MenuRouterTest extends BrowserTestBase { $this->drupalGet('menu-test/theme-callback/use-test-theme'); $this->assertText('Active theme: test_theme. Actual theme: test_theme.', 'The theme negotiation system uses an optional theme once it has been installed.'); - $this->assertRaw('test_theme/kitten.css', "The optional theme's CSS appears on the page."); + // Check that the optional theme's CSS appears on the page. + $this->assertRaw('test_theme/kitten.css'); $theme_installer->uninstall(['test_theme']); } @@ -320,7 +324,8 @@ class MenuRouterTest extends BrowserTestBase { protected function doTestThemeCallbackFakeTheme() { $this->drupalGet('menu-test/theme-callback/use-fake-theme'); $this->assertText('Active theme: bartik. Actual theme: bartik.', 'The theme negotiation system falls back on the default theme when a theme that does not exist is requested.'); - $this->assertRaw('bartik/css/base/elements.css', "The default theme's CSS appears on the page."); + // Check that the default theme's CSS appears on the page. + $this->assertRaw('bartik/css/base/elements.css'); } /** @@ -329,7 +334,8 @@ class MenuRouterTest extends BrowserTestBase { protected function doTestThemeCallbackNoThemeRequested() { $this->drupalGet('menu-test/theme-callback/no-theme-requested'); $this->assertText('Active theme: bartik. Actual theme: bartik.', 'The theme negotiation system falls back on the default theme when no theme is requested.'); - $this->assertRaw('bartik/css/base/elements.css', "The default theme's CSS appears on the page."); + // Check that the default theme's CSS appears on the page. + $this->assertRaw('bartik/css/base/elements.css'); } } diff --git a/core/modules/system/tests/src/Functional/Module/DependencyTest.php b/core/modules/system/tests/src/Functional/Module/DependencyTest.php index b8022c8b884..75f5cfc2aaf 100644 --- a/core/modules/system/tests/src/Functional/Module/DependencyTest.php +++ b/core/modules/system/tests/src/Functional/Module/DependencyTest.php @@ -63,7 +63,7 @@ class DependencyTest extends ModuleTestBase { // Test that the system_dependencies_test module is marked // as missing a dependency. $this->drupalGet('admin/modules'); - $this->assertRaw(t('@module (missing)', ['@module' => Unicode::ucfirst('_missing_dependency')]), 'A module with missing dependencies is marked as such.'); + $this->assertRaw(t('@module (missing)', ['@module' => Unicode::ucfirst('_missing_dependency')])); $checkbox = $this->xpath('//input[@type="checkbox" and @disabled="disabled" and @name="modules[system_dependencies_test][enable]"]'); $this->assertCount(1, $checkbox, 'Checkbox for the module is disabled.'); } @@ -78,7 +78,7 @@ class DependencyTest extends ModuleTestBase { $this->assertRaw(t('@module (incompatible with version @version)', [ '@module' => 'System incompatible module version test (>2.0)', '@version' => '1.0', - ]), 'A module that depends on an incompatible version of a module is marked as such.'); + ])); $checkbox = $this->xpath('//input[@type="checkbox" and @disabled="disabled" and @name="modules[system_incompatible_module_version_dependencies_test][enable]"]'); $this->assertCount(1, $checkbox, 'Checkbox for the module is disabled.'); } @@ -92,7 +92,7 @@ class DependencyTest extends ModuleTestBase { $this->drupalGet('admin/modules'); $this->assertRaw(t('@module (incompatible with this version of Drupal core)', [ '@module' => 'System core incompatible semver test', - ]), 'A module that depends on a module with an incompatible core version is marked as such.'); + ])); $checkbox = $this->xpath('//input[@type="checkbox" and @disabled="disabled" and @name="modules[system_incompatible_core_version_dependencies_test][enable]"]'); $this->assertCount(1, $checkbox, 'Checkbox for the module is disabled.'); } @@ -102,7 +102,7 @@ class DependencyTest extends ModuleTestBase { */ public function testIncompatiblePhpVersionDependency() { $this->drupalGet('admin/modules'); - $this->assertRaw('This module requires PHP version 6502.* and is incompatible with PHP version ' . phpversion() . '.', 'User is informed when the PHP dependency requirement of a module is not met.'); + $this->assertRaw('This module requires PHP version 6502.* and is incompatible with PHP version ' . phpversion() . '.'); $checkbox = $this->xpath('//input[@type="checkbox" and @disabled="disabled" and @name="modules[system_incompatible_php_version_test][enable]"]'); $this->assertCount(1, $checkbox, 'Checkbox for the module is disabled.'); } diff --git a/core/modules/system/tests/src/Functional/Module/UninstallTest.php b/core/modules/system/tests/src/Functional/Module/UninstallTest.php index d6cecaa7862..003ec4684f1 100644 --- a/core/modules/system/tests/src/Functional/Module/UninstallTest.php +++ b/core/modules/system/tests/src/Functional/Module/UninstallTest.php @@ -123,7 +123,8 @@ class UninstallTest extends BrowserTestBase { $this->drupalPostForm(NULL, NULL, t('Uninstall')); $this->assertText(t('The selected modules have been uninstalled.'), 'Modules status has been updated.'); - $this->assertNoRaw('<label', 'The page does not have double escaped HTML tags.'); + // Check that the page does not have double escaped HTML tags. + $this->assertNoRaw('<label'); // Make sure our unique cache entry is gone. $cached = \Drupal::cache()->get('uninstall_test'); diff --git a/core/modules/system/tests/src/Functional/ParamConverter/UpcastingTest.php b/core/modules/system/tests/src/Functional/ParamConverter/UpcastingTest.php index 92bbf1e9273..39db03a3870 100644 --- a/core/modules/system/tests/src/Functional/ParamConverter/UpcastingTest.php +++ b/core/modules/system/tests/src/Functional/ParamConverter/UpcastingTest.php @@ -36,17 +36,20 @@ class UpcastingTest extends BrowserTestBase { // paramconverter_test/test_user_node_foo/{user}/{node}/{foo} $this->drupalGet("paramconverter_test/test_user_node_foo/" . $user->id() . '/' . $node->id() . "/$foo"); - $this->assertRaw("user: {$user->label()}, node: {$node->label()}, foo: $foo", 'user and node upcast by entity name'); + // Verify user and node upcast by entity name. + $this->assertRaw("user: {$user->label()}, node: {$node->label()}, foo: $foo"); // paramconverter_test/test_node_user_user/{node}/{foo}/{user} // options.parameters.foo.type = entity:user $this->drupalGet("paramconverter_test/test_node_user_user/" . $node->id() . "/" . $user->id() . "/" . $user->id()); - $this->assertRaw("user: {$user->label()}, node: {$node->label()}, foo: {$user->label()}", 'foo converted to user as well'); + // Verify foo converted to user as well. + $this->assertRaw("user: {$user->label()}, node: {$node->label()}, foo: {$user->label()}"); // paramconverter_test/test_node_node_foo/{user}/{node}/{foo} // options.parameters.user.type = entity:node $this->drupalGet("paramconverter_test/test_node_node_foo/" . $node->id() . "/" . $node->id() . "/$foo"); - $this->assertRaw("user: {$node->label()}, node: {$node->label()}, foo: $foo", 'user is upcast to node (rather than to user)'); + // Verify that user is upcast to node (rather than to user). + $this->assertRaw("user: {$node->label()}, node: {$node->label()}, foo: $foo"); } /** diff --git a/core/modules/system/tests/src/Functional/Routing/RouterPermissionTest.php b/core/modules/system/tests/src/Functional/Routing/RouterPermissionTest.php index ebf5b3ac9ed..032d23a165d 100644 --- a/core/modules/system/tests/src/Functional/Routing/RouterPermissionTest.php +++ b/core/modules/system/tests/src/Functional/Routing/RouterPermissionTest.php @@ -40,7 +40,7 @@ class RouterPermissionTest extends BrowserTestBase { $this->drupalGet('router_test/test7'); $this->assertSession()->statusCodeEquals(200); $this->assertNoRaw('Access denied'); - $this->assertRaw('test7text', 'The correct string was returned because the route was successful.'); + $this->assertRaw('test7text'); } } diff --git a/core/modules/system/tests/src/Functional/Routing/RouterTest.php b/core/modules/system/tests/src/Functional/Routing/RouterTest.php index d6d4423af65..00207c9f9f0 100644 --- a/core/modules/system/tests/src/Functional/Routing/RouterTest.php +++ b/core/modules/system/tests/src/Functional/Routing/RouterTest.php @@ -37,7 +37,7 @@ class RouterTest extends BrowserTestBase { // Confirm that the router can get to a controller. $this->drupalGet('router_test/test1'); - $this->assertRaw('test1', 'The correct string was returned because the route was successful.'); + $this->assertRaw('test1'); $session = $this->getSession(); // Check expected headers from FinishResponseSubscriber. @@ -48,7 +48,7 @@ class RouterTest extends BrowserTestBase { $this->assertSession()->responseHeaderDoesNotExist('Vary'); $this->drupalGet('router_test/test2'); - $this->assertRaw('test2', 'The correct string was returned because the route was successful.'); + $this->assertRaw('test2'); // Check expected headers from FinishResponseSubscriber. $headers = $session->getResponseHeaders(); $this->assertSession()->responseHeaderEquals('X-Drupal-Cache-Contexts', implode(' ', $expected_cache_contexts)); @@ -56,7 +56,7 @@ class RouterTest extends BrowserTestBase { $this->assertSession()->responseHeaderEquals('X-Drupal-Cache-Max-Age', '-1 (Permanent)'); // Confirm that the page wrapping is being added, so we're not getting a // raw body returned. - $this->assertRaw('', 'Page markup was found.'); + $this->assertRaw(''); // In some instances, the subrequest handling may get confused and render // a page inception style. This test verifies that is not happening. $this->assertSession()->responseNotMatches('#.*#s'); @@ -147,12 +147,12 @@ class RouterTest extends BrowserTestBase { foreach ($values as $value) { $this->drupalGet('router_test/test3/' . $value); $this->assertSession()->statusCodeEquals(200); - $this->assertRaw($value, 'The correct string was returned because the route was successful.'); + $this->assertRaw($value); } // Confirm that the page wrapping is being added, so we're not getting a // raw body returned. - $this->assertRaw('', 'Page markup was found.'); + $this->assertRaw(''); // In some instances, the subrequest handling may get confused and render // a page inception style. This test verifies that is not happening. @@ -165,11 +165,11 @@ class RouterTest extends BrowserTestBase { public function testControllerPlaceholdersDefaultValues() { $this->drupalGet('router_test/test4'); $this->assertSession()->statusCodeEquals(200); - $this->assertRaw('narf', 'The correct string was returned because the route was successful.'); + $this->assertRaw('narf'); // Confirm that the page wrapping is being added, so we're not getting a // raw body returned. - $this->assertRaw('', 'Page markup was found.'); + $this->assertRaw(''); // In some instances, the subrequest handling may get confused and render // a page inception style. This test verifies that is not happening. @@ -182,11 +182,11 @@ class RouterTest extends BrowserTestBase { public function testControllerPlaceholdersDefaultValuesProvided() { $this->drupalGet('router_test/test4/barf'); $this->assertSession()->statusCodeEquals(200); - $this->assertRaw('barf', 'The correct string was returned because the route was successful.'); + $this->assertRaw('barf'); // Confirm that the page wrapping is being added, so we're not getting a // raw body returned. - $this->assertRaw('', 'Page markup was found.'); + $this->assertRaw(''); // In some instances, the subrequest handling may get confused and render // a page inception style. This test verifies that is not happening. @@ -202,7 +202,7 @@ class RouterTest extends BrowserTestBase { // Test the altered route. $this->drupalGet('router_test/test6'); $this->assertSession()->statusCodeEquals(200); - $this->assertRaw('test5', 'The correct string was returned because the route was successful.'); + $this->assertRaw('test5'); } /** @@ -211,11 +211,11 @@ class RouterTest extends BrowserTestBase { public function testControllerResolutionPage() { $this->drupalGet('/router_test/test10'); - $this->assertRaw('abcde', 'Correct body was found.'); + $this->assertRaw('abcde'); // Confirm that the page wrapping is being added, so we're not getting a // raw body returned. - $this->assertRaw('', 'Page markup was found.'); + $this->assertRaw(''); // In some instances, the subrequest handling may get confused and render // a page inception style. This test verifies that is not happening. @@ -294,7 +294,7 @@ class RouterTest extends BrowserTestBase { $this->assertSession()->responseHeaderEquals('Content-Type', 'application/json'); - $this->assertRaw('abcde', 'Correct body was found.'); + $this->assertRaw('abcde'); } /** diff --git a/core/modules/system/tests/src/Functional/Session/SessionTest.php b/core/modules/system/tests/src/Functional/Session/SessionTest.php index 5536d84576a..b35a20cbae1 100644 --- a/core/modules/system/tests/src/Functional/Session/SessionTest.php +++ b/core/modules/system/tests/src/Functional/Session/SessionTest.php @@ -301,7 +301,8 @@ class SessionTest extends BrowserTestBase { // from persisting. $this->mink->resetSessions(); $this->drupalGet('session-test/id-from-cookie'); - $this->assertRaw("session_id:\n", 'Session ID is blank as sent from cookie header.'); + // Verify that session ID is blank as sent from cookie header. + $this->assertRaw("session_id:\n"); // Assert that we have an anonymous session now. $this->drupalGet('session-test/is-logged-in'); $this->assertSession()->statusCodeEquals(403); diff --git a/core/modules/system/tests/src/Functional/System/AdminMetaTagTest.php b/core/modules/system/tests/src/Functional/System/AdminMetaTagTest.php index d17e537b679..82dd89780cb 100644 --- a/core/modules/system/tests/src/Functional/System/AdminMetaTagTest.php +++ b/core/modules/system/tests/src/Functional/System/AdminMetaTagTest.php @@ -23,7 +23,7 @@ class AdminMetaTagTest extends BrowserTestBase { list($version,) = explode('.', \Drupal::VERSION); $string = ''; $this->drupalGet('node'); - $this->assertRaw($string, 'Fingerprinting meta tag generated correctly.', 'System'); + $this->assertRaw($string); } } diff --git a/core/modules/system/tests/src/Functional/System/DateTimeTest.php b/core/modules/system/tests/src/Functional/System/DateTimeTest.php index fef916eb69f..3f1bb71fc48 100644 --- a/core/modules/system/tests/src/Functional/System/DateTimeTest.php +++ b/core/modules/system/tests/src/Functional/System/DateTimeTest.php @@ -134,7 +134,7 @@ class DateTimeTest extends BrowserTestBase { $this->drupalPostForm('admin/config/regional/date-time/formats/manage/' . $date_format_id . '/delete', [], t('Delete')); // Verify that the user is redirected to the correct page. $this->assertSession()->addressEquals(Url::fromRoute('entity.date_format.collection')); - $this->assertRaw(t('The date format %format has been deleted.', ['%format' => $name]), 'Custom date format removed.'); + $this->assertRaw(t('The date format %format has been deleted.', ['%format' => $name])); // Make sure the date does not exist in config. $date_format = DateFormat::load($date_format_id); diff --git a/core/modules/system/tests/src/Functional/System/DefaultMobileMetaTagsTest.php b/core/modules/system/tests/src/Functional/System/DefaultMobileMetaTagsTest.php index 044715b69d1..5fb4a5d4dd1 100644 --- a/core/modules/system/tests/src/Functional/System/DefaultMobileMetaTagsTest.php +++ b/core/modules/system/tests/src/Functional/System/DefaultMobileMetaTagsTest.php @@ -2,7 +2,6 @@ namespace Drupal\Tests\system\Functional\System; -use Drupal\Component\Render\FormattableMarkup; use Drupal\Tests\BrowserTestBase; /** @@ -37,7 +36,7 @@ class DefaultMobileMetaTagsTest extends BrowserTestBase { public function testDefaultMetaTagsExist() { $this->drupalGet(''); foreach ($this->defaultMetaTags as $name => $metatag) { - $this->assertRaw($metatag, new FormattableMarkup('Default Mobile meta tag "@name" displayed properly.', ['@name' => $name]), 'System'); + $this->assertRaw($metatag); } } @@ -48,7 +47,7 @@ class DefaultMobileMetaTagsTest extends BrowserTestBase { \Drupal::service('module_installer')->install(['system_module_test']); $this->drupalGet(''); foreach ($this->defaultMetaTags as $name => $metatag) { - $this->assertNoRaw($metatag, new FormattableMarkup('Default Mobile meta tag "@name" removed properly.', ['@name' => $name]), 'System'); + $this->assertNoRaw($metatag); } } diff --git a/core/modules/system/tests/src/Functional/System/ErrorHandlerTest.php b/core/modules/system/tests/src/Functional/System/ErrorHandlerTest.php index a3a1a873272..0cc9ad2578c 100644 --- a/core/modules/system/tests/src/Functional/System/ErrorHandlerTest.php +++ b/core/modules/system/tests/src/Functional/System/ErrorHandlerTest.php @@ -55,7 +55,7 @@ class ErrorHandlerTest extends BrowserTestBase { $this->assertErrorMessage($error_notice); $this->assertErrorMessage($error_warning); $this->assertErrorMessage($error_user_notice); - $this->assertRaw('
', 'Found pre element with backtrace class.');
+    $this->assertRaw('
');
     // Ensure we are escaping but not double escaping.
     $this->assertRaw('&');
     $this->assertNoRaw('&amp;');
@@ -70,7 +70,7 @@ class ErrorHandlerTest extends BrowserTestBase {
     $this->assertErrorMessage($error_notice);
     $this->assertErrorMessage($error_warning);
     $this->assertErrorMessage($error_user_notice);
-    $this->assertNoRaw('
', 'Did not find pre element with backtrace class.');
+    $this->assertNoRaw('
');
 
     // Set error reporting to not collect notices.
     $config->set('error_level', ERROR_REPORTING_DISPLAY_SOME)->save();
@@ -79,7 +79,7 @@ class ErrorHandlerTest extends BrowserTestBase {
     $this->assertNoErrorMessage($error_notice);
     $this->assertErrorMessage($error_warning);
     $this->assertErrorMessage($error_user_notice);
-    $this->assertNoRaw('
', 'Did not find pre element with backtrace class.');
+    $this->assertNoRaw('
');
 
     // Set error reporting to not show any errors.
     $config->set('error_level', ERROR_REPORTING_HIDE)->save();
@@ -89,7 +89,7 @@ class ErrorHandlerTest extends BrowserTestBase {
     $this->assertNoErrorMessage($error_warning);
     $this->assertNoErrorMessage($error_user_notice);
     $this->assertNoMessages();
-    $this->assertNoRaw('
', 'Did not find pre element with backtrace class.');
+    $this->assertNoRaw('
');
   }
 
   /**
@@ -131,8 +131,7 @@ class ErrorHandlerTest extends BrowserTestBase {
     // error message.
     $this->assertSession()->pageTextContains($error_pdo_exception['@message']);
     $error_details = new FormattableMarkup('in %function (line ', $error_pdo_exception);
-    $this->assertRaw($error_details, new FormattableMarkup("Found '@message' in error page.", ['@message' => $error_details]));
-
+    $this->assertRaw($error_details);
     $this->drupalGet('error-test/trigger-renderer-exception');
     $this->assertSession()->statusCodeEquals(500);
     $this->assertErrorMessage($error_renderer_exception);
@@ -154,7 +153,7 @@ class ErrorHandlerTest extends BrowserTestBase {
    */
   public function assertErrorMessage(array $error) {
     $message = new FormattableMarkup('%type: @message in %function (line ', $error);
-    $this->assertRaw($message, new FormattableMarkup('Found error message: @message.', ['@message' => $message]));
+    $this->assertRaw($message);
   }
 
   /**
@@ -162,7 +161,7 @@ class ErrorHandlerTest extends BrowserTestBase {
    */
   public function assertNoErrorMessage(array $error) {
     $message = new FormattableMarkup('%type: @message in %function (line ', $error);
-    $this->assertNoRaw($message, new FormattableMarkup('Did not find error message: @message.', ['@message' => $message]));
+    $this->assertNoRaw($message);
   }
 
   /**
diff --git a/core/modules/system/tests/src/Functional/System/PageTitleTest.php b/core/modules/system/tests/src/Functional/System/PageTitleTest.php
index 85e82ed2c5d..2d66ac8705b 100644
--- a/core/modules/system/tests/src/Functional/System/PageTitleTest.php
+++ b/core/modules/system/tests/src/Functional/System/PageTitleTest.php
@@ -93,15 +93,18 @@ class PageTitleTest extends BrowserTestBase {
     // Load frontpage.
     $this->drupalGet('');
 
-    // Test the title.
-    $this->assertNoRaw($title, 'Check for the lack of the unfiltered version of the title.');
+    // Test the title, checking for the lack of the unfiltered version of the
+    // title.
+    $this->assertNoRaw($title);
     // Add  to make sure we're checking the title tag, rather than the
     // first 'heading' on the page.
-    $this->assertRaw($title_filtered . '', 'Check for the filtered version of the title in a  tag.');
+    $this->assertRaw($title_filtered . '');
 
     // Test the slogan.
-    $this->assertNoRaw($slogan, 'Check for the unfiltered version of the slogan.');
-    $this->assertRaw($slogan_filtered, 'Check for the filtered version of the slogan.');
+    // Check the unfiltered version of the slogan is missing.
+    $this->assertNoRaw($slogan);
+    // Check for the filtered version of the slogan.
+    $this->assertRaw($slogan_filtered);
   }
 
   /**
diff --git a/core/modules/system/tests/src/Functional/System/SiteMaintenanceTest.php b/core/modules/system/tests/src/Functional/System/SiteMaintenanceTest.php
index 38da8000fec..96d2768b2fd 100644
--- a/core/modules/system/tests/src/Functional/System/SiteMaintenanceTest.php
+++ b/core/modules/system/tests/src/Functional/System/SiteMaintenanceTest.php
@@ -59,7 +59,7 @@ class SiteMaintenanceTest extends BrowserTestBase {
     $permission_label = $permissions['access site in maintenance mode']['title'];
     $permission_message = t('Visitors will only see the maintenance mode message. Only users with the "@permission-label" permission will be able to access the site. Authorized users can log in directly via the user login page.', ['@permission-label' => $permission_label, ':permissions-url' => Url::fromRoute('user.admin_permissions')->toString(), ':user-login' => Url::fromRoute('user.login')->toString()]);
     $this->drupalGet(Url::fromRoute('system.site_maintenance_mode'));
-    $this->assertRaw($permission_message, 'Found the permission message.');
+    $this->assertRaw($permission_message);
 
     $this->drupalGet(Url::fromRoute('user.page'));
     // JS should be aggregated, so drupal.js is not in the page source.
@@ -79,7 +79,7 @@ class SiteMaintenanceTest extends BrowserTestBase {
     // JS should not be aggregated, so drupal.js is expected in the page source.
     $links = $this->xpath('//script[contains(@src, :href)]', [':href' => '/core/misc/drupal.js']);
     $this->assertTrue(isset($links[0]), 'script /core/misc/drupal.js in page');
-    $this->assertRaw($admin_message, 'Found the site maintenance mode message.');
+    $this->assertRaw($admin_message);
 
     // Logout and verify that offline message is displayed.
     $this->drupalLogout();
@@ -112,7 +112,7 @@ class SiteMaintenanceTest extends BrowserTestBase {
     $this->drupalLogout();
     $this->drupalLogin($this->adminUser);
     $this->drupalGet('admin/config/development/maintenance');
-    $this->assertNoRaw($admin_message, 'Site maintenance mode message not displayed.');
+    $this->assertNoRaw($admin_message);
 
     $offline_message = 'Sorry, not online.';
     $edit = [
@@ -124,7 +124,7 @@ class SiteMaintenanceTest extends BrowserTestBase {
     $this->drupalLogout();
     $this->drupalGet('');
     $this->assertEqual('Site under maintenance', $this->cssSelect('main h1')[0]->getText());
-    $this->assertRaw($offline_message, 'Found the site offline message.');
+    $this->assertRaw($offline_message);
 
     // Verify that custom site offline message is not displayed on user/password.
     $this->drupalGet('user/password');
diff --git a/core/modules/system/tests/src/Functional/System/ThemeTest.php b/core/modules/system/tests/src/Functional/System/ThemeTest.php
index 2f1aaf7b527..74979bcced8 100644
--- a/core/modules/system/tests/src/Functional/System/ThemeTest.php
+++ b/core/modules/system/tests/src/Functional/System/ThemeTest.php
@@ -291,17 +291,21 @@ class ThemeTest extends BrowserTestBase {
     ];
     $this->drupalPostForm('admin/appearance', $edit, t('Save configuration'));
 
+    // Check that the administration theme is used on an administration page.
     $this->drupalGet('admin/config');
-    $this->assertRaw('core/themes/seven', 'Administration theme used on an administration page.');
+    $this->assertRaw('core/themes/seven');
 
+    // Check that the site default theme used on node page.
     $this->drupalGet('node/' . $this->node->id());
-    $this->assertRaw('core/themes/classy', 'Site default theme used on node page.');
+    $this->assertRaw('core/themes/classy');
 
+    // Check that the administration theme is used on the add content page.
     $this->drupalGet('node/add');
-    $this->assertRaw('core/themes/seven', 'Administration theme used on the add content page.');
+    $this->assertRaw('core/themes/seven');
 
+    // Check that the administration theme is used on the edit content page.
     $this->drupalGet('node/' . $this->node->id() . '/edit');
-    $this->assertRaw('core/themes/seven', 'Administration theme used on the edit content page.');
+    $this->assertRaw('core/themes/seven');
 
     // Disable the admin theme on the node admin pages.
     $edit = [
@@ -309,19 +313,22 @@ class ThemeTest extends BrowserTestBase {
     ];
     $this->drupalPostForm('admin/appearance', $edit, t('Save configuration'));
 
+    // Check that the administration theme is used on an administration page.
     $this->drupalGet('admin/config');
-    $this->assertRaw('core/themes/seven', 'Administration theme used on an administration page.');
+    $this->assertRaw('core/themes/seven');
 
     // Ensure that the admin theme is also visible on the 403 page.
     $normal_user = $this->drupalCreateUser(['view the administration theme']);
     $this->drupalLogin($normal_user);
+    // Check that the administration theme is used on an administration page.
     $this->drupalGet('admin/config');
     $this->assertSession()->statusCodeEquals(403);
-    $this->assertRaw('core/themes/seven', 'Administration theme used on an administration page.');
+    $this->assertRaw('core/themes/seven');
     $this->drupalLogin($this->adminUser);
 
+    // Check that the site default theme used on the add content page.
     $this->drupalGet('node/add');
-    $this->assertRaw('core/themes/classy', 'Site default theme used on the add content page.');
+    $this->assertRaw('core/themes/classy');
 
     // Reset to the default theme settings.
     $edit = [
@@ -330,11 +337,13 @@ class ThemeTest extends BrowserTestBase {
     ];
     $this->drupalPostForm('admin/appearance', $edit, t('Save configuration'));
 
+    // Check that the site default theme used on administration page.
     $this->drupalGet('admin');
-    $this->assertRaw('core/themes/classy', 'Site default theme used on administration page.');
+    $this->assertRaw('core/themes/classy');
 
+    // Check that the site default theme used on the add content page.
     $this->drupalGet('node/add');
-    $this->assertRaw('core/themes/classy', 'Site default theme used on the add content page.');
+    $this->assertRaw('core/themes/classy');
   }
 
   /**
@@ -405,12 +414,12 @@ class ThemeTest extends BrowserTestBase {
     $this->clickLink(t('Set as default'));
 
     // Check that seven cannot be uninstalled as it is the admin theme.
-    $this->assertNoRaw('Uninstall Seven theme', 'A link to uninstall the Seven theme does not appear on the theme settings page.');
+    $this->assertNoRaw('Uninstall Seven theme');
     // Check that bartik cannot be uninstalled as it is the default theme.
-    $this->assertNoRaw('Uninstall Bartik theme', 'A link to uninstall the Bartik theme does not appear on the theme settings page.');
+    $this->assertNoRaw('Uninstall Bartik theme');
     // Check that the classy theme cannot be uninstalled as it is a base theme
     // of seven and bartik.
-    $this->assertNoRaw('Uninstall Classy theme', 'A link to uninstall the Classy theme does not appear on the theme settings page.');
+    $this->assertNoRaw('Uninstall Classy theme');
 
     // Install Stark and set it as the default theme.
     \Drupal::service('theme_installer')->install(['stark']);
@@ -422,20 +431,20 @@ class ThemeTest extends BrowserTestBase {
     $this->drupalPostForm('admin/appearance', $edit, t('Save configuration'));
 
     // Check that seven can be uninstalled now.
-    $this->assertRaw('Uninstall Seven theme', 'A link to uninstall the Seven theme does appear on the theme settings page.');
+    $this->assertRaw('Uninstall Seven theme');
     // Check that the classy theme still cannot be uninstalled as it is a
     // base theme of bartik.
-    $this->assertNoRaw('Uninstall Classy theme', 'A link to uninstall the Classy theme does not appear on the theme settings page.');
+    $this->assertNoRaw('Uninstall Classy theme');
 
     // Change the default theme to stark, stark is second in the list.
     $this->clickLink(t('Set as default'), 1);
 
     // Check that bartik can be uninstalled now.
-    $this->assertRaw('Uninstall Bartik theme', 'A link to uninstall the Bartik theme does appear on the theme settings page.');
+    $this->assertRaw('Uninstall Bartik theme');
 
     // Check that the classy theme still can't be uninstalled as neither of its
     // base themes have been.
-    $this->assertNoRaw('Uninstall Classy theme', 'A link to uninstall the Classy theme does not appear on the theme settings page.');
+    $this->assertNoRaw('Uninstall Classy theme');
 
     // Uninstall each of the three themes starting with Bartik.
     $this->clickLink(t('Uninstall'));
@@ -445,7 +454,7 @@ class ThemeTest extends BrowserTestBase {
     $this->assertRaw('The Seven theme has been uninstalled');
 
     // Check that the classy theme still can't be uninstalled as it is hidden.
-    $this->assertNoRaw('Uninstall Classy theme', 'A link to uninstall the Classy theme does not appear on the theme settings page.');
+    $this->assertNoRaw('Uninstall Classy theme');
   }
 
   /**
diff --git a/core/modules/system/tests/src/Functional/Theme/TwigTransTest.php b/core/modules/system/tests/src/Functional/Theme/TwigTransTest.php
index 85464dcf56a..63686aaebd8 100644
--- a/core/modules/system/tests/src/Functional/Theme/TwigTransTest.php
+++ b/core/modules/system/tests/src/Functional/Theme/TwigTransTest.php
@@ -155,20 +155,17 @@ class TwigTransTest extends BrowserTestBase {
       '{% trans %} with {% plural count = 2 %} was successfully translated.'
     );
 
-    $this->assertRaw(
-      'ESCAPEE: &"<>',
-      '{{ token }} was successfully translated and prefixed with "@".'
-    );
+    // Assert that {{ token }} was successfully translated and prefixed
+    // with "@".
+    $this->assertRaw('ESCAPEE: &"<>');
 
-    $this->assertRaw(
-      'PLAYSHOLDR: &"<>',
-      '{{ token|placeholder }} was successfully translated and prefixed with "%".'
-    );
+    // Assert that {{ token|placeholder }} was successfully translated and
+    // prefixed with "%".
+    $this->assertRaw('PLAYSHOLDR: &"<>');
 
-    $this->assertRaw(
-      'DIS complex token HAZ LENGTH OV: 3. IT CONTAYNZ: 12345 AN &"<>.',
-      '{{ complex.tokens }} were successfully translated with appropriate prefixes.'
-    );
+    // Assert that {{ complex.tokens }} were successfully translated with
+    // appropriate prefixes.
+    $this->assertRaw('DIS complex token HAZ LENGTH OV: 3. IT CONTAYNZ: 12345 AN &"<>.');
 
     $this->assertText(
       'I have context.',
@@ -213,7 +210,7 @@ class TwigTransTest extends BrowserTestBase {
 
         // Install the language in Drupal.
         $this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add custom language'));
-        $this->assertRaw('"edit-languages-' . $langcode . '-weight"', 'Language code found.');
+        $this->assertRaw('"edit-languages-' . $langcode . '-weight"');
 
         // Import the custom .po contents for the language.
         $filename = $file_system->tempnam('temporary://', "po_") . '.po';
diff --git a/core/modules/taxonomy/tests/src/Functional/RssTest.php b/core/modules/taxonomy/tests/src/Functional/RssTest.php
index 7701e94b61d..0a09eded404 100644
--- a/core/modules/taxonomy/tests/src/Functional/RssTest.php
+++ b/core/modules/taxonomy/tests/src/Functional/RssTest.php
@@ -111,7 +111,7 @@ class RssTest extends TaxonomyTestBase {
       'domain="' . $term1->toUrl('canonical', ['absolute' => TRUE])->toString() . '"',
       $term1->getName()
     );
-    $this->assertRaw($test_element, 'Term is displayed when viewing the rss feed.');
+    $this->assertRaw($test_element);
 
     // Test that the feed icon exists for the term.
     $this->drupalGet("taxonomy/term/{$term1->id()}");
@@ -138,7 +138,7 @@ class RssTest extends TaxonomyTestBase {
     $node = $this->drupalGetNodeByTitle($edit['title[0][value]']);
     $raw_xml = '' . $node->label() . '';
     $this->drupalGet('taxonomy/term/all/feed');
-    $this->assertRaw($raw_xml, "Raw text '$raw_xml' is found.");
+    $this->assertRaw($raw_xml);
     // Unpublish the article and check that it is not shown in the feed.
     $node->setUnpublished()->save();
     $this->drupalGet('taxonomy/term/all/feed');
diff --git a/core/modules/taxonomy/tests/src/Functional/TermIndexTest.php b/core/modules/taxonomy/tests/src/Functional/TermIndexTest.php
index 4e9b62c4ef3..f652e67d202 100644
--- a/core/modules/taxonomy/tests/src/Functional/TermIndexTest.php
+++ b/core/modules/taxonomy/tests/src/Functional/TermIndexTest.php
@@ -244,7 +244,8 @@ class TermIndexTest extends TaxonomyTestBase {
     $this->drupalGet('taxonomy/term/' . $term1->id());
     // Breadcrumbs are not rendered with a language, prevent the term
     // language from being added to the options.
-    $this->assertRaw(Link::fromTextAndUrl($term2->getName(), $term2->toUrl('canonical', ['language' => NULL]))->toString(), 'Parent term link is displayed when viewing the node.');
+    // Check that parent term link is displayed when viewing the node.
+    $this->assertRaw(Link::fromTextAndUrl($term2->getName(), $term2->toUrl('canonical', ['language' => NULL]))->toString());
   }
 
 }
diff --git a/core/modules/taxonomy/tests/src/Functional/TermTest.php b/core/modules/taxonomy/tests/src/Functional/TermTest.php
index 793b7266248..5c97ab6a840 100644
--- a/core/modules/taxonomy/tests/src/Functional/TermTest.php
+++ b/core/modules/taxonomy/tests/src/Functional/TermTest.php
@@ -261,7 +261,7 @@ class TermTest extends TaxonomyTestBase {
 
     // Verify the placeholder is there.
     $this->drupalGet('node/add/article');
-    $this->assertRaw('placeholder="Start typing here."', 'Placeholder is present.');
+    $this->assertRaw('placeholder="Start typing here."');
 
     // Preview and verify the terms appear but are not created.
     $this->drupalPostForm(NULL, $edit, t('Preview'));
@@ -345,7 +345,7 @@ class TermTest extends TaxonomyTestBase {
 
     $this->clickLink(t('Edit'));
 
-    $this->assertRaw($edit['name[0][value]'], 'The randomly generated term name is present.');
+    $this->assertRaw($edit['name[0][value]']);
     $this->assertText($edit['description[0][value]'], 'The randomly generated term description is present.');
 
     $edit = [
@@ -577,9 +577,9 @@ class TermTest extends TaxonomyTestBase {
     // Check that the term is displayed when editing and saving the node with no
     // changes.
     $this->clickLink(t('Edit'));
-    $this->assertRaw($term->getName(), 'Term is displayed when editing the node.');
+    $this->assertRaw($term->getName());
     $this->drupalPostForm(NULL, [], t('Save'));
-    $this->assertRaw($term->getName(), 'Term is displayed after saving the node with no changes.');
+    $this->assertRaw($term->getName());
   }
 
   /**
diff --git a/core/modules/taxonomy/tests/src/Functional/ThemeTest.php b/core/modules/taxonomy/tests/src/Functional/ThemeTest.php
index 8462e284302..c5fdc866cc9 100644
--- a/core/modules/taxonomy/tests/src/Functional/ThemeTest.php
+++ b/core/modules/taxonomy/tests/src/Functional/ThemeTest.php
@@ -42,16 +42,22 @@ class ThemeTest extends TaxonomyTestBase {
     // should use the administrative theme.
     $vocabulary = $this->createVocabulary();
     $this->drupalGet('admin/structure/taxonomy/manage/' . $vocabulary->id() . '/add');
-    $this->assertRaw('seven/css/base/elements.css', t("The administrative theme's CSS appears on the page for adding a taxonomy term."));
+    // Check that the administrative theme's CSS appears on the page for adding
+    // a taxonomy term.
+    $this->assertRaw('seven/css/base/elements.css');
 
     // Viewing a taxonomy term should use the default theme.
     $term = $this->createTerm($vocabulary);
     $this->drupalGet('taxonomy/term/' . $term->id());
-    $this->assertRaw('bartik/css/base/elements.css', t("The default theme's CSS appears on the page for viewing a taxonomy term."));
+    // Check that the default theme's CSS appears on the page for viewing
+    // a taxonomy term.
+    $this->assertRaw('bartik/css/base/elements.css');
 
     // Editing a taxonomy term should use the same theme as adding one.
     $this->drupalGet('taxonomy/term/' . $term->id() . '/edit');
-    $this->assertRaw('seven/css/base/elements.css', t("The administrative theme's CSS appears on the page for editing a taxonomy term."));
+    // Check that the administrative theme's CSS appears on the page for editing
+    // a taxonomy term.
+    $this->assertRaw('seven/css/base/elements.css');
   }
 
 }
diff --git a/core/modules/taxonomy/tests/src/Functional/VocabularyPermissionsTest.php b/core/modules/taxonomy/tests/src/Functional/VocabularyPermissionsTest.php
index b7c32e3ab22..d359ed0b7a0 100644
--- a/core/modules/taxonomy/tests/src/Functional/VocabularyPermissionsTest.php
+++ b/core/modules/taxonomy/tests/src/Functional/VocabularyPermissionsTest.php
@@ -264,11 +264,11 @@ class VocabularyPermissionsTest extends TaxonomyTestBase {
 
     // Delete the vocabulary.
     $this->drupalGet('taxonomy/term/' . $term->id() . '/delete');
-    $this->assertRaw(t('Are you sure you want to delete the @entity-type %label?', ['@entity-type' => 'taxonomy term', '%label' => $edit['name[0][value]']]), 'Delete taxonomy term form opened successfully.');
+    $this->assertRaw(t('Are you sure you want to delete the @entity-type %label?', ['@entity-type' => 'taxonomy term', '%label' => $edit['name[0][value]']]));
 
     // Confirm deletion.
     $this->drupalPostForm(NULL, NULL, t('Delete'));
-    $this->assertRaw(t('Deleted term %name.', ['%name' => $edit['name[0][value]']]), 'Term deleted.');
+    $this->assertRaw(t('Deleted term %name.', ['%name' => $edit['name[0][value]']]));
 
     // Test as user with "create" permissions.
     $user = $this->drupalCreateUser(["create terms in {$vocabulary->id()}"]);
@@ -343,11 +343,11 @@ class VocabularyPermissionsTest extends TaxonomyTestBase {
 
     // Delete the vocabulary.
     $this->drupalGet('taxonomy/term/' . $term->id() . '/delete');
-    $this->assertRaw(t('Are you sure you want to delete the @entity-type %label?', ['@entity-type' => 'taxonomy term', '%label' => $term->getName()]), 'Delete taxonomy term form opened successfully.');
+    $this->assertRaw(t('Are you sure you want to delete the @entity-type %label?', ['@entity-type' => 'taxonomy term', '%label' => $term->getName()]));
 
     // Confirm deletion.
     $this->drupalPostForm(NULL, NULL, t('Delete'));
-    $this->assertRaw(t('Deleted term %name.', ['%name' => $term->getName()]), 'Term deleted.');
+    $this->assertRaw(t('Deleted term %name.', ['%name' => $term->getName()]));
 
     // Test as user without proper permissions.
     $user = $this->drupalCreateUser();
diff --git a/core/modules/taxonomy/tests/src/Functional/VocabularyUiTest.php b/core/modules/taxonomy/tests/src/Functional/VocabularyUiTest.php
index aa5e1e806c8..f7a58b02f30 100644
--- a/core/modules/taxonomy/tests/src/Functional/VocabularyUiTest.php
+++ b/core/modules/taxonomy/tests/src/Functional/VocabularyUiTest.php
@@ -47,7 +47,7 @@ class VocabularyUiTest extends TaxonomyTestBase {
     $edit['description'] = $this->randomMachineName();
     $edit['vid'] = $vid;
     $this->drupalPostForm(NULL, $edit, t('Save'));
-    $this->assertRaw(t('Created new vocabulary %name.', ['%name' => $edit['name']]), 'Vocabulary created successfully.');
+    $this->assertRaw(t('Created new vocabulary %name.', ['%name' => $edit['name']]));
 
     // Edit the vocabulary.
     $this->drupalGet('admin/structure/taxonomy');
@@ -150,12 +150,12 @@ class VocabularyUiTest extends TaxonomyTestBase {
     // Delete the vocabulary.
     $this->drupalGet('admin/structure/taxonomy/manage/' . $vocabulary->id());
     $this->clickLink(t('Delete'));
-    $this->assertRaw(t('Are you sure you want to delete the vocabulary %name?', ['%name' => $vocabulary->label()]), '[confirm deletion] Asks for confirmation.');
+    $this->assertRaw(t('Are you sure you want to delete the vocabulary %name?', ['%name' => $vocabulary->label()]));
     $this->assertText(t('Deleting a vocabulary will delete all the terms in it. This action cannot be undone.'), '[confirm deletion] Inform that all terms will be deleted.');
 
     // Confirm deletion.
     $this->drupalPostForm(NULL, NULL, t('Delete'));
-    $this->assertRaw(t('Deleted vocabulary %name.', ['%name' => $vocabulary->label()]), 'Vocabulary deleted.');
+    $this->assertRaw(t('Deleted vocabulary %name.', ['%name' => $vocabulary->label()]));
     $this->container->get('entity_type.manager')->getStorage('taxonomy_vocabulary')->resetCache();
     $this->assertNull(Vocabulary::load($vid), 'Vocabulary not found.');
   }
diff --git a/core/modules/toolbar/tests/src/Functional/ToolbarAdminMenuTest.php b/core/modules/toolbar/tests/src/Functional/ToolbarAdminMenuTest.php
index 6934ed57a75..3a679fc0fee 100644
--- a/core/modules/toolbar/tests/src/Functional/ToolbarAdminMenuTest.php
+++ b/core/modules/toolbar/tests/src/Functional/ToolbarAdminMenuTest.php
@@ -286,7 +286,7 @@ class ToolbarAdminMenuTest extends BrowserTestBase {
     t($name, [], ['langcode' => $langcode]);
     // Reset locale cache.
     $this->container->get('string_translation')->reset();
-    $this->assertRaw('"edit-languages-' . $langcode . '-weight"', 'Language code found.');
+    $this->assertRaw('"edit-languages-' . $langcode . '-weight"');
     $this->assertText(t($name), 'Test language added.');
 
     // Have the adminUser request a page in the new language.
diff --git a/core/modules/update/tests/src/Functional/UpdateContribTest.php b/core/modules/update/tests/src/Functional/UpdateContribTest.php
index a5aab170400..bbd858b896d 100644
--- a/core/modules/update/tests/src/Functional/UpdateContribTest.php
+++ b/core/modules/update/tests/src/Functional/UpdateContribTest.php
@@ -106,7 +106,7 @@ class UpdateContribTest extends UpdateTestBase {
     $this->assertText(t('Up to date'));
     $this->assertRaw('

' . t('Modules') . '

'); $this->assertNoText('Update available'); - $this->assertRaw($project_link, 'Link to aaa_update_test project appears.'); + $this->assertRaw($project_link); // Since aaa_update_test is installed the fact it is hidden and in the // Testing package means it should not appear. @@ -118,7 +118,7 @@ class UpdateContribTest extends UpdateTestBase { 'aaa_update_test' => '1_0', ] ); - $this->assertNoRaw($project_link, 'Link to aaa_update_test project does not appear.'); + $this->assertNoRaw($project_link); // A hidden and installed project not in the Testing package should appear. $system_info['aaa_update_test']['package'] = 'aaa_update_test'; @@ -129,7 +129,7 @@ class UpdateContribTest extends UpdateTestBase { 'aaa_update_test' => '1_0', ] ); - $this->assertRaw($project_link, 'Link to aaa_update_test project appears.'); + $this->assertRaw($project_link); } /** @@ -190,10 +190,10 @@ class UpdateContribTest extends UpdateTestBase { $this->assertText(t('CCC Update test')); // We want aaa_update_test included in the ccc_update_test project, not as // its own project on the report. - $this->assertNoRaw(Link::fromTextAndUrl(t('AAA Update test'), Url::fromUri('http://example.com/project/aaa_update_test'))->toString(), 'Link to aaa_update_test project does not appear.'); + $this->assertNoRaw(Link::fromTextAndUrl(t('AAA Update test'), Url::fromUri('http://example.com/project/aaa_update_test'))->toString()); // The other two should be listed as projects. - $this->assertRaw(Link::fromTextAndUrl(t('BBB Update test'), Url::fromUri('http://example.com/project/bbb_update_test'))->toString(), 'Link to bbb_update_test project appears.'); - $this->assertRaw(Link::fromTextAndUrl(t('CCC Update test'), Url::fromUri('http://example.com/project/ccc_update_test'))->toString(), 'Link to bbb_update_test project appears.'); + $this->assertRaw(Link::fromTextAndUrl(t('BBB Update test'), Url::fromUri('http://example.com/project/bbb_update_test'))->toString()); + $this->assertRaw(Link::fromTextAndUrl(t('CCC Update test'), Url::fromUri('http://example.com/project/ccc_update_test'))->toString()); // We want to make sure we see the BBB project before the CCC project. // Instead of just searching for 'BBB Update test' or something, we want @@ -240,7 +240,7 @@ class UpdateContribTest extends UpdateTestBase { ]; $this->refreshUpdateStatus($xml_mapping); $this->assertText(t('Security update required!')); - $this->assertRaw(Link::fromTextAndUrl(t('Update test base theme'), Url::fromUri('http://example.com/project/update_test_basetheme'))->toString(), 'Link to the Update test base theme project appears.'); + $this->assertRaw(Link::fromTextAndUrl(t('Update test base theme'), Url::fromUri('http://example.com/project/update_test_basetheme'))->toString()); } /** @@ -396,13 +396,13 @@ class UpdateContribTest extends UpdateTestBase { $this->assertNoText('Themes'); if ($check_disabled) { $this->assertText(t('Uninstalled themes')); - $this->assertRaw($base_theme_project_link, 'Link to the Update test base theme project appears.'); - $this->assertRaw($sub_theme_project_link, 'Link to the Update test subtheme project appears.'); + $this->assertRaw($base_theme_project_link); + $this->assertRaw($sub_theme_project_link); } else { $this->assertNoText('Uninstalled themes'); - $this->assertNoRaw($base_theme_project_link, 'Link to the Update test base theme project does not appear.'); - $this->assertNoRaw($sub_theme_project_link, 'Link to the Update test subtheme project does not appear.'); + $this->assertNoRaw($base_theme_project_link); + $this->assertNoRaw($sub_theme_project_link); } } } @@ -492,9 +492,9 @@ class UpdateContribTest extends UpdateTestBase { $this->assertSession()->pageTextContainsOnce('Failed to get available update data for one project.'); // The other two should be listed as projects. - $this->assertRaw(Link::fromTextAndUrl(t('AAA Update test'), Url::fromUri('http://example.com/project/aaa_update_test'))->toString(), 'Link to aaa_update_test project appears.'); - $this->assertNoRaw(Link::fromTextAndUrl(t('BBB Update test'), Url::fromUri('http://example.com/project/bbb_update_test'))->toString(), 'Link to bbb_update_test project does not appear.'); - $this->assertRaw(Link::fromTextAndUrl(t('CCC Update test'), Url::fromUri('http://example.com/project/ccc_update_test'))->toString(), 'Link to bbb_update_test project appears.'); + $this->assertRaw(Link::fromTextAndUrl(t('AAA Update test'), Url::fromUri('http://example.com/project/aaa_update_test'))->toString()); + $this->assertNoRaw(Link::fromTextAndUrl(t('BBB Update test'), Url::fromUri('http://example.com/project/bbb_update_test'))->toString()); + $this->assertRaw(Link::fromTextAndUrl(t('CCC Update test'), Url::fromUri('http://example.com/project/ccc_update_test'))->toString()); } /** @@ -539,7 +539,7 @@ class UpdateContribTest extends UpdateTestBase { $this->drupalGet('admin/reports/updates'); $this->assertRaw('

' . t('Modules') . '

'); $this->assertText(t('Security update required!')); - $this->assertRaw(Link::fromTextAndUrl(t('AAA Update test'), Url::fromUri('http://example.com/project/aaa_update_test'))->toString(), 'Link to aaa_update_test project appears.'); + $this->assertRaw(Link::fromTextAndUrl(t('AAA Update test'), Url::fromUri('http://example.com/project/aaa_update_test'))->toString()); // Visit the reports page again without the altering and make sure the // status is back to normal. @@ -547,7 +547,7 @@ class UpdateContribTest extends UpdateTestBase { $this->drupalGet('admin/reports/updates'); $this->assertRaw('

' . t('Modules') . '

'); $this->assertNoText('Security update required!'); - $this->assertRaw(Link::fromTextAndUrl(t('AAA Update test'), Url::fromUri('http://example.com/project/aaa_update_test'))->toString(), 'Link to aaa_update_test project appears.'); + $this->assertRaw(Link::fromTextAndUrl(t('AAA Update test'), Url::fromUri('http://example.com/project/aaa_update_test'))->toString()); // Turn the altering back on and visit the Update manager UI. $update_test_config->set('update_status', $update_status)->save(); diff --git a/core/modules/update/tests/src/Functional/UpdateCoreTest.php b/core/modules/update/tests/src/Functional/UpdateCoreTest.php index ba68ad21611..63a5b603a5b 100644 --- a/core/modules/update/tests/src/Functional/UpdateCoreTest.php +++ b/core/modules/update/tests/src/Functional/UpdateCoreTest.php @@ -88,7 +88,7 @@ class UpdateCoreTest extends UpdateTestBase { $this->assertText(t('Up to date')); $this->assertNoText('Update available'); $this->assertNoText('Security update required!'); - $this->assertRaw('check.svg', 'Check icon was found.'); + $this->assertRaw('check.svg'); } } } @@ -126,7 +126,7 @@ class UpdateCoreTest extends UpdateTestBase { $this->assertText(t('Update available')); $this->assertVersionUpdateLinks('Recommended version:', $full_version); $this->assertNoText('Latest version:'); - $this->assertRaw('warning.svg', 'Warning icon was found.'); + $this->assertRaw('warning.svg'); } // Only unstable releases are available. // An unstable release is the latest. @@ -135,7 +135,7 @@ class UpdateCoreTest extends UpdateTestBase { $this->assertNoText('Update available'); $this->assertNoText('Recommended version:'); $this->assertVersionUpdateLinks('Latest version:', $full_version); - $this->assertRaw('check.svg', 'Check icon was found.'); + $this->assertRaw('check.svg'); } break; @@ -147,7 +147,7 @@ class UpdateCoreTest extends UpdateTestBase { $this->assertText(t('Update available')); $this->assertVersionUpdateLinks('Recommended version:', $full_version); $this->assertNoText('Latest version:'); - $this->assertRaw('warning.svg', 'Warning icon was found.'); + $this->assertRaw('warning.svg'); } // Both stable and unstable releases are available. // An unstable release is the latest. @@ -156,7 +156,7 @@ class UpdateCoreTest extends UpdateTestBase { $this->assertText(t('Update available')); $this->assertVersionUpdateLinks('Recommended version:', '8.1.0'); $this->assertVersionUpdateLinks('Latest version:', $full_version); - $this->assertRaw('warning.svg', 'Warning icon was found.'); + $this->assertRaw('warning.svg'); } break; } @@ -178,14 +178,14 @@ class UpdateCoreTest extends UpdateTestBase { $this->clickLink(t('Check manually')); $this->checkForMetaRefresh(); $this->assertNoText('Security update required!'); - $this->assertRaw(Link::fromTextAndUrl('9.0.0', Url::fromUri("http://example.com/drupal-9-0-0-release"))->toString(), 'Link to release appears.'); - $this->assertRaw(Link::fromTextAndUrl(t('Download'), Url::fromUri("http://example.com/drupal-9-0-0.tar.gz"))->toString(), 'Link to download appears.'); - $this->assertRaw(Link::fromTextAndUrl(t('Release notes'), Url::fromUri("http://example.com/drupal-9-0-0-release"))->toString(), 'Link to release notes appears.'); + $this->assertRaw(Link::fromTextAndUrl('9.0.0', Url::fromUri("http://example.com/drupal-9-0-0-release"))->toString()); + $this->assertRaw(Link::fromTextAndUrl(t('Download'), Url::fromUri("http://example.com/drupal-9-0-0.tar.gz"))->toString()); + $this->assertRaw(Link::fromTextAndUrl(t('Release notes'), Url::fromUri("http://example.com/drupal-9-0-0-release"))->toString()); $this->assertNoText('Up to date'); $this->assertText(t('Not supported!')); $this->assertText(t('Recommended version:')); $this->assertNoText('Latest version:'); - $this->assertRaw('error.svg', 'Error icon was found.'); + $this->assertRaw('error.svg'); } } } diff --git a/core/modules/update/tests/src/Functional/UpdateTestBase.php b/core/modules/update/tests/src/Functional/UpdateTestBase.php index e1d55cc60ad..effdcab9dad 100644 --- a/core/modules/update/tests/src/Functional/UpdateTestBase.php +++ b/core/modules/update/tests/src/Functional/UpdateTestBase.php @@ -107,7 +107,8 @@ abstract class UpdateTestBase extends BrowserTestBase { */ protected function standardTests() { $this->assertRaw('

' . t('Drupal core') . '

'); - $this->assertRaw(Link::fromTextAndUrl(t('Drupal'), Url::fromUri('http://example.com/project/drupal'))->toString(), 'Link to the Drupal project appears.'); + // Verify that the link to the Drupal project appears. + $this->assertRaw(Link::fromTextAndUrl(t('Drupal'), Url::fromUri('http://example.com/project/drupal'))->toString()); $this->assertNoText('No available releases found'); } diff --git a/core/modules/user/tests/src/Functional/UserAdminTest.php b/core/modules/user/tests/src/Functional/UserAdminTest.php index 319220750ed..32bc8d54de1 100644 --- a/core/modules/user/tests/src/Functional/UserAdminTest.php +++ b/core/modules/user/tests/src/Functional/UserAdminTest.php @@ -63,7 +63,7 @@ class UserAdminTest extends BrowserTestBase { // Test for existence of edit link in table. $link = $user_a->toLink(t('Edit'), 'edit-form', ['query' => ['destination' => $user_a->toUrl('collection')->toString()]])->toString(); - $this->assertRaw($link, 'Found user A edit link on admin users page'); + $this->assertRaw($link); // Test exposed filter elements. foreach (['user', 'role', 'permission', 'status'] as $field) { @@ -168,7 +168,7 @@ class UserAdminTest extends BrowserTestBase { ]); $this->drupalLogin($admin_user); $this->drupalGet('admin/config/people/accounts'); - $this->assertRaw('id="edit-mail-notification-address"', 'Notification Email address field exists'); + $this->assertRaw('id="edit-mail-notification-address"'); $this->drupalLogout(); // Test custom user registration approval email address(es). diff --git a/core/modules/user/tests/src/Functional/UserCancelTest.php b/core/modules/user/tests/src/Functional/UserCancelTest.php index 824274a5f30..f1d7c411e89 100644 --- a/core/modules/user/tests/src/Functional/UserCancelTest.php +++ b/core/modules/user/tests/src/Functional/UserCancelTest.php @@ -56,7 +56,7 @@ class UserCancelTest extends BrowserTestBase { // Attempt to cancel account. $this->drupalGet('user/' . $account->id() . '/edit'); - $this->assertNoRaw(t('Cancel account'), 'No cancel account button displayed.'); + $this->assertNoRaw(t('Cancel account')); // Attempt bogus account cancellation request confirmation. $timestamp = $account->getLastLoginTime(); @@ -89,7 +89,7 @@ class UserCancelTest extends BrowserTestBase { $this->drupalPostForm('user_form_test_cancel/' . $account->id(), [], t('Cancel account')); // Confirm deletion. - $this->assertRaw(t('%name has been deleted.', ['%name' => $account->getAccountName()]), 'User deleted.'); + $this->assertRaw(t('%name has been deleted.', ['%name' => $account->getAccountName()])); $this->assertNull(User::load($account->id()), 'User is not found in the database.'); } @@ -202,7 +202,7 @@ class UserCancelTest extends BrowserTestBase { $this->assertTrue($account->isBlocked(), 'User has been blocked.'); // Confirm that the confirmation message made it through to the end user. - $this->assertRaw(t('%name has been disabled.', ['%name' => $account->getAccountName()]), "Confirmation message displayed to user."); + $this->assertRaw(t('%name has been disabled.', ['%name' => $account->getAccountName()])); } /** @@ -259,7 +259,7 @@ class UserCancelTest extends BrowserTestBase { $this->assertSession()->addressEquals(''); $this->assertSession()->statusCodeEquals(200); // Confirm that the confirmation message made it through to the end user. - $this->assertRaw(t('%name has been disabled.', ['%name' => $account->getAccountName()]), "Confirmation message displayed to user."); + $this->assertRaw(t('%name has been disabled.', ['%name' => $account->getAccountName()])); $user_storage->resetCache([$account->id()]); $account = $user_storage->load($account->id()); @@ -326,7 +326,7 @@ class UserCancelTest extends BrowserTestBase { $this->drupalGet('user/' . $account->id() . '/edit'); $this->drupalPostForm(NULL, NULL, t('Cancel account')); $this->assertText(t('Are you sure you want to cancel your account?'), 'Confirmation form to cancel account displayed.'); - $this->assertRaw(t('Your account will be removed and all account information deleted. All of your content will be assigned to the %anonymous-name user.', ['%anonymous-name' => $this->config('user.settings')->get('anonymous')]), 'Informs that all content will be attributed to anonymous account.'); + $this->assertRaw(t('Your account will be removed and all account information deleted. All of your content will be assigned to the %anonymous-name user.', ['%anonymous-name' => $this->config('user.settings')->get('anonymous')])); // Confirm account cancellation. $timestamp = time(); @@ -356,7 +356,7 @@ class UserCancelTest extends BrowserTestBase { $this->assertEqual($test_comment->getAuthorName(), $anonymous_user->getDisplayName(), 'Comment of the user has been attributed to anonymous user name.'); // Confirm that the confirmation message made it through to the end user. - $this->assertRaw(t('%name has been deleted.', ['%name' => $account->getAccountName()]), "Confirmation message displayed to user."); + $this->assertRaw(t('%name has been deleted.', ['%name' => $account->getAccountName()])); } /** @@ -386,7 +386,7 @@ class UserCancelTest extends BrowserTestBase { $this->drupalGet('user/' . $account->id() . '/edit'); $this->drupalPostForm(NULL, NULL, t('Cancel account')); $this->assertText(t('Are you sure you want to cancel your account?'), 'Confirmation form to cancel account displayed.'); - $this->assertRaw(t('Your account will be removed and all account information deleted. All of your content will be assigned to the %anonymous-name user.', ['%anonymous-name' => $this->config('user.settings')->get('anonymous')]), 'Informs that all content will be attributed to anonymous account.'); + $this->assertRaw(t('Your account will be removed and all account information deleted. All of your content will be assigned to the %anonymous-name user.', ['%anonymous-name' => $this->config('user.settings')->get('anonymous')])); // Confirm account cancellation. $timestamp = time(); @@ -479,7 +479,7 @@ class UserCancelTest extends BrowserTestBase { $this->assertNull(Comment::load($comment->id()), 'Comment of the user has been deleted.'); // Confirm that the confirmation message made it through to the end user. - $this->assertRaw(t('%name has been deleted.', ['%name' => $account->getAccountName()]), "Confirmation message displayed to user."); + $this->assertRaw(t('%name has been deleted.', ['%name' => $account->getAccountName()])); } /** @@ -498,12 +498,12 @@ class UserCancelTest extends BrowserTestBase { // Delete regular user. $this->drupalGet('user/' . $account->id() . '/edit'); $this->drupalPostForm(NULL, NULL, t('Cancel account')); - $this->assertRaw(t('Are you sure you want to cancel the account %name?', ['%name' => $account->getAccountName()]), 'Confirmation form to cancel account displayed.'); + $this->assertRaw(t('Are you sure you want to cancel the account %name?', ['%name' => $account->getAccountName()])); $this->assertText(t('Select the method to cancel the account above.'), 'Allows to select account cancellation method.'); // Confirm deletion. $this->drupalPostForm(NULL, NULL, t('Cancel account')); - $this->assertRaw(t('%name has been deleted.', ['%name' => $account->getAccountName()]), 'User deleted.'); + $this->assertRaw(t('%name has been deleted.', ['%name' => $account->getAccountName()])); $this->assertNull(User::load($account->id()), 'User is not found in the database.'); } @@ -526,12 +526,12 @@ class UserCancelTest extends BrowserTestBase { // Delete regular user without email address. $this->drupalGet('user/' . $account->id() . '/edit'); $this->drupalPostForm(NULL, NULL, t('Cancel account')); - $this->assertRaw(t('Are you sure you want to cancel the account %name?', ['%name' => $account->getAccountName()]), 'Confirmation form to cancel account displayed.'); + $this->assertRaw(t('Are you sure you want to cancel the account %name?', ['%name' => $account->getAccountName()])); $this->assertText(t('Select the method to cancel the account above.'), 'Allows to select account cancellation method.'); // Confirm deletion. $this->drupalPostForm(NULL, NULL, t('Cancel account')); - $this->assertRaw(t('%name has been deleted.', ['%name' => $account->getAccountName()]), 'User deleted.'); + $this->assertRaw(t('%name has been deleted.', ['%name' => $account->getAccountName()])); $this->assertNull(User::load($account->id()), 'User is not found in the database.'); } diff --git a/core/modules/user/tests/src/Functional/UserCreateTest.php b/core/modules/user/tests/src/Functional/UserCreateTest.php index fef1a53b05a..c9385520fbb 100644 --- a/core/modules/user/tests/src/Functional/UserCreateTest.php +++ b/core/modules/user/tests/src/Functional/UserCreateTest.php @@ -81,18 +81,18 @@ class UserCreateTest extends BrowserTestBase { $this->assertFieldByXPath('//input[@type="radio" and @id="edit-status-1" and @checked="checked"]', NULL, 'Default setting for user status is active.'); // Test that browser autocomplete behavior does not occur. - $this->assertNoRaw('data-user-info-from-browser', 'Ensure form attribute, data-user-info-from-browser, does not exist.'); + $this->assertNoRaw('data-user-info-from-browser'); // Test that the password strength indicator displays. $config = $this->config('user.settings'); $config->set('password_strength', TRUE)->save(); $this->drupalGet('admin/people/create'); - $this->assertRaw(t('Password strength:'), 'The password strength indicator is displayed.'); + $this->assertRaw(t('Password strength:')); $config->set('password_strength', FALSE)->save(); $this->drupalGet('admin/people/create'); - $this->assertNoRaw(t('Password strength:'), 'The password strength indicator is not displayed.'); + $this->assertNoRaw(t('Password strength:')); // We create two users, notifying one and not notifying the other, to // ensure that the tests work in both cases. diff --git a/core/modules/user/tests/src/Functional/UserEditTest.php b/core/modules/user/tests/src/Functional/UserEditTest.php index f15597c4848..29585b40883 100644 --- a/core/modules/user/tests/src/Functional/UserEditTest.php +++ b/core/modules/user/tests/src/Functional/UserEditTest.php @@ -94,11 +94,11 @@ class UserEditTest extends BrowserTestBase { $config->set('password_strength', TRUE)->save(); $this->drupalPostForm("user/" . $user1->id() . "/edit", $edit, t('Save')); - $this->assertRaw(t('Password strength:'), 'The password strength indicator is displayed.'); + $this->assertRaw(t('Password strength:')); $config->set('password_strength', FALSE)->save(); $this->drupalPostForm("user/" . $user1->id() . "/edit", $edit, t('Save')); - $this->assertNoRaw(t('Password strength:'), 'The password strength indicator is not displayed.'); + $this->assertNoRaw(t('Password strength:')); // Check that the user status field has the correct value and that it is // properly displayed. diff --git a/core/modules/user/tests/src/Functional/UserPasswordResetTest.php b/core/modules/user/tests/src/Functional/UserPasswordResetTest.php index 25d4c8ad33f..66f2adb812b 100644 --- a/core/modules/user/tests/src/Functional/UserPasswordResetTest.php +++ b/core/modules/user/tests/src/Functional/UserPasswordResetTest.php @@ -167,7 +167,7 @@ class UserPasswordResetTest extends BrowserTestBase { $before = count($this->drupalGetMails(['id' => 'user_password_reset'])); $edit = ['name' => $blocked_account->getAccountName()]; $this->drupalPostForm(NULL, $edit, t('Submit')); - $this->assertRaw(t('%name is blocked or has not been activated yet.', ['%name' => $blocked_account->getAccountName()]), 'Notified user blocked accounts can not request a new password'); + $this->assertRaw(t('%name is blocked or has not been activated yet.', ['%name' => $blocked_account->getAccountName()])); $this->assertCount($before, $this->drupalGetMails(['id' => 'user_password_reset']), 'No email was sent when requesting password reset for a blocked account'); // Verify a password reset link is invalidated when the user's email address changes. diff --git a/core/modules/user/tests/src/Functional/UserPictureTest.php b/core/modules/user/tests/src/Functional/UserPictureTest.php index e0016080907..7f1f38e716a 100644 --- a/core/modules/user/tests/src/Functional/UserPictureTest.php +++ b/core/modules/user/tests/src/Functional/UserPictureTest.php @@ -72,7 +72,7 @@ class UserPictureTest extends BrowserTestBase { // Verify that the image is displayed on the user account page. $this->drupalGet('user'); - $this->assertRaw(StreamWrapperManager::getTarget($file->getFileUri()), 'User picture found on user account page.'); + $this->assertRaw(StreamWrapperManager::getTarget($file->getFileUri())); // Delete the picture. $edit = []; @@ -143,7 +143,7 @@ class UserPictureTest extends BrowserTestBase { ->save(); $this->drupalGet('node/' . $node->id()); - $this->assertNoRaw(StreamWrapperManager::getTarget($file->getFileUri()), 'User picture not found on node and comment.'); + $this->assertNoRaw(StreamWrapperManager::getTarget($file->getFileUri())); } /** diff --git a/core/modules/user/tests/src/Functional/UserRegistrationTest.php b/core/modules/user/tests/src/Functional/UserRegistrationTest.php index 77d53a8f0a4..76cf00caf24 100644 --- a/core/modules/user/tests/src/Functional/UserRegistrationTest.php +++ b/core/modules/user/tests/src/Functional/UserRegistrationTest.php @@ -338,12 +338,12 @@ class UserRegistrationTest extends BrowserTestBase { $edit['test_user_field[0][value]'] = ''; $this->drupalPostForm(NULL, $edit, t('Create new account')); $this->assertRegistrationFormCacheTagsWithUserFields(); - $this->assertRaw(t('@name field is required.', ['@name' => $field->label()]), 'Field validation error was correctly reported.'); + $this->assertRaw(t('@name field is required.', ['@name' => $field->label()])); // Invalid input. $edit['test_user_field[0][value]'] = '-1'; $this->drupalPostForm(NULL, $edit, t('Create new account')); $this->assertRegistrationFormCacheTagsWithUserFields(); - $this->assertRaw(t('%name does not accept the value -1.', ['%name' => $field->label()]), 'Field validation error was correctly reported.'); + $this->assertRaw(t('%name does not accept the value -1.', ['%name' => $field->label()])); // Submit with valid data. $value = rand(1, 255); diff --git a/core/modules/user/tests/src/Functional/UserRoleAdminTest.php b/core/modules/user/tests/src/Functional/UserRoleAdminTest.php index 56242c5db5f..58b9de6126a 100644 --- a/core/modules/user/tests/src/Functional/UserRoleAdminTest.php +++ b/core/modules/user/tests/src/Functional/UserRoleAdminTest.php @@ -73,7 +73,7 @@ class UserRoleAdminTest extends BrowserTestBase { // Try adding a duplicate role. $this->drupalPostForm('admin/people/roles/add', $edit, t('Save')); - $this->assertRaw(t('The machine-readable name is already in use. It must be unique.'), 'Duplicate role warning displayed.'); + $this->assertRaw(t('The machine-readable name is already in use. It must be unique.')); // Test renaming a role. $role_name = '456'; diff --git a/core/modules/user/tests/src/Functional/Views/BulkFormTest.php b/core/modules/user/tests/src/Functional/Views/BulkFormTest.php index 20335a17ec8..ec15ddca383 100644 --- a/core/modules/user/tests/src/Functional/Views/BulkFormTest.php +++ b/core/modules/user/tests/src/Functional/Views/BulkFormTest.php @@ -83,7 +83,7 @@ class BulkFormTest extends UserTestBase { // Block a user using the bulk form. $this->assertTrue($account->isActive(), 'The user is not blocked.'); - $this->assertRaw($account->label(), 'The user is found in the table.'); + $this->assertRaw($account->label()); $edit = [ 'user_bulk_form[1]' => TRUE, 'action' => 'user_block_user_action', @@ -93,7 +93,7 @@ class BulkFormTest extends UserTestBase { $user_storage->resetCache([$account->id()]); $account = $user_storage->load($account->id()); $this->assertTrue($account->isBlocked(), 'The user is blocked.'); - $this->assertNoRaw($account->label(), 'The user is not found in the table.'); + $this->assertNoRaw($account->label()); // Remove the user status filter from the view. $view = Views::getView('test_user_bulk_form'); diff --git a/core/modules/views/tests/src/Functional/Plugin/ArgumentDefaultTest.php b/core/modules/views/tests/src/Functional/Plugin/ArgumentDefaultTest.php index a446bafc1c9..92d0a7c2790 100644 --- a/core/modules/views/tests/src/Functional/Plugin/ArgumentDefaultTest.php +++ b/core/modules/views/tests/src/Functional/Plugin/ArgumentDefaultTest.php @@ -2,7 +2,6 @@ namespace Drupal\Tests\views\Functional\Plugin; -use Drupal\Component\Render\FormattableMarkup; use Drupal\Core\Url; use Drupal\node\Entity\Node; use Drupal\node\Entity\NodeType; @@ -111,7 +110,7 @@ class ArgumentDefaultTest extends ViewTestBase { '%function' => 'views_handler_argument->validateOptionsForm()', ]; $message = t('%type: @message in %function', $error); - $this->assertNoRaw($message, new FormattableMarkup('Did not find error message: @message.', ['@message' => $message])); + $this->assertNoRaw($message); } /** diff --git a/core/modules/views/tests/src/Functional/Plugin/ExposedFormTest.php b/core/modules/views/tests/src/Functional/Plugin/ExposedFormTest.php index 81ec1bf0906..20f4e1fcfac 100644 --- a/core/modules/views/tests/src/Functional/Plugin/ExposedFormTest.php +++ b/core/modules/views/tests/src/Functional/Plugin/ExposedFormTest.php @@ -219,7 +219,7 @@ class ExposedFormTest extends ViewTestBase { // Test that the custom block label is found. $this->drupalGet('test_exposed_block'); - $this->assertRaw('Custom titlealert("hacked!");', 'Custom block title found.'); + $this->assertRaw('Custom titlealert("hacked!");'); // Set label to hidden on the exposed filter form block. $block->getPlugin()->setConfigurationValue('label_display', FALSE); @@ -227,7 +227,7 @@ class ExposedFormTest extends ViewTestBase { // Test that the label is removed. $this->drupalGet('test_exposed_block'); - $this->assertNoRaw('Custom titlealert("hacked!");', 'Custom title was not displayed.'); + $this->assertNoRaw('Custom titlealert("hacked!");'); $this->assertNoText($view->getTitle(), 'Block title was not displayed.'); // Test there is an exposed form in a block. @@ -398,15 +398,17 @@ class ExposedFormTest extends ViewTestBase { $this->assertSession()->statusCodeEquals(200); $form = $this->cssSelect('form.views-exposed-form'); $this->assertNotEmpty($form, 'The exposed form element was found.'); - $this->assertRaw(t('Apply'), 'Ensure the exposed form is rendered before submitting the normal form.'); - $this->assertRaw('
', 'Views result shown.'); + // Ensure the exposed form is rendered before submitting the normal form. + $this->assertRaw(t('Apply')); + $this->assertRaw('
'); $this->drupalPostForm(NULL, [], t('Submit')); $this->assertSession()->statusCodeEquals(200); $form = $this->cssSelect('form.views-exposed-form'); $this->assertNotEmpty($form, 'The exposed form element was found.'); - $this->assertRaw(t('Apply'), 'Ensure the exposed form is rendered after submitting the normal form.'); - $this->assertRaw('
', 'Views result shown.'); + // Ensure the exposed form is rendered after submitting the normal form. + $this->assertRaw(t('Apply')); + $this->assertRaw('
'); } /** diff --git a/core/modules/views/tests/src/Functional/Plugin/StyleTableTest.php b/core/modules/views/tests/src/Functional/Plugin/StyleTableTest.php index 8add47390b2..46b665a22d6 100644 --- a/core/modules/views/tests/src/Functional/Plugin/StyleTableTest.php +++ b/core/modules/views/tests/src/Functional/Plugin/StyleTableTest.php @@ -210,7 +210,7 @@ class StyleTableTest extends ViewTestBase { ]; // Ensure that we don't find the caption containing unsafe markup. - $this->assertNoRaw($unsafe_markup, "Didn't find caption containing unsafe markup."); + $this->assertNoRaw($unsafe_markup); // Ensure that the summary isn't shown. $this->assertEmpty($this->xpath('//caption/details')); @@ -234,7 +234,7 @@ class StyleTableTest extends ViewTestBase { ]; // Ensure that we don't find the caption containing unsafe markup. - $this->assertNoRaw($unsafe_markup, "Didn't find caption containing unsafe markup."); + $this->assertNoRaw($unsafe_markup); // Ensure that all expected captions are found. foreach ($expected_captions as $raw_caption) { diff --git a/core/modules/views/tests/src/Functional/ViewsEscapingTest.php b/core/modules/views/tests/src/Functional/ViewsEscapingTest.php index 46a40705971..af16703094b 100644 --- a/core/modules/views/tests/src/Functional/ViewsEscapingTest.php +++ b/core/modules/views/tests/src/Functional/ViewsEscapingTest.php @@ -82,8 +82,8 @@ class ViewsEscapingTest extends ViewTestBase { // Test with a field header label having a XSS test as a wrapper. $this->drupalGet('test_field_header_xss'); - // Assert that XSS test is escaped. - $this->assertNoRaw('', 'Harmful tags are escaped in header label.'); + // Assert that harmful tags are escaped in header label. + $this->assertNoRaw(''); } } diff --git a/core/modules/views/tests/src/Functional/ViewsThemeIntegrationTest.php b/core/modules/views/tests/src/Functional/ViewsThemeIntegrationTest.php index cd6b9985779..2f2bba3991f 100644 --- a/core/modules/views/tests/src/Functional/ViewsThemeIntegrationTest.php +++ b/core/modules/views/tests/src/Functional/ViewsThemeIntegrationTest.php @@ -61,8 +61,8 @@ class ViewsThemeIntegrationTest extends ViewTestBase { // Make sure a views rendered page is touched. $this->drupalGet('test_page_display_200'); - $this->assertRaw("test_basetheme_views_pre_render", "Views title changed by test_basetheme.test_basetheme_views_pre_render"); - $this->assertRaw("test_basetheme_views_post_render", "Views title changed by test_basetheme.test_basetheme_views_post_render"); + $this->assertRaw("test_basetheme_views_pre_render"); + $this->assertRaw("test_basetheme_views_post_render"); // Make sub theme default to test for hook invocation // from both sub and base theme. @@ -74,13 +74,14 @@ class ViewsThemeIntegrationTest extends ViewTestBase { // Make sure a views rendered page is touched. $this->drupalGet('test_page_display_200'); - $this->assertRaw("test_subtheme_views_pre_render", "Views title changed by test_subtheme.test_subtheme_views_pre_render"); - $this->assertRaw("test_subtheme_views_post_render", "Views title changed by test_subtheme.test_subtheme_views_post_render"); + $this->assertRaw("test_subtheme_views_pre_render"); + $this->assertRaw("test_subtheme_views_post_render"); - $this->assertRaw("test_basetheme_views_pre_render", "Views title changed by test_basetheme.test_basetheme_views_pre_render"); - $this->assertRaw("test_basetheme_views_post_render", "Views title changed by test_basetheme.test_basetheme_views_post_render"); + $this->assertRaw("test_basetheme_views_pre_render"); + $this->assertRaw("test_basetheme_views_post_render"); - $this->assertRaw('' . count($this->dataSet()) . ' items found.', 'Views group title added by test_subtheme.test_subtheme_views_post_render'); + // Verify that the views group title is added. + $this->assertRaw('' . count($this->dataSet()) . ' items found.'); } } diff --git a/core/modules/views_ui/tests/src/Functional/ExposedFormUITest.php b/core/modules/views_ui/tests/src/Functional/ExposedFormUITest.php index ac5bc976f97..3f1fc6431fb 100644 --- a/core/modules/views_ui/tests/src/Functional/ExposedFormUITest.php +++ b/core/modules/views_ui/tests/src/Functional/ExposedFormUITest.php @@ -266,12 +266,8 @@ class ExposedFormUITest extends UITestBase { */ protected function assertNoGroupedFilterErrors($message = '', $group = 'Other') { foreach ($this->groupFormUiErrors as $error) { - $err_message = $message; - if (empty($err_message)) { - $err_message = "Verify that '$error' is not in the HTML output."; - } if (empty($message)) { - return $this->assertNoRaw($error, $err_message, $group); + return $this->assertNoRaw($error); } } return TRUE; diff --git a/core/modules/views_ui/tests/src/Functional/FilterUITest.php b/core/modules/views_ui/tests/src/Functional/FilterUITest.php index f6fb198f44c..48da80f5f02 100644 --- a/core/modules/views_ui/tests/src/Functional/FilterUITest.php +++ b/core/modules/views_ui/tests/src/Functional/FilterUITest.php @@ -79,7 +79,7 @@ class FilterUITest extends UITestBase { // Tests that we can create a new filter group from UI. $this->drupalGet('admin/structure/views/nojs/rearrange-filter/test_filter_groups/page'); - $this->assertNoRaw('Group 3', 'Group 3 has not been added yet.'); + $this->assertNoRaw('Group 3'); // Create 2 new groups. $this->drupalPostForm(NULL, [], t('Create new filter group')); @@ -89,13 +89,13 @@ class FilterUITest extends UITestBase { $this->drupalPostForm(NULL, [], t('Remove group 3')); // Verify that the group 4 is now named as 3. - $this->assertRaw('Group 3', 'Group 3 still exists.'); + $this->assertRaw('Group 3'); // Remove the group 3 again. $this->drupalPostForm(NULL, [], t('Remove group 3')); // Group 3 now does not exist. - $this->assertNoRaw('Group 3', 'Group 3 has not been added yet.'); + $this->assertNoRaw('Group 3'); } /** diff --git a/core/modules/views_ui/tests/src/Functional/HandlerTest.php b/core/modules/views_ui/tests/src/Functional/HandlerTest.php index f44441d2010..6fa939bc7ab 100644 --- a/core/modules/views_ui/tests/src/Functional/HandlerTest.php +++ b/core/modules/views_ui/tests/src/Functional/HandlerTest.php @@ -269,7 +269,7 @@ class HandlerTest extends UITestBase { // description field is shown instead. $this->drupalGet('admin/structure/views/nojs/add-handler/test_node_view/default/field'); $this->assertNoText('Error: missing help'); - $this->assertRaw('', 'Empty description found'); + $this->assertRaw(''); // Test that no error message is shown for other fields. $this->drupalGet('admin/structure/views/nojs/add-handler/test_view_empty/default/field'); diff --git a/core/modules/views_ui/tests/src/Functional/PreviewTest.php b/core/modules/views_ui/tests/src/Functional/PreviewTest.php index 618aafe50c9..458e4d63368 100644 --- a/core/modules/views_ui/tests/src/Functional/PreviewTest.php +++ b/core/modules/views_ui/tests/src/Functional/PreviewTest.php @@ -148,7 +148,7 @@ SQL; $this->assertCount(1, $elements, 'Views Query Preview Info area altered.'); // Check that additional assets are attached. $this->assertStringContainsString('views_ui_test/views_ui_test.test', $this->getDrupalSettings()['ajaxPageState']['libraries'], 'Attached library found.'); - $this->assertRaw('css/views_ui_test.test.css', 'Attached CSS asset found.'); + $this->assertRaw('css/views_ui_test.test.css'); } /** diff --git a/core/modules/views_ui/tests/src/Functional/ReportFieldsTest.php b/core/modules/views_ui/tests/src/Functional/ReportFieldsTest.php index 6dd8003a1e8..98d0077c51e 100644 --- a/core/modules/views_ui/tests/src/Functional/ReportFieldsTest.php +++ b/core/modules/views_ui/tests/src/Functional/ReportFieldsTest.php @@ -32,8 +32,8 @@ class ReportFieldsTest extends UITestBase { */ public function testReportFields() { $this->drupalGet('admin/reports/fields/views-fields'); - $this->assertRaw('Used in views', 'Title appears correctly'); - $this->assertRaw('No fields have been used in views yet.', 'No results message appears correctly.'); + $this->assertRaw('Used in views'); + $this->assertRaw('No fields have been used in views yet.'); // Set up the field_test field. $field_storage = FieldStorageConfig::create([ @@ -50,11 +50,11 @@ class ReportFieldsTest extends UITestBase { ]); $field->save(); - $this->drupalGet('admin/reports/fields/views-fields'); // Assert that the newly created field appears in the overview. - $this->assertRaw('field_test', 'Field name appears correctly'); - $this->assertRaw('>test_field_field_test', 'View name appears correctly'); - $this->assertRaw('Used in views', 'Title appears correctly'); + $this->drupalGet('admin/reports/fields/views-fields'); + $this->assertRaw('field_test'); + $this->assertRaw('>test_field_field_test'); + $this->assertRaw('Used in views'); } } diff --git a/core/profiles/standard/tests/src/Functional/StandardTest.php b/core/profiles/standard/tests/src/Functional/StandardTest.php index 54b3861ee4b..15aedda84b8 100644 --- a/core/profiles/standard/tests/src/Functional/StandardTest.php +++ b/core/profiles/standard/tests/src/Functional/StandardTest.php @@ -87,7 +87,8 @@ class StandardTest extends BrowserTestBase { // Add a comment. $this->drupalLogin($this->adminUser); $this->drupalGet('node/1'); - $this->assertRaw('Then she picked out two somebodies,
Sally and me', 'Found a line break.'); + // Verify that a line break is present. + $this->assertRaw('Then she picked out two somebodies,
Sally and me'); $this->drupalPostForm(NULL, [ 'subject[0][value]' => 'Barfoo', 'comment_body[0][value]' => 'Then she picked out two somebodies, Sally and me', diff --git a/core/tests/Drupal/FunctionalTests/AssertLegacyTrait.php b/core/tests/Drupal/FunctionalTests/AssertLegacyTrait.php index 322fd30a1e0..479113323fa 100644 --- a/core/tests/Drupal/FunctionalTests/AssertLegacyTrait.php +++ b/core/tests/Drupal/FunctionalTests/AssertLegacyTrait.php @@ -364,6 +364,9 @@ trait AssertLegacyTrait { */ protected function assertRaw($raw) { @trigger_error('AssertLegacyTrait::assertRaw() is deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use $this->assertSession()->responseContains() instead. See https://www.drupal.org/node/3129738', E_USER_DEPRECATED); + if (func_num_args() > 1) { + @trigger_error('Calling AssertLegacyTrait::assertRaw() with more that one argument is deprecated in drupal:8.2.0 and the method is removed from drupal:10.0.0. Use $this->assertSession()->responseContains() instead. See https://www.drupal.org/node/3129738', E_USER_DEPRECATED); + } $this->assertSession()->responseContains($raw); } @@ -382,6 +385,9 @@ trait AssertLegacyTrait { */ protected function assertNoRaw($raw) { @trigger_error('AssertLegacyTrait::assertNoRaw() is deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use $this->assertSession()->responseNotContains() instead. See https://www.drupal.org/node/3129738', E_USER_DEPRECATED); + if (func_num_args() > 1) { + @trigger_error('Calling AssertLegacyTrait::assertNoRaw() with more that one argument is deprecated in drupal:8.2.0 and the method is removed from drupal:10.0.0. Use $this->assertSession()->responseContains() instead. See https://www.drupal.org/node/3129738', E_USER_DEPRECATED); + } $this->assertSession()->responseNotContains($raw); } diff --git a/core/tests/Drupal/FunctionalTests/Installer/SiteNameTest.php b/core/tests/Drupal/FunctionalTests/Installer/SiteNameTest.php index 44087f2004e..48cafa3d99c 100644 --- a/core/tests/Drupal/FunctionalTests/Installer/SiteNameTest.php +++ b/core/tests/Drupal/FunctionalTests/Installer/SiteNameTest.php @@ -38,7 +38,7 @@ class SiteNameTest extends BrowserTestBase { */ public function testSiteName() { $this->drupalGet(''); - $this->assertRaw($this->siteName, 'The site name that was set during the installation appears on the front page after installation.'); + $this->assertRaw($this->siteName); } } diff --git a/core/tests/Drupal/Tests/Core/Assert/AssertLegacyTraitTest.php b/core/tests/Drupal/Tests/Core/Assert/AssertLegacyTraitTest.php index 611eec976e1..ec29f50deb4 100644 --- a/core/tests/Drupal/Tests/Core/Assert/AssertLegacyTraitTest.php +++ b/core/tests/Drupal/Tests/Core/Assert/AssertLegacyTraitTest.php @@ -54,6 +54,24 @@ class AssertLegacyTraitTest extends UnitTestCase { $this->webAssert = $this->prophesize(WebAssert::class); } + /** + * @covers ::assertRaw + * @expectedDeprecation Calling AssertLegacyTrait::assertRaw() with more that one argument is deprecated in drupal:8.2.0 and the method is removed from drupal:10.0.0. Use $this->assertSession()->responseContains() instead. See https://www.drupal.org/node/3129738 + */ + public function testAssertRaw() { + $this->page->getText()->willReturn('foo bar bar'); + $this->assertRaw('foo', '\'foo\' should be present.'); + } + + /** + * @covers ::assertNoRaw + * @expectedDeprecation Calling AssertLegacyTrait::assertNoRaw() with more that one argument is deprecated in drupal:8.2.0 and the method is removed from drupal:10.0.0. Use $this->assertSession()->responseContains() instead. See https://www.drupal.org/node/3129738 + */ + public function testAssertNoRaw() { + $this->page->getText()->willReturn('foo bar bar'); + $this->assertNoRaw('qux', '\'qux\' should not be present.'); + } + /** * @covers ::assertUniqueText * @expectedDeprecation AssertLegacyTrait::assertUniqueText() is deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use $this->getSession()->pageTextContainsOnce() or $this->getSession()->pageTextMatchesCount() instead. See https://www.drupal.org/node/3129738