EntityViewModeResourceTestBase.php in Drupal 8
File
core/tests/Drupal/FunctionalTests/Rest/EntityViewModeResourceTestBase.php
View source
<?php
namespace Drupal\FunctionalTests\Rest;
use Drupal\Tests\rest\Functional\EntityResource\EntityResourceTestBase;
use Drupal\Core\Entity\Entity\EntityViewMode;
abstract class EntityViewModeResourceTestBase extends EntityResourceTestBase {
public static $modules = [
'user',
'field_ui',
];
protected static $entityTypeId = 'entity_view_mode';
protected $entity;
protected function setUpAuthorization($method) {
$this
->grantPermissionsToTestedRole([
'administer display modes',
]);
}
protected function createEntity() {
$entity_view_mode = EntityViewMode::create([
'id' => 'user.test',
'label' => 'Test',
'targetEntityType' => 'user',
]);
$entity_view_mode
->save();
return $entity_view_mode;
}
protected function getExpectedNormalizedEntity() {
return [
'cache' => TRUE,
'dependencies' => [
'module' => [
'user',
],
],
'id' => 'user.test',
'label' => 'Test',
'langcode' => 'en',
'status' => TRUE,
'targetEntityType' => 'user',
'uuid' => $this->entity
->uuid(),
];
}
protected function getNormalizedPostEntity() {
}
}