diff options
author | Dries Buytaert <dries@buytaert.net> | 2010-01-24 15:21:06 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2010-01-24 15:21:06 +0000 |
commit | 3fbe8b721b6ecb9e5700f6d6e9146781c1795064 (patch) | |
tree | 4a8f82bc449c9dc12e70e6fdb9f553bc9a2ef9e9 /modules/comment | |
parent | 8641f9dcfd779556a5eb125921053387b0fe5580 (diff) | |
download | brdo-3fbe8b721b6ecb9e5700f6d6e9146781c1795064.tar.gz brdo-3fbe8b721b6ecb9e5700f6d6e9146781c1795064.tar.bz2 |
- Patch #564642 by Scott Reynolds: added tests for node_rebuild() and comment_rebuild().
Diffstat (limited to 'modules/comment')
-rw-r--r-- | modules/comment/comment.test | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/modules/comment/comment.test b/modules/comment/comment.test index 647f9d893..9b1192e17 100644 --- a/modules/comment/comment.test +++ b/modules/comment/comment.test @@ -1190,3 +1190,42 @@ class CommentRdfaTestCase extends CommentHelperCase { $this->assertEqual((string)$comment_author[0], $name); } } + +/** + * Test to make sure comment content is rebuilt. + */ +class CommentContentRebuild extends CommentHelperCase { + public static function getInfo() { + return array( + 'name' => 'Comment Rebuild', + 'description' => 'Test to make sure the comment content is rebuilt.', + 'group' => 'Comment', + ); + } + + /** + * Test to ensure that the comment's content array is rebuilt for every call to comment_build(). + */ + function testCommentRebuild() { + // Update the comment settings so preview isn't required. + $this->drupalLogin($this->admin_user); + $this->setCommentSubject(TRUE); + $this->setCommentPreview(DRUPAL_OPTIONAL); + $this->drupalLogout(); + + // Log in as the web user and add the comment. + $this->drupalLogin($this->web_user); + $subject_text = $this->randomName(); + $comment_text = $this->randomName(); + $comment = $this->postComment($this->node, $comment_text, $subject_text, TRUE); + $comment_loaded = comment_load($comment->id); + $this->assertTrue($this->commentExists($comment), t('Comment found.')); + + // Add the property to the content array and then see if it still exists on build. + $comment_loaded->content['test_property'] = array('#value' => $this->randomString()); + $built_content = comment_build($comment_loaded, $this->node); + + // This means that the content was rebuilt as the added test property no longer exists. + $this->assertFalse(isset($built_content['test_property']), t('Comment content was emptied before being built.')); + } +}
\ No newline at end of file |