abstract class EntityViewDisplayResourceTestBase in Drupal 10
Same name and namespace in other branches
- 8 core/tests/Drupal/FunctionalTests/Rest/EntityViewDisplayResourceTestBase.php \Drupal\FunctionalTests\Rest\EntityViewDisplayResourceTestBase
- 9 core/tests/Drupal/FunctionalTests/Rest/EntityViewDisplayResourceTestBase.php \Drupal\FunctionalTests\Rest\EntityViewDisplayResourceTestBase
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\FunctionalTests\Rest\EntityViewDisplayResourceTestBase
- class \Drupal\Tests\rest\Functional\EntityResource\ConfigEntityResourceTestBase
- class \Drupal\Tests\rest\Functional\EntityResource\EntityResourceTestBase
- class \Drupal\Tests\rest\Functional\ResourceTestBase
Expanded class hierarchy of EntityViewDisplayResourceTestBase
1 file declares its use of EntityViewDisplayResourceTestBase
- LayoutBuilderEntityViewDisplayResourceTestBase.php in core/
modules/ layout_builder/ tests/ src/ Functional/ Rest/ LayoutBuilderEntityViewDisplayResourceTestBase.php
File
- core/
tests/ Drupal/ FunctionalTests/ Rest/ EntityViewDisplayResourceTestBase.php, line 9
Namespace
Drupal\FunctionalTests\RestView source
abstract class EntityViewDisplayResourceTestBase extends ConfigEntityResourceTestBase {
/**
* {@inheritdoc}
*/
protected static $modules = [
'node',
'field_ui',
];
/**
* {@inheritdoc}
*/
protected static $entityTypeId = 'entity_view_display';
/**
* {@inheritdoc}
*/
protected static $patchProtectedFieldNames = [];
/**
* @var \Drupal\Core\Entity\Display\EntityViewDisplayInterface
*/
protected $entity;
/**
* {@inheritdoc}
*/
protected function setUpAuthorization($method) {
$this
->grantPermissionsToTestedRole([
'administer node display',
]);
}
/**
* {@inheritdoc}
*/
protected function createEntity() {
// Create a "Camelids" node type.
$camelids = NodeType::create([
'name' => 'Camelids',
'type' => 'camelids',
]);
$camelids
->save();
// Create a view display.
$view_display = EntityViewDisplay::create([
'targetEntityType' => 'node',
'bundle' => 'camelids',
'mode' => 'default',
'status' => TRUE,
]);
$view_display
->save();
return $view_display;
}
/**
* {@inheritdoc}
*/
protected function getExpectedNormalizedEntity() {
return [
'bundle' => 'camelids',
'content' => [
'links' => [
'region' => 'content',
'weight' => 100,
'settings' => [],
'third_party_settings' => [],
],
],
'dependencies' => [
'config' => [
'node.type.camelids',
],
'module' => [
'user',
],
],
'hidden' => [],
'id' => 'node.camelids.default',
'langcode' => 'en',
'mode' => 'default',
'status' => TRUE,
'targetEntityType' => 'node',
'uuid' => $this->entity
->uuid(),
];
}
/**
* {@inheritdoc}
*/
protected function getNormalizedPostEntity() {
// @todo Update in https://www.drupal.org/node/2300677.
return [];
}
/**
* {@inheritdoc}
*/
protected function getExpectedCacheContexts() {
return [
'user.permissions',
];
}
/**
* {@inheritdoc}
*/
protected function getExpectedUnauthorizedAccessMessage($method) {
return "The 'administer node display' permission is required.";
}
}