You are here

protected function ImageReplaceTestBase::createImageStyle in Image Replace 8

Same name and namespace in other branches
  1. 7 src/Tests/ImageReplaceTestBase.php \Drupal\image_replace\Tests\ImageReplaceTestBase::createImageStyle()

Create an image style containing the image repace effect.

Parameters

string $name: The name of the new image style (all lowercase).

Return value

array The newly created image style array.

3 calls to ImageReplaceTestBase::createImageStyle()
AdminTest::setUp in src/Tests/AdminTest.php
EntityTest::setUp in src/Tests/EntityTest.php
ReplaceEffectTest::testReplaceEffect in src/Tests/ReplaceEffectTest.php
Tests functionality of the replace image effect.

File

src/Tests/ImageReplaceTestBase.php, line 79

Class

ImageReplaceTestBase
Tests functionality of the replace image effect.

Namespace

Drupal\image_replace\Tests

Code

protected function createImageStyle($name) {

  // Create an image style containing the replace effect.
  $style = ImageStyle::create([
    'name' => $name,
    'label' => $this
      ->randomString(),
  ]);
  $effect = [
    'id' => 'image_replace',
    'data' => [],
  ];
  $style
    ->addImageEffect($effect);
  $style
    ->save();
  return $style;
}