function MediaTypeTest::createEntity
Same name and namespace in other branches
- 9 core/modules/jsonapi/tests/src/Functional/MediaTypeTest.php \Drupal\Tests\jsonapi\Functional\MediaTypeTest::createEntity()
- 8.9.x core/modules/jsonapi/tests/src/Functional/MediaTypeTest.php \Drupal\Tests\jsonapi\Functional\MediaTypeTest::createEntity()
- 10 core/modules/jsonapi/tests/src/Functional/MediaTypeTest.php \Drupal\Tests\jsonapi\Functional\MediaTypeTest::createEntity()
Overrides ResourceTestBase::createEntity
File
-
core/
modules/ jsonapi/ tests/ src/ Functional/ MediaTypeTest.php, line 55
Class
- MediaTypeTest
- JSON:API integration test for the "MediaType" config entity type.
Namespace
Drupal\Tests\jsonapi\FunctionalCode
protected function createEntity() {
// Create a "Camelids" media type.
$camelids = MediaType::create([
'label' => 'Camelids',
'id' => 'camelids',
'description' => 'Camelids are large, strictly herbivorous animals with slender necks and long legs.',
'source' => 'file',
]);
$camelids->save();
return $camelids;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.