abstract class EntityViewModeResourceTestBase in Drupal 10
Same name and namespace in other branches
- 8 core/tests/Drupal/FunctionalTests/Rest/EntityViewModeResourceTestBase.php \Drupal\FunctionalTests\Rest\EntityViewModeResourceTestBase
- 9 core/tests/Drupal/FunctionalTests/Rest/EntityViewModeResourceTestBase.php \Drupal\FunctionalTests\Rest\EntityViewModeResourceTestBase
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\EntityViewModeResourceTestBase
- class \Drupal\Tests\rest\Functional\EntityResource\ConfigEntityResourceTestBase
- class \Drupal\Tests\rest\Functional\EntityResource\EntityResourceTestBase
- class \Drupal\Tests\rest\Functional\ResourceTestBase
Expanded class hierarchy of EntityViewModeResourceTestBase
File
- core/
tests/ Drupal/ FunctionalTests/ Rest/ EntityViewModeResourceTestBase.php, line 8
Namespace
Drupal\FunctionalTests\RestView source
abstract class EntityViewModeResourceTestBase extends ConfigEntityResourceTestBase {
/**
* {@inheritdoc}
*
* @todo: Remove 'field_ui' when https://www.drupal.org/node/2867266.
*/
protected static $modules = [
'user',
'field_ui',
];
/**
* {@inheritdoc}
*/
protected static $entityTypeId = 'entity_view_mode';
/**
* @var \Drupal\Core\Entity\EntityViewModeInterface
*/
protected $entity;
/**
* {@inheritdoc}
*/
protected function setUpAuthorization($method) {
$this
->grantPermissionsToTestedRole([
'administer display modes',
]);
}
/**
* {@inheritdoc}
*/
protected function createEntity() {
$entity_view_mode = EntityViewMode::create([
'id' => 'user.test',
'label' => 'Test',
'targetEntityType' => 'user',
]);
$entity_view_mode
->save();
return $entity_view_mode;
}
/**
* {@inheritdoc}
*/
protected function getExpectedNormalizedEntity() {
return [
'cache' => TRUE,
'dependencies' => [
'module' => [
'user',
],
],
'id' => 'user.test',
'label' => 'Test',
'langcode' => 'en',
'status' => TRUE,
'targetEntityType' => 'user',
'uuid' => $this->entity
->uuid(),
];
}
/**
* {@inheritdoc}
*/
protected function getNormalizedPostEntity() {
// @todo Update in https://www.drupal.org/node/2300677.
return [];
}
}