diff --git a/core/modules/comment/src/Tests/CommentStatisticsTest.php b/core/modules/comment/src/Tests/CommentStatisticsTest.php index 9e45fd3..695b6d0 100644 --- a/core/modules/comment/src/Tests/CommentStatisticsTest.php +++ b/core/modules/comment/src/Tests/CommentStatisticsTest.php @@ -119,8 +119,8 @@ function testCommentNodeCommentStatistics() { $this->assertEqual($node->get('comment')->comment_count, 2, 'The value of node comment_count is 2.'); // Post a second node plus a comment - $node2 = $this->drupalCreateNode(array('type' => 'article', 'promote' => 1, 'uid' => $this->web_user->id())); - $anonymous_comment = $this->postComment($this->node, $this->randomMachineName(), '', TRUE); + $node2 = $this->drupalCreateNode(array('type' => 'article', 'promote' => 1, 'uid' => $this->webUser->id())); + $this->postComment($this->node, $this->randomMachineName(), '', TRUE); // Delete statistics for the first node, without touching the comments. // (Usually this is not done directly and statistics are maintained by @@ -129,12 +129,8 @@ function testCommentNodeCommentStatistics() { $this->container->get('comment.statistics')->deleteMultiple('node', array($this->node->id()), array('comment')); // Checks whether only one statistics record is left. - $result = $this->container->get('comment.statistics')->read('node', array($this->node, $node2)); - $count = 0; - foreach ($result as $row) { - $count++; - } - $this->assertEqual($count, 1, 'After deleting statistics for one node, only 1 statistics row is left.'); + $result = $this->container->get('comment.statistics')->read('node', array($this->node->id() => $this->node, $node2->id() => $node2)); + $this->assertEqual(iterator_count($result), 1, 'After deleting statistics for one node, only 1 statistics row is left.'); } }