abstract class CommentTypeResourceTestBase in Drupal 10
Same name and namespace in other branches
- 8 core/modules/comment/tests/src/Functional/Rest/CommentTypeResourceTestBase.php \Drupal\Tests\comment\Functional\Rest\CommentTypeResourceTestBase
- 9 core/modules/comment/tests/src/Functional/Rest/CommentTypeResourceTestBase.php \Drupal\Tests\comment\Functional\Rest\CommentTypeResourceTestBase
ResourceTestBase for CommentType entity.
Hierarchy
- class \Drupal\Tests\BrowserTestBase extends \PHPUnit\Framework\TestCase uses \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait, FunctionalTestSetupTrait, TestSetupTrait, BlockCreationTrait, ConfigTestTrait, ExtensionListTestTrait, ContentTypeCreationTrait, NodeCreationTrait, RandomGeneratorTrait, TestRequirementsTrait, PhpUnitWarnings, UiHelperTrait, UserCreationTrait, XdebugRequestTrait
- class \Drupal\Tests\rest\Functional\ResourceTestBase
- class \Drupal\Tests\rest\Functional\EntityResource\EntityResourceTestBase
- class \Drupal\Tests\rest\Functional\EntityResource\ConfigEntityResourceTestBase
- class \Drupal\Tests\comment\Functional\Rest\CommentTypeResourceTestBase
- class \Drupal\Tests\rest\Functional\EntityResource\ConfigEntityResourceTestBase
- class \Drupal\Tests\rest\Functional\EntityResource\EntityResourceTestBase
- class \Drupal\Tests\rest\Functional\ResourceTestBase
Expanded class hierarchy of CommentTypeResourceTestBase
File
- core/
modules/ comment/ tests/ src/ Functional/ Rest/ CommentTypeResourceTestBase.php, line 11
Namespace
Drupal\Tests\comment\Functional\RestView source
abstract class CommentTypeResourceTestBase extends ConfigEntityResourceTestBase {
/**
* {@inheritdoc}
*/
protected static $modules = [
'node',
'comment',
];
/**
* {@inheritdoc}
*/
protected static $entityTypeId = 'comment_type';
/**
* The CommentType entity.
*
* @var \Drupal\comment\CommentTypeInterface
*/
protected $entity;
/**
* {@inheritdoc}
*/
protected function setUpAuthorization($method) {
$this
->grantPermissionsToTestedRole([
'administer comment types',
]);
}
/**
* {@inheritdoc}
*/
protected function createEntity() {
// Create a "Camelids" comment type.
$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;
}
/**
* {@inheritdoc}
*/
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(),
];
}
/**
* {@inheritdoc}
*/
protected function getNormalizedPostEntity() {
// @todo Update in https://www.drupal.org/node/2300677.
return [];
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
CommentTypeResourceTestBase:: |
protected | property | The CommentType entity. | |
CommentTypeResourceTestBase:: |
protected static | property | ||
CommentTypeResourceTestBase:: |
protected static | property | 2 | |
CommentTypeResourceTestBase:: |
protected | function | ||
CommentTypeResourceTestBase:: |
protected | function | ||
CommentTypeResourceTestBase:: |
protected | function | ||
CommentTypeResourceTestBase:: |
protected | function |