function ImageStyleTest::createEntity

Same name in other branches
  1. 8.9.x core/modules/jsonapi/tests/src/Functional/ImageStyleTest.php \Drupal\Tests\jsonapi\Functional\ImageStyleTest::createEntity()
  2. 10 core/modules/jsonapi/tests/src/Functional/ImageStyleTest.php \Drupal\Tests\jsonapi\Functional\ImageStyleTest::createEntity()
  3. 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 59

Class

ImageStyleTest
JSON:API integration test for the "ImageStyle" config entity type.

Namespace

Drupal\Tests\jsonapi\Functional

Code

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.