Index: modules/filter/filter.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/filter/filter.test,v
retrieving revision 1.19
diff -u -p -r1.19 filter.test
--- modules/filter/filter.test	25 Apr 2009 18:01:10 -0000	1.19
+++ modules/filter/filter.test	27 Apr 2009 23:53:46 -0000
@@ -178,6 +178,78 @@ class FilterAdminTestCase extends Drupal
   }
 }
 
+/**
+ * Test integration with other core modules.
+ */
+class FilterIntegrationTestCase extends DrupalWebTestCase {
+  protected $admin_user;
+
+  public static function getInfo() {
+    return array(
+      'name' => t('Filter integration'),
+      'description' => t('Verify text formats and filters used elsewhere.'),
+      'group' => t('Filter'),
+    );
+  }
+
+  function setUp() {
+    parent::setUp('comment', 'search');
+
+    $this->admin_user = $this->drupalCreateUser(array('administer filters', 'administer permissions', 'create page content', 'post comments without approval'));
+    $this->drupalLogin($this->admin_user);
+  }
+
+  /**
+   * Verify that comments are rendered using proper format in search results.
+   */
+  function testSearchResultsComment() {
+    $title = 'testSearchResultsComment';
+
+    // Enable comments for 'page' nodes.
+    variable_set('comment_page', COMMENT_NODE_OPEN);
+    variable_set('comment_preview_page', COMMENT_PREVIEW_OPTIONAL);
+    // Allow anonymous users to search content.
+    $edit = array(
+      '1[search content]' => 1,
+      // @todo Comments are added to search index without checking first whether
+      //   anonymous users are allowed to access comments.
+      '1[access comments]' => 1,
+      // @todo Without this permission, "Login or register to post comments" is
+      //   added to the search index.
+      '1[post comments]' => 1,
+    );
+    $this->drupalPost('admin/user/permissions', $edit, t('Save permissions'));
+
+    // Create a node.
+    $edit = array(
+      'title' => $this->randomName(),
+    );
+    $this->drupalPost('node/add/page', $edit, t('Save'));
+    // Check that the node exists in the database.
+    $node = $this->drupalGetNodeByTitle($edit['title']);
+    $this->assertTrue($node, t('Node found in database.'));
+    // Post a comment using 'Full HTML' text format.
+    $edit = array(
+      'comment' => '<h1>' . $title . '</h1>',
+      'comment_format' => 2,
+    );
+    $this->drupalPost('comment/reply/' . $node->nid, $edit, t('Save'));
+
+    // Invoke search index update.
+    $this->drupalLogout();
+    $this->drupalGet('cron.php', array('query' => array('cron_key' => variable_get('cron_key', 'drupal'))));
+
+    // Search for $title.
+    $edit = array(
+      'search_theme_form' => $title,
+    );
+    $this->drupalPost('', $edit, t('Search'));
+    $this->assertText($title, t('Node found in search results.'));
+    // Verify that comment is rendered using proper format.
+    $this->assertRaw('<h1>' . $title . '</h1>', t('Node found in search results.'));
+  }
+}
+
 class FilterTestCase extends DrupalWebTestCase {
   protected $format;
 
