CommentTypeResourceTestBase.php in Drupal 8
File
core/modules/comment/tests/src/Functional/Rest/CommentTypeResourceTestBase.php
View source
<?php
namespace Drupal\Tests\comment\Functional\Rest;
use Drupal\comment\Entity\CommentType;
use Drupal\Tests\rest\Functional\EntityResource\EntityResourceTestBase;
abstract class CommentTypeResourceTestBase extends EntityResourceTestBase {
public static $modules = [
'node',
'comment',
];
protected static $entityTypeId = 'comment_type';
protected $entity;
protected function setUpAuthorization($method) {
$this
->grantPermissionsToTestedRole([
'administer comment types',
]);
}
protected function createEntity() {
$camelids = CommentType::create([
'id' => 'camelids',
'label' => 'Camelids',
'description' => 'Camelids are large, strictly herbivorous animals with slender necks and long legs.',
'target_entity_type_id' => 'node',
]);
$camelids
->save();
return $camelids;
}
protected function getExpectedNormalizedEntity() {
return [
'dependencies' => [],
'description' => 'Camelids are large, strictly herbivorous animals with slender necks and long legs.',
'id' => 'camelids',
'label' => 'Camelids',
'langcode' => 'en',
'status' => TRUE,
'target_entity_type_id' => 'node',
'uuid' => $this->entity
->uuid(),
];
}
protected function getNormalizedPostEntity() {
}
}