3 namespace Drupal\Tests\rest\Functional\EntityResource\NodeType;
5 use Drupal\node\Entity\NodeType;
6 use Drupal\Tests\rest\Functional\EntityResource\EntityResourceTestBase;
9 * ResourceTestBase for NodeType entity.
11 abstract class NodeTypeResourceTestBase extends EntityResourceTestBase {
16 public static $modules = ['node'];
21 protected static $entityTypeId = 'node_type';
24 * The NodeType entity.
26 * @var \Drupal\node\NodeTypeInterface
33 protected function setUpAuthorization($method) {
34 $this->grantPermissionsToTestedRole(['administer content types', 'access content']);
40 protected function createEntity() {
41 // Create a "Camelids" node type.
42 $camelids = NodeType::create([
45 'description' => 'Camelids are large, strictly herbivorous animals with slender necks and long legs.',
56 protected function getExpectedNormalizedEntity() {
59 'description' => 'Camelids are large, strictly herbivorous animals with slender necks and long legs.',
60 'display_submitted' => TRUE,
64 'new_revision' => TRUE,
68 'uuid' => $this->entity->uuid(),
75 protected function getNormalizedPostEntity() {
76 // @todo Update in https://www.drupal.org/node/2300677.
82 protected function getExpectedUnauthorizedAccessMessage($method) {
83 if ($this->config('rest.settings')->get('bc_entity_resource_permissions')) {
84 return parent::getExpectedUnauthorizedAccessMessage($method);
87 return "The 'access content' permission is required.";