You are here

public function MigrateImageCacheTest::testPassingMigration in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/image/tests/src/Kernel/Migrate/d6/MigrateImageCacheTest.php \Drupal\Tests\image\Kernel\Migrate\d6\MigrateImageCacheTest::testPassingMigration()
  2. 10 core/modules/image/tests/src/Kernel/Migrate/d6/MigrateImageCacheTest.php \Drupal\Tests\image\Kernel\Migrate\d6\MigrateImageCacheTest::testPassingMigration()

Test basic passing migrations.

File

core/modules/image/tests/src/Kernel/Migrate/d6/MigrateImageCacheTest.php, line 47

Class

MigrateImageCacheTest
Tests migration of ImageCache presets to image styles.

Namespace

Drupal\Tests\image\Kernel\Migrate\d6

Code

public function testPassingMigration() {
  $this
    ->executeMigration('d6_imagecache_presets');

  /** @var \Drupal\image\Entity\ImageStyle $style */
  $style = ImageStyle::load('big_blue_cheese');

  // Check basic Style info.
  $this
    ->assertIdentical('big_blue_cheese', $style
    ->get('name'), 'ImageStyle name set correctly');
  $this
    ->assertIdentical('big_blue_cheese', $style
    ->get('label'), 'ImageStyle label set correctly');

  // Test effects.
  $effects = $style
    ->getEffects();

  // Check crop effect.
  $this
    ->assertImageEffect($effects, 'image_crop', [
    'width' => 555,
    'height' => 5555,
    'anchor' => 'center-center',
  ]);

  // Check resize effect.
  $this
    ->assertImageEffect($effects, 'image_resize', [
    'width' => 55,
    'height' => 55,
  ]);

  // Check rotate effect.
  $this
    ->assertImageEffect($effects, 'image_rotate', [
    'degrees' => 55,
    'random' => FALSE,
    'bgcolor' => '',
  ]);
}