diff --git a/core/modules/comment/comment.module b/core/modules/comment/comment.module index 3954119f2bb7ebc8323f9ffc643dd437bf975906..664acf3674220390b7ee2374e05b80defafd1940 100644 --- a/core/modules/comment/comment.module +++ b/core/modules/comment/comment.module @@ -1911,6 +1911,7 @@ function comment_preview($comment) { $comment->name = check_plain($account->name); $comment->signature = $account->signature; $comment->signature_format = $account->signature_format; + $comment->picture = $account->picture; } elseif (empty($comment->name)) { $comment->name = variable_get('anonymous', t('Anonymous')); diff --git a/core/modules/comment/comment.test b/core/modules/comment/comment.test index 7b2499a3eb1af4a7dc0bcc0f8c2fe6914e446ee1..b4a41e066cf8a4e5b37447f4e5559b8e92ab4880 100644 --- a/core/modules/comment/comment.test +++ b/core/modules/comment/comment.test @@ -975,15 +975,18 @@ class CommentPreviewTest extends CommentHelperCase { $this->setCommentSettings('comment_default_mode', COMMENT_MODE_THREADED, t('Comment paging changed.')); $this->drupalLogout(); - // Login as web user and add a signature. + // Login as web user and add a signature and a user picture. $this->drupalLogin($this->web_user); variable_set('user_signatures', 1); + variable_set('user_pictures', 1); $test_signature = $this->randomName(); $edit['signature[value]'] = '<a href="http://example.com/">' . $test_signature. '</a>'; $edit['signature[format]'] = 'filtered_html'; + $image = current($this->drupalGetTestFiles('image')); + $edit['files[picture_upload]'] = drupal_realpath($image->uri); $this->drupalPost('user/' . $this->web_user->uid . '/edit', $edit, t('Save')); - // Fill in the comment form and preview the comment. + // As the web user, fill in the comment form and preview the comment. $edit = array(); $edit['subject'] = $this->randomName(8); $edit['comment_body[' . $langcode . '][0][value]'] = $this->randomName(16); @@ -1000,6 +1003,9 @@ class CommentPreviewTest extends CommentHelperCase { // Check that the signature is displaying with the correct text format. $this->assertLink($test_signature); + + // Check that the user picture is displayed. + $this->assertFieldByXPath("//div[contains(@class, 'comment-preview')]//div[contains(@class, 'user-picture')]//img", NULL, 'User picture displayed.'); } /**