BlockContentTypeResourceTestBase.php in Drupal 10
File
core/modules/block_content/tests/src/Functional/Rest/BlockContentTypeResourceTestBase.php
View source
<?php
namespace Drupal\Tests\block_content\Functional\Rest;
use Drupal\Tests\rest\Functional\EntityResource\ConfigEntityResourceTestBase;
use Drupal\block_content\Entity\BlockContentType;
abstract class BlockContentTypeResourceTestBase extends ConfigEntityResourceTestBase {
protected static $modules = [
'block_content',
];
protected static $entityTypeId = 'block_content_type';
protected $entity;
protected function setUpAuthorization($method) {
$this
->grantPermissionsToTestedRole([
'administer blocks',
]);
}
protected function createEntity() {
$block_content_type = BlockContentType::create([
'id' => 'pascal',
'label' => 'Pascal',
'revision' => FALSE,
'description' => 'Provides a competitive alternative to the "basic" type',
]);
$block_content_type
->save();
return $block_content_type;
}
protected function getExpectedNormalizedEntity() {
return [
'dependencies' => [],
'description' => 'Provides a competitive alternative to the "basic" type',
'id' => 'pascal',
'label' => 'Pascal',
'langcode' => 'en',
'revision' => 0,
'status' => TRUE,
'uuid' => $this->entity
->uuid(),
];
}
protected function getNormalizedPostEntity() {
return [];
}
}