MediaTypeResourceTestBase.php in Drupal 10
File
core/modules/media/tests/src/Functional/Rest/MediaTypeResourceTestBase.php
View source
<?php
namespace Drupal\Tests\media\Functional\Rest;
use Drupal\media\Entity\MediaType;
use Drupal\Tests\rest\Functional\EntityResource\ConfigEntityResourceTestBase;
abstract class MediaTypeResourceTestBase extends ConfigEntityResourceTestBase {
protected static $modules = [
'media',
];
protected static $entityTypeId = 'media_type';
protected $entity;
protected function setUpAuthorization($method) {
$this
->grantPermissionsToTestedRole([
'administer media types',
]);
}
protected function createEntity() {
$camelids = MediaType::create([
'name' => 'Camelids',
'id' => 'camelids',
'description' => 'Camelids are large, strictly herbivorous animals with slender necks and long legs.',
'source' => 'file',
]);
$camelids
->save();
return $camelids;
}
protected function getExpectedNormalizedEntity() {
return [
'dependencies' => [],
'description' => 'Camelids are large, strictly herbivorous animals with slender necks and long legs.',
'field_map' => [],
'id' => 'camelids',
'label' => NULL,
'langcode' => 'en',
'source' => 'file',
'queue_thumbnail_downloads' => FALSE,
'new_revision' => FALSE,
'source_configuration' => [
'source_field' => '',
],
'status' => TRUE,
'uuid' => $this->entity
->uuid(),
];
}
protected function getNormalizedPostEntity() {
return [];
}
}