// Test sample item generation.
/** @var \Drupal\entity_test\Entity\EntityTest $entity */
$entity = EntityTest::
create();
$entity->comment->
generateSampleItems();
$this->
entityValidateAndSave($entity);
$this->
assertContains($entity->
get('comment'
)->status,
[ CommentItemInterface::HIDDEN,
CommentItemInterface::CLOSED,
CommentItemInterface::OPEN,
], 'Comment status value in defined range'
);
$mainProperty =
$entity->comment
[0
]->
mainPropertyName();
$this->
assertEquals('status',
$mainProperty);
} /**
* Tests comment author name.
*/
public function testCommentAuthorName() { $this->
installEntitySchema('comment'
);
$this->
addDefaultCommentField('entity_test', 'entity_test', 'comment'
);
$host = EntityTest::
create(['name' =>
$this->
randomString()]);