function MigrateImageCacheTest::testPassingMigration

Same name in other branches
  1. 8.9.x 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()
  3. 11.x core/modules/image/tests/src/Kernel/Migrate/d6/MigrateImageCacheTest.php \Drupal\Tests\image\Kernel\Migrate\d6\MigrateImageCacheTest::testPassingMigration()

Tests basic passing migrations.

File

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

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->assertSame('big_blue_cheese', $style->get('name'), 'ImageStyle name set correctly');
    $this->assertSame('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' => '',
    ]);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.