Download & Extend

Tests needed for forum blocks

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

Priority:critical» normal

Moving this out of the critical bugs queue - see #607038: Meta issue: fix gaps in code coverage.

#2

Taking a stab... patch forthcoming...

#3

Status:active» needs review

Here's my stab.

AttachmentSizeStatusTest resultOperations
440344_forum_block_tests.patch7.75 KBIdleFAILED: [[SimpleTest]]: [MySQL] 20,793 pass(es), 16 fail(s), and 0 exception(es).View details | Re-test

#4

Status:needs review» needs work

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

Status:needs work» needs review

#3: 440344_forum_block_tests.patch queued for re-testing.

#7

Status:needs review» needs work

The last submitted patch, 440344_forum_block_tests.patch, failed testing.

#8

Status:needs work» needs review

Re-roll, a few doc changes and node_load_multiple($result->fetchCol()) to simplify some DBTNG code.

AttachmentSizeStatusTest resultOperations
440344_forum_block_tests2.patch7.51 KBIdleFAILED: [[SimpleTest]]: [MySQL] 22,541 pass(es), 8 fail(s), and 0 exception(es).View details | Re-test

#9

Status:needs review» needs work

The last submitted patch, 440344_forum_block_tests2.patch, failed testing.

#10

Status:needs work» needs review

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.

AttachmentSizeStatusTest resultOperations
440344_forum_block_tests3.patch7.87 KBIdlePASSED: [[SimpleTest]]: [MySQL] 22,471 pass(es).View details | Re-test

#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

Status:needs review» needs work
nobody click here