diff -u b/core/modules/forum/tests/src/Functional/ForumTest.php b/core/modules/forum/tests/src/Functional/ForumTest.php --- b/core/modules/forum/tests/src/Functional/ForumTest.php +++ b/core/modules/forum/tests/src/Functional/ForumTest.php @@ -137,7 +137,7 @@ // 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($this->t('General discussion'), 'forum.page', ['taxonomy_term' => 1])->toString(), "Found the default forum at the /forum listing"); // Check the presence of expected cache tags. $this->assertSession()->responseHeaderContains('X-Drupal-Cache-Tags', 'config:forum.settings'); @@ -173,7 +173,7 @@ $this->drupalLogin($this->webUser); // Verify that this user is shown a message that they may not post content. $this->drupalGet('forum/' . $this->forum['tid']); - $this->assertText(t('You are not allowed to post new content in the forum'), "Authenticated user without permission to post forum content is shown message in local tasks to that effect."); + $this->assertText($this->t('You are not allowed to post new content in the forum'), "Authenticated user without permission to post forum content is shown message in local tasks to that effect."); // Log in, and do basic tests for a user with permission to edit any forum // content. @@ -191,9 +191,9 @@ // Verify that this user is shown a local task to add new forum content. $this->drupalGet('forum'); - $this->assertSession()->linkExists(t('Add new Forum topic')); + $this->assertSession()->linkExists($this->t('Add new Forum topic')); $this->drupalGet('forum/' . $this->forum['tid']); - $this->assertSession()->linkExists(t('Add new Forum topic')); + $this->assertSession()->linkExists($this->t('Add new Forum topic')); // Log in a user with permission to edit any forum content. $this->drupalLogin($this->editAnyTopicsUser); @@ -231,7 +231,7 @@ 'create forum content', 'post comments', ])); - $this->drupalPostForm('admin/structure/types/manage/forum', ['options[promote]' => 'promote'], t('Save content type')); + $this->drupalPostForm('admin/structure/types/manage/forum', ['options[promote]' => 'promote'], $this->t('Save content type')); $this->createForumTopic($this->forum, FALSE); $this->createForumTopic($this->forum, FALSE); $this->drupalGet('node'); @@ -240,13 +240,13 @@ $node = $this->createForumTopic($this->forum, FALSE); $edit = []; $edit['comment_body[0][value]'] = $this->randomMachineName(); - $this->drupalPostForm('node/' . $node->id(), $edit, t('Save')); + $this->drupalPostForm('node/' . $node->id(), $edit, $this->t('Save')); $this->assertSession()->statusCodeEquals(200); // Test editing a forum topic that has a comment. $this->drupalLogin($this->editAnyTopicsUser); $this->drupalGet('forum/' . $this->forum['tid']); - $this->drupalPostForm('node/' . $node->id() . '/edit', [], t('Save')); + $this->drupalPostForm('node/' . $node->id() . '/edit', [], $this->t('Save')); $this->assertSession()->statusCodeEquals(200); // Test the root forum page title change. @@ -262,7 +262,7 @@ // Test anonymous action link. $this->drupalLogout(); $this->drupalGet('forum/' . $this->forum['tid']); - $this->assertSession()->linkExists(t('Log in to post new content in the forum.')); + $this->assertSession()->linkExists($this->t('Log in to post new content in the forum.')); } /** @@ -286,7 +286,7 @@ $edit['title[0][value]'] = $this->randomMachineName(10); $edit['body[0][value]'] = $this->randomMachineName(120); $this->drupalLogin($this->adminUser); - $this->drupalPostForm('node/add/forum', $edit, t('Save')); + $this->drupalPostForm('node/add/forum', $edit, $this->t('Save')); $nid_count = $this->container->get('entity_type.manager') ->getStorage('node') @@ -312,7 +312,7 @@ // Add forum to the Tools menu. $edit = []; - $this->drupalPostForm('admin/structure/menu/manage/tools', $edit, t('Save')); + $this->drupalPostForm('admin/structure/menu/manage/tools', $edit, $this->t('Save')); $this->assertSession()->statusCodeEquals(200); // Edit forum taxonomy. @@ -323,7 +323,7 @@ // Verify "edit container" link exists and functions correctly. $this->drupalGet('admin/structure/forum'); // Verify help text is shown. - $this->assertText(t('Forums contain forum topics. Use containers to group related forums')); + $this->assertText($this->t('Forums contain forum topics. Use containers to group related forums')); // Verify action links are there. $this->assertSession()->linkExists('Add forum'); $this->assertSession()->linkExists('Add container'); @@ -340,8 +340,8 @@ // Create second forum in container, destined to be deleted below. $delete_forum = $this->createForum('forum', $this->forumContainer['tid']); // Save forum overview. - $this->drupalPostForm('admin/structure/forum/', [], t('Save')); - $this->assertRaw(t('The configuration options have been saved.')); + $this->drupalPostForm('admin/structure/forum/', [], $this->t('Save')); + $this->assertRaw($this->t('The configuration options have been saved.')); // Delete this second forum. $this->deleteForum($delete_forum['tid']); // Create forum at the top (root) level. @@ -371,7 +371,7 @@ // Test tags vocabulary form is not affected. $this->drupalGet('admin/structure/taxonomy/manage/tags'); $this->assertSession()->buttonExists('Save'); - $this->assertSession()->linkExists(t('Delete')); + $this->assertSession()->linkExists($this->t('Delete')); // Test tags vocabulary term form is not affected. $this->drupalGet('admin/structure/taxonomy/manage/tags/add'); $this->assertSession()->fieldExists('parent[]'); @@ -395,9 +395,9 @@ ]; // Edit the vocabulary. - $this->drupalPostForm('admin/structure/taxonomy/manage/' . $original_vocabulary->id(), $edit, t('Save')); + $this->drupalPostForm('admin/structure/taxonomy/manage/' . $original_vocabulary->id(), $edit, $this->t('Save')); $this->assertSession()->statusCodeEquals(200); - $this->assertRaw(t('Updated vocabulary %name.', ['%name' => $edit['name']]), 'Vocabulary was edited'); + $this->assertRaw($this->t('Updated vocabulary %name.', ['%name' => $edit['name']]), 'Vocabulary was edited'); // Grab the newly edited vocabulary. $current_vocabulary = Vocabulary::load($vid); @@ -439,13 +439,13 @@ ]; // Create forum. - $this->drupalPostForm('admin/structure/forum/add/' . $type, $edit, t('Save')); + $this->drupalPostForm('admin/structure/forum/add/' . $type, $edit, $this->t('Save')); $this->assertSession()->statusCodeEquals(200); $type = ($type == 'container') ? 'forum container' : 'forum'; $this->assertText( t( 'Created new @type @term.', - ['@term' => $name, '@type' => t($type)] + ['@term' => $name, '@type' => $this->t($type)] ), new FormattableMarkup('@type was created', ['@type' => ucfirst($type)]) ); @@ -489,11 +489,11 @@ public function deleteForum($tid) { // Delete the forum. $this->drupalGet('admin/structure/forum/edit/forum/' . $tid); - $this->clickLink(t('Delete')); + $this->clickLink($this->t('Delete')); $this->assertText('Are you sure you want to delete the forum'); $this->assertNoText('Add forum'); $this->assertNoText('Add forum container'); - $this->drupalPostForm(NULL, [], t('Delete')); + $this->drupalPostForm(NULL, [], $this->t('Delete')); // Assert that the forum no longer exists. $this->drupalGet('forum/' . $tid); @@ -538,7 +538,7 @@ $edit = []; $edit['subject[0][value]'] = $this->randomMachineName(); $edit['comment_body[0][value]'] = $this->randomMachineName(); - $this->drupalPostForm('node/' . $node->id(), $edit, t('Save')); + $this->drupalPostForm('node/' . $node->id(), $edit, $this->t('Save')); $this->assertSession()->statusCodeEquals(200); // Test replying to a comment. @@ -579,17 +579,17 @@ $tid = $forum['tid']; // Create the forum topic, preselecting the forum ID via a URL parameter. - $this->drupalPostForm('node/add/forum', $edit, t('Save'), ['query' => ['forum_id' => $tid]]); + $this->drupalPostForm('node/add/forum', $edit, $this->t('Save'), ['query' => ['forum_id' => $tid]]); - $type = t('Forum topic'); + $type = $this->t('Forum topic'); if ($container) { - $this->assertNoText(t('@type @title has been created.', ['@type' => $type, '@title' => $title]), '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->assertNoText($this->t('@type @title has been created.', ['@type' => $type, '@title' => $title]), 'Forum topic was not created'); + $this->assertRaw($this->t('The item %title is a forum container, not a forum.', ['%title' => $forum['name']]), 'Error message was shown'); 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->assertText($this->t('@type @title has been created.', ['@type' => $type, '@title' => $title]), 'Forum topic was created'); + $this->assertNoRaw($this->t('The item %title is a forum container, not a forum.', ['%title' => $forum['name']]), 'No error message was shown'); // Verify that the creation message contains a link to a term. $view_link = $this->xpath('//div[@class="messages"]//a[contains(@href, :href)]', [':href' => 'term/']); @@ -627,7 +627,7 @@ $this->assertSession()->statusCodeEquals($response2); if ($response2 == 200) { $this->assertSession()->titleEquals('Forum | Drupal'); - $this->assertText(t('Forum'), 'Forum help node was displayed'); + $this->assertText($this->t('Forum'), 'Forum help node was displayed'); } // View forum container page. @@ -668,8 +668,8 @@ // Assume the topic is initially associated with $forum. $edit['taxonomy_forums'] = $this->rootForum['tid']; $edit['shadow'] = TRUE; - $this->drupalPostForm('node/' . $node->id() . '/edit', $edit, t('Save')); - $this->assertText(t('Forum topic @title has been updated.', ['@title' => $edit['title[0][value]']]), 'Forum node was edited'); + $this->drupalPostForm('node/' . $node->id() . '/edit', $edit, $this->t('Save')); + $this->assertText($this->t('Forum topic @title has been updated.', ['@title' => $edit['title[0][value]']]), 'Forum node was edited'); // Verify topic was moved to a different forum. $forum_tid = $this->container @@ -683,9 +683,9 @@ $this->assertTrue($forum_tid == $this->rootForum['tid'], 'The forum topic is linked to a different forum'); // Delete forum node. - $this->drupalPostForm('node/' . $node->id() . '/delete', [], t('Delete')); + $this->drupalPostForm('node/' . $node->id() . '/delete', [], $this->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($this->t('Forum topic %title has been deleted.', ['%title' => $edit['title[0][value]']]), 'Forum node was deleted'); } } diff -u b/core/modules/forum/tests/src/Functional/ForumUninstallTest.php b/core/modules/forum/tests/src/Functional/ForumUninstallTest.php --- b/core/modules/forum/tests/src/Functional/ForumUninstallTest.php +++ b/core/modules/forum/tests/src/Functional/ForumUninstallTest.php @@ -83,7 +83,7 @@ $this->assertText('To uninstall Forum, first delete all Forum content'); // Delete the node. - $this->drupalPostForm('node/' . $node->id() . '/delete', [], t('Delete')); + $this->drupalPostForm('node/' . $node->id() . '/delete', [], $this->t('Delete')); // Attempt to uninstall forum. $this->drupalGet('admin/modules/uninstall'); @@ -99,7 +99,7 @@ // Ensure that the forum node type can not be deleted. $this->drupalGet('admin/structure/types/manage/forum'); - $this->assertSession()->linkNotExists(t('Delete')); + $this->assertSession()->linkNotExists($this->t('Delete')); // Now attempt to uninstall forum. $this->drupalGet('admin/modules/uninstall'); @@ -107,8 +107,8 @@ $this->assertFieldByName('uninstall[forum]'); $this->drupalPostForm('admin/modules/uninstall', [ 'uninstall[forum]' => 1, - ], t('Uninstall')); - $this->drupalPostForm(NULL, [], t('Uninstall')); + ], $this->t('Uninstall')); + $this->drupalPostForm(NULL, [], $this->t('Uninstall')); // Check that the field is now deleted. $field_storage = FieldStorageConfig::loadByName('node', 'taxonomy_forums'); @@ -121,11 +121,11 @@ 'title_label' => 'title for forum', 'type' => 'forum', ]; - $this->drupalPostForm('admin/structure/types/add', $edit, t('Save content type')); + $this->drupalPostForm('admin/structure/types/add', $edit, $this->t('Save content type')); $this->assertTrue((bool) NodeType::load('forum'), 'Node type with machine forum created.'); $this->drupalGet('admin/structure/types/manage/forum'); - $this->clickLink(t('Delete')); - $this->drupalPostForm(NULL, [], t('Delete')); + $this->clickLink($this->t('Delete')); + $this->drupalPostForm(NULL, [], $this->t('Delete')); $this->assertSession()->statusCodeEquals(200); $this->assertFalse((bool) NodeType::load('forum'), 'Node type with machine forum deleted.'); only in patch2: unchanged: --- a/core/modules/forum/tests/src/Functional/ForumBlockTest.php +++ b/core/modules/forum/tests/src/Functional/ForumBlockTest.php @@ -58,7 +58,7 @@ public function testNewForumTopicsBlock() { // Create 5 forum topics. $topics = $this->createForumTopics(); - $this->assertSession()->linkExists(t('More'), 0, 'New forum topics block has a "more"-link.'); + $this->assertSession()->linkExists($this->t('More'), 0, 'New forum topics block has a "more"-link.'); $this->assertLinkByHref('forum', 0, 'New forum topics block has a "more"-link.'); // We expect all 5 forum topics to appear in the "New forum topics" block. @@ -113,7 +113,7 @@ public function testActiveForumTopicsBlock() { // Enable the block. $block = $this->drupalPlaceBlock('forum_active_block'); $this->drupalGet(''); - $this->assertSession()->linkExists(t('More'), 0, 'Active forum topics block has a "more"-link.'); + $this->assertSession()->linkExists($this->t('More'), 0, 'Active forum topics block has a "more"-link.'); $this->assertLinkByHref('forum', 0, 'Active forum topics block has a "more"-link.'); // We expect the first 5 forum topics to appear in the "Active forum topics" @@ -175,7 +175,7 @@ protected function createForumTopics($count = 5) { ]; // Create the forum topic, preselecting the forum ID via a URL parameter. - $this->drupalPostForm('node/add/forum', $edit, t('Save'), ['query' => ['forum_id' => 1]]); + $this->drupalPostForm('node/add/forum', $edit, $this->t('Save'), ['query' => ['forum_id' => 1]]); $topics[] = $title; } only in patch2: unchanged: --- a/core/modules/forum/tests/src/Functional/ForumIndexTest.php +++ b/core/modules/forum/tests/src/Functional/ForumIndexTest.php @@ -53,9 +53,9 @@ public function testForumIndexStatus() { // Create the forum topic, preselecting the forum ID via a URL parameter. $this->drupalGet("forum/$tid"); - $this->clickLink(t('Add new @node_type', ['@node_type' => 'Forum topic'])); + $this->clickLink($this->t('Add new @node_type', ['@node_type' => 'Forum topic'])); $this->assertUrl("node/add/forum?forum_id=$tid"); - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, $this->t('Save')); // Check that the node exists in the database. $node = $this->drupalGetNodeByTitle($title); @@ -67,8 +67,8 @@ public function testForumIndexStatus() { 'description[0][value]' => $this->randomMachineName(200), 'parent[0]' => $tid, ]; - $this->drupalPostForm('admin/structure/forum/add/forum', $edit, t('Save')); - $this->assertSession()->linkExists(t('edit forum')); + $this->drupalPostForm('admin/structure/forum/add/forum', $edit, $this->t('Save')); + $this->assertSession()->linkExists($this->t('edit forum')); $tid_child = $tid + 1; @@ -84,9 +84,9 @@ public function testForumIndexStatus() { // Unpublish the node. $edit = ['status[value]' => FALSE]; - $this->drupalPostForm('node/' . $node->id() . '/edit', $edit, t('Save')); + $this->drupalPostForm('node/' . $node->id() . '/edit', $edit, $this->t('Save')); $this->drupalGet('node/' . $node->id()); - $this->assertText(t('Access denied'), 'Unpublished node is no longer accessible.'); + $this->assertText($this->t('Access denied'), 'Unpublished node is no longer accessible.'); // Verify that the node no longer appears on the index. $this->drupalGet('forum/' . $tid); only in patch2: unchanged: --- a/core/modules/forum/tests/src/Functional/ForumNodeAccessTest.php +++ b/core/modules/forum/tests/src/Functional/ForumNodeAccessTest.php @@ -65,7 +65,7 @@ public function testForumNodeAccess() { 'body[0][value]' => $this->randomMachineName(200), 'private[0][value]' => TRUE, ]; - $this->drupalPostForm('node/add/forum', $edit, t('Save'), ['query' => ['forum_id' => 1]]); + $this->drupalPostForm('node/add/forum', $edit, $this->t('Save'), ['query' => ['forum_id' => 1]]); $private_node = $this->drupalGetNodeByTitle($private_node_title); $this->assertTrue(!empty($private_node), 'New private forum node found in database.'); @@ -75,7 +75,7 @@ public function testForumNodeAccess() { 'title[0][value]' => $public_node_title, 'body[0][value]' => $this->randomMachineName(200), ]; - $this->drupalPostForm('node/add/forum', $edit, t('Save'), ['query' => ['forum_id' => 1]]); + $this->drupalPostForm('node/add/forum', $edit, $this->t('Save'), ['query' => ['forum_id' => 1]]); $public_node = $this->drupalGetNodeByTitle($public_node_title); $this->assertTrue(!empty($public_node), 'New public forum node found in database.');