3 namespace Drupal\Tests\rest\Functional\EntityResource\CommentType;
5 use Drupal\comment\Entity\CommentType;
6 use Drupal\Tests\rest\Functional\EntityResource\EntityResourceTestBase;
9 * ResourceTestBase for CommentType entity.
11 abstract class CommentTypeResourceTestBase extends EntityResourceTestBase {
16 public static $modules = ['node', 'comment'];
21 protected static $entityTypeId = 'comment_type';
24 * The CommentType entity.
26 * @var \Drupal\comment\CommentTypeInterface
33 protected function setUpAuthorization($method) {
34 $this->grantPermissionsToTestedRole(['administer comment types']);
40 protected function createEntity() {
41 // Create a "Camelids" comment type.
42 $camelids = CommentType::create([
44 'label' => 'Camelids',
45 'description' => 'Camelids are large, strictly herbivorous animals with slender necks and long legs.',
46 'target_entity_type_id' => 'node',
57 protected function getExpectedNormalizedEntity() {
60 'description' => 'Camelids are large, strictly herbivorous animals with slender necks and long legs.',
62 'label' => 'Camelids',
65 'target_entity_type_id' => 'node',
66 'uuid' => $this->entity->uuid(),
73 protected function getNormalizedPostEntity() {
74 // @todo Update in https://www.drupal.org/node/2300677.