diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentPreviewTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentPreviewTest.php index 0839068..8260828 100644 --- a/core/modules/comment/lib/Drupal/comment/Tests/CommentPreviewTest.php +++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentPreviewTest.php @@ -102,7 +102,7 @@ function testCommentPreview() { * Tests comment edit, preview, and save. */ function testCommentEditPreviewSave() { - $web_user = $this->drupalCreateUser(array('access comments', 'post comments', 'skip comment approval')); + $web_user = $this->drupalCreateUser(array('access comments', 'post comments', 'skip comment approval', 'edit own comments')); $this->drupalLogin($this->admin_user); $this->setCommentPreview(DRUPAL_OPTIONAL); $this->setCommentForm(TRUE); @@ -164,6 +164,15 @@ function testCommentEditPreviewSave() { $this->assertEqual($comment_loaded->comment_body->value, $edit['comment_body[0][value]'], 'Comment body loaded.'); $this->assertEqual($comment_loaded->name->value, $edit['name'], 'Name loaded.'); $this->assertEqual($comment_loaded->created->value, $raw_date, 'Date loaded.'); + + // Check that the date and time of the comment are correct when edited by non-admin users. + $this->drupalLogout(); + $user_edit = array(); + $expected_created_time = $comment_loaded->created->value; + $this->drupalLogin($web_user); + $this->drupalPostForm('comment/' . $comment->id() . '/edit', $user_edit, t('Save')); + $comment_loaded = comment_load($comment->id(), TRUE); + $this->assertEqual($comment_loaded->created->value, $expected_created_time, 'Expected date and time for comment edited.'); } }