Posted by Dave Reid on April 21, 2009 at 2:05pm
6 followers
| Project: | Drupal core |
| Version: | 7.x-dev |
| Component: | forum.module |
| Category: | task |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs work |
| Issue tags: | Needs tests |
Issue Summary
From #299176: Replace db_rewrite_sql() with hook_query_alter(). it was found that we need some tests for the forum module blocks. Anyone want to take a stab at this?
Comments
#1
Moving this out of the critical bugs queue - see #607038: Meta issue: fix gaps in code coverage.
#2
Taking a stab... patch forthcoming...
#3
Here's my stab.
#4
The last submitted patch, 440344_forum_block_tests.patch, failed testing.
#5
Huh? It passed on my computer. I just tried it again. What's going on?
#6
#3: 440344_forum_block_tests.patch queued for re-testing.
#7
The last submitted patch, 440344_forum_block_tests.patch, failed testing.
#8
Re-roll, a few doc changes and node_load_multiple($result->fetchCol()) to simplify some DBTNG code.
#9
The last submitted patch, 440344_forum_block_tests2.patch, failed testing.
#10
Ah, yeah, the usual :)
Test bot doesn't have clean url's enabled and isn't installed in example.org/ (but example.org/something), so you can't do something like assertRaw() on 'href="/node/5"'.
Here's a re-roll which uses xpath. Note that I did not review if the tests are correct, I just re-rolled and fixed the fails.
#11
Aha! Thanks! That was driving me crazy. I had pretty much given up.
#12
+++ modules/forum/forum.test
@@ -72,7 +79,8 @@ class ForumTestCase extends DrupalWebTestCase {
// 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>');
+ $this->post_count += 4;
+ $this->assertRaw('<td class="posts">'. $this->post_count .'</td>');
// Test loading multiple forum nodes on the front page.
$this->drupalLogin($this->drupalCreateUser(array('administer content types', 'create forum content')));
This chunk isn't working (patching failed).
+++ modules/forum/forum.test@@ -367,9 +450,41 @@ class ForumTestCase extends DrupalWebTestCase {
+ $s = $newest_topic['comment_count'] > 1 ? 's' : '';
$s should be renamed as $plural and use core function format_plural().
$plural = format_plural($newest_topic['comment_count'], '', 's');
+++ modules/forum/forum.test@@ -367,9 +450,41 @@ class ForumTestCase extends DrupalWebTestCase {
+ $s = $newest_topic['comment_count'] > 1 ? 's' : '';
+ $title = $title_xpath = '';
+ if ($newest_topic['comment_count']) {
+ $title = $newest_topic['comment_count'] . ' comment' . $s;
+ $title_xpath = ' and @title=:title';
+ }
The statement for the plural form should be inside the if statement otherwise you could have warning generated.
The rest of the patch is okay.
Powered by Dreditor.
#13