function ImageStyleTest::createEntity
Same name in other branches
- 9 core/modules/jsonapi/tests/src/Functional/ImageStyleTest.php \Drupal\Tests\jsonapi\Functional\ImageStyleTest::createEntity()
- 8.9.x core/modules/jsonapi/tests/src/Functional/ImageStyleTest.php \Drupal\Tests\jsonapi\Functional\ImageStyleTest::createEntity()
- 11.x core/modules/jsonapi/tests/src/Functional/ImageStyleTest.php \Drupal\Tests\jsonapi\Functional\ImageStyleTest::createEntity()
Overrides ResourceTestBase::createEntity
File
-
core/
modules/ jsonapi/ tests/ src/ Functional/ ImageStyleTest.php, line 62
Class
- ImageStyleTest
- JSON:API integration test for the "ImageStyle" config entity type.
Namespace
Drupal\Tests\jsonapi\FunctionalCode
protected function createEntity() {
// Create a "Camelids" image style.
$camelids = ImageStyle::create([
'name' => 'camelids',
'label' => 'Camelids',
]);
// Add an image effect.
$effect = [
'id' => 'image_scale_and_crop',
'data' => [
'width' => 120,
'height' => 121,
],
'weight' => 0,
];
$this->effectUuid = $camelids->addImageEffect($effect);
$camelids->save();
return $camelids;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.