/**
* Tests that the default 'comment_body' field is correctly added.
*/
public function testCommentDefaultFields() { // Do not make assumptions on default node types created by the test
// installation profile, and create our own.
$this->
drupalCreateContentType(['type' => 'test_node_type'
]);
$this->
addDefaultCommentField('node', 'test_node_type'
);
// Check that the 'comment_body' field is present on the comment bundle.
$field = FieldConfig::
loadByName('comment', 'comment', 'comment_body'
);
$this->
assertNotEmpty($field, 'The comment_body field is added when a comment bundle is created'
);
$field->
delete();
// Check that the 'comment_body' field is not deleted since it is persisted
// even if it has no fields.
$field_storage = FieldStorageConfig::
loadByName('comment', 'comment_body'
);
$this->
assertInstanceOf(FieldStorageConfig::
class,
$field_storage);
// Create a new content type.
$type_name = 'test_node_type_2';