You are here

ImageImportTest.php in Zircon Profile 8

Same filename and directory in other branches
  1. 8.0 core/modules/image/src/Tests/ImageImportTest.php

Namespace

Drupal\image\Tests

File

core/modules/image/src/Tests/ImageImportTest.php
View source
<?php

/**
 * @file
 * Contains \Drupal\image\Tests\ImageImportTest.
 */
namespace Drupal\image\Tests;

use Drupal\image\Entity\ImageStyle;
use Drupal\simpletest\KernelTestBase;

/**
 * Tests config import for Image styles.
 *
 * @group image
 */
class ImageImportTest extends KernelTestBase {

  /**
   * {@inheritdoc}
   */
  public static $modules = [
    'system',
    'image',
    'image_module_test',
  ];

  /**
   * Tests importing image styles.
   */
  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);
  }

}

Classes

Namesort descending Description
ImageImportTest Tests config import for Image styles.