Commit f8c8827b authored by Dries's avatar Dries

- Patch #554164 by mfb: fixed bug with forum topic counts and added tests.

parent 0e788816
...@@ -623,7 +623,7 @@ function forum_get_forums($tid = 0) { ...@@ -623,7 +623,7 @@ function forum_get_forums($tid = 0) {
if (count($_forums)) { if (count($_forums)) {
$query = db_select('node', 'n'); $query = db_select('node', 'n');
$query->join('node_comment_statistics', 'ncs', 'n.nid = ncs.nid'); $query->join('node_comment_statistics', 'ncs', 'n.nid = ncs.nid');
$query->join('forum', 'f', 'f.vid = f.vid'); $query->join('forum', 'f', 'n.vid = f.vid');
$query->addExpression('COUNT(n.nid)', 'topic_count'); $query->addExpression('COUNT(n.nid)', 'topic_count');
$query->addExpression('SUM(ncs.comment_count)', 'comment_count'); $query->addExpression('SUM(ncs.comment_count)', 'comment_count');
$counts = $query $counts = $query
......
...@@ -63,6 +63,11 @@ class ForumTestCase extends DrupalWebTestCase { ...@@ -63,6 +63,11 @@ class ForumTestCase extends DrupalWebTestCase {
$this->drupalLogin($this->any_user); $this->drupalLogin($this->any_user);
// Verify the any forum user has access to all the forum nodes. // Verify the any forum user has access to all the forum nodes.
$this->verifyForums($this->own_user, $node, TRUE); $this->verifyForums($this->own_user, $node, TRUE);
// Verify the topic and post counts on the forum page.
$this->drupalGet('forum');
$this->assertRaw("<td class=\"topics\">\n 6 </td>");
$this->assertRaw('<td class="posts">6</td>');
} }
/** /**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment