You are here

public function ImageImportTest::testImport in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/image/src/Tests/ImageImportTest.php \Drupal\image\Tests\ImageImportTest::testImport()

Tests importing image styles.

File

core/modules/image/src/Tests/ImageImportTest.php, line 28
Contains \Drupal\image\Tests\ImageImportTest.

Class

ImageImportTest
Tests config import for Image styles.

Namespace

Drupal\image\Tests

Code

public function testImport() {
  $style = ImageStyle::create([
    'name' => 'test',
  ]);
  $style
    ->addImageEffect([
    'id' => 'image_module_test_null',
  ]);
  $style
    ->addImageEffect([
    'id' => 'image_module_test_null',
  ]);
  $style
    ->save();
  $this
    ->assertEqual(count($style
    ->getEffects()), 2);
  $uuid = \Drupal::service('uuid')
    ->generate();
  $style
    ->set('effects', [
    $uuid => [
      'id' => 'image_module_test_null',
    ],
  ]);
  $style
    ->save();
  $style = ImageStyle::load('test');
  $this
    ->assertEqual(count($style
    ->getEffects()), 1);
}