diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentFieldsTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentFieldsTest.php index ab03d41..c0f806f 100644 --- a/core/modules/comment/lib/Drupal/comment/Tests/CommentFieldsTest.php +++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentFieldsTest.php @@ -117,4 +117,41 @@ function testCommentFormat() { $edit = array('comment_body[und][0][value]' => $this->randomName(8)); $this->drupalPost('node/' . $this->node->nid, $edit, t('Save')); } + + /** + * Tests that comment fields can be managed through the UI. + */ + function testCommentFieldUI() { + // Log in as the administrative user. + $this->drupalLogin($this->admin_user); + + // Create a test node type and a node of that type. + $this->drupalCreateContentType(array('type' => 'test_node_type')); + $node = $this->drupalCreateNode(array('type' => 'test_node_type')); + + // Add a field to the comments for this node type through the UI. + $edit = array( + 'fields[_add_new_field][label]' => t('Test field label'), + 'fields[_add_new_field][field_name]' => 'test_field', + 'fields[_add_new_field][type]' => 'text', + 'fields[_add_new_field][widget_type]' => 'text_textfield', + ); + $this->drupalPost('admin/structure/types/manage/test_node_type/comment/fields', $edit, t('Save')); + + // Confirm that the field is present + $this->drupalGet('comment/reply/' . $node->nid); + $this->assertText(t('Test field label')); + + $this->drupalGet('admin/structure/types/manage/test_node_type/comment/fields'); + + // Delete the field through the UI. + $this->drupalPost('admin/structure/types/manage/test_node_type/comment/fields/field_test_field/delete', array(), t('Delete')); + $this->assertResponse(200); + + // Confirm that the field is no longer present + $this->drupalGet('comment/reply/' . $node->nid); + $this->assertNoText(t('Test field label')); + + } + }