diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentTokenReplaceTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentTokenReplaceTest.php index 451831a..ace7da7 100644 --- a/core/modules/comment/lib/Drupal/comment/Tests/CommentTokenReplaceTest.php +++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentTokenReplaceTest.php @@ -49,7 +49,6 @@ function testCommentTokenReplacement() { // Add HTML to ensure that sanitation of some fields tested directly. $comment->subject->value = 'Blinking Comment'; - $instance = field_info_instance('comment', 'body', 'comment_body'); // Generate and test sanitized tokens. $tests = array(); @@ -95,6 +94,8 @@ 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()); @@ -110,4 +111,5 @@ function testCommentTokenReplacement() { $this->assertEqual($output, $expected, format_string('Node comment token %token replaced.', array('%token' => $input))); } } + } diff --git a/core/modules/forum/tests/Drupal/forum/Tests/ForumManagerTest.php b/core/modules/forum/tests/Drupal/forum/Tests/ForumManagerTest.php index 96675fb..0f3ad70 100644 --- a/core/modules/forum/tests/Drupal/forum/Tests/ForumManagerTest.php +++ b/core/modules/forum/tests/Drupal/forum/Tests/ForumManagerTest.php @@ -9,6 +9,11 @@ use Drupal\Tests\UnitTestCase; +// @todo Remove once the constants are replaced with constants on classes. +if (!defined('COMMENT_OPEN')) { + define('COMMENT_OPEN', 2); +} + /** * Tests the ForumManager. * @@ -75,12 +80,17 @@ public function testGetIndex() { ->disableOriginalConstructor() ->getMock(); + $comment_manager = $this->getMockBuilder('\Drupal\comment\CommentManager') + ->disableOriginalConstructor() + ->getMock(); + $manager = $this->getMock('\Drupal\forum\ForumManager', array('getChildren'), array( $config_factory, $entity_manager, $connection, $field_info, $translation_manager, + $comment_manager, )); $manager->expects($this->once())