diff --git modules/comment/comment.test modules/comment/comment.test index edb82b1..bf2e920 100644 --- modules/comment/comment.test +++ modules/comment/comment.test @@ -1232,3 +1232,30 @@ class CommentContentRebuild extends CommentHelperCase { $this->assertFalse(isset($built_content['test_property']), t('Comment content was emptied before being built.')); } } + +/** + * Ensure that hook_comment_load is actually called. + */ +class CommentCallHookLoad extends CommentHelperCase { + public static function getInfo() { + return array( + 'name' => 'Call hook_comment_load', + 'description' => 'Make sure that hook_comment_load is actually called.', + 'group' => 'Comment', + ); + } + + function setUp() { + // Enable dummy module that implements hook_node_view. + parent::setUp(); + module_enable(array('comment_hook_test')); + } + + function testHookCalled() { + $this->drupalLogin($this->admin_user); + parent::postComment($this->node, 'this is a comment'); + $this->drupalGet('node/' . $this->node->nid); + $this->assertText('hook_comment_load was called'); + $this->drupalLogout(); + } +} \ No newline at end of file diff --git modules/comment/tests/comment_hook_test.module modules/comment/tests/comment_hook_test.module index c9e9a02..5013fe7 100644 --- modules/comment/tests/comment_hook_test.module +++ modules/comment/tests/comment_hook_test.module @@ -11,6 +11,6 @@ */ function comment_hook_test_comment_load($comments) { foreach($comments as $comment) { - $comment->subject = 'the hook was called'; + $comment->subject = 'hook_comment_load was called'; } } diff --git modules/comment/tests/comment_hook_test.info modules/comment/tests/comment_hook_test.info new file mode 100644 index 0000000..4048e5d --- /dev/null +++ modules/comment/tests/comment_hook_test.info @@ -0,0 +1,8 @@ +; $Id: node_test.info,v 1.1 2009/04/02 20:47:54 dries Exp $ +name = "Comment hook test" +description = "Test whether a hook is called on a comment." +package = Testing +version = VERSION +core = 7.x +files[] = comment_hook_test.module +hidden = TRUE \ No newline at end of file diff --git modules/comment/tests/comment_hook_test.module modules/comment/tests/comment_hook_test.module new file mode 100644 index 0000000..c9e9a02 --- /dev/null +++ modules/comment/tests/comment_hook_test.module @@ -0,0 +1,16 @@ +subject = 'the hook was called'; + } +}