function MigrateImageCacheTest::testPassingMigration

Same name 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()
  3. 11.x 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' => '',
    ]);
}

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