diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentTokenReplaceTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentTokenReplaceTest.php index ace7da7..ba93373 100644 --- a/core/modules/comment/lib/Drupal/comment/Tests/CommentTokenReplaceTest.php +++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentTokenReplaceTest.php @@ -94,8 +94,6 @@ function testCommentTokenReplacement() { $this->assertEqual($output, $expected, format_string('Unsanitized comment token %token replaced.', array('%token' => $input))); } - // Login another user to properly calculate new comments. - $this->drupalLogin($this->web_user); // Load node so comment_count gets computed. $node = node_load($node->id()); @@ -105,6 +103,7 @@ function testCommentTokenReplacement() { $tests['[entity:comment-count-new]'] = 2; // Also test the deprecated legacy token. $tests['[node:comment-count]'] = 2; + $tests['[node:comment-count-new]'] = 2; foreach ($tests as $input => $expected) { $output = $token_service->replace($input, array('entity' => $node, 'node' => $node), array('langcode' => $language_interface->id)); diff --git a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php index 300430a..6ae02c8 100644 --- a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php +++ b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php @@ -639,6 +639,7 @@ protected function drupalLogin(AccountInterface $account) { $pass = $this->assert($this->drupalUserIsLoggedIn($account), format_string('User %name successfully logged in.', array('%name' => $account->getUsername())), 'User login'); if ($pass) { $this->loggedInUser = $account; + $this->container->set('current_user', $account); } }