You are here

public function MigrateImageCacheTest::testInvalidCropValues in Drupal 10

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

Tests that missing action's causes failures.

File

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

Class

MigrateImageCacheTest
Tests migration of ImageCache presets to image styles.

Namespace

Drupal\Tests\image\Kernel\Migrate\d6

Code

public function testInvalidCropValues() {
  Database::getConnection('default', 'migrate')
    ->insert("imagecache_action")
    ->fields([
    'presetid',
    'weight',
    'module',
    'action',
    'data',
  ])
    ->values([
    'presetid' => '1',
    'weight' => '0',
    'module' => 'imagecache',
    'action' => 'imagecache_crop',
    'data' => serialize([
      'xoffset' => '10',
      'yoffset' => '10',
    ]),
  ])
    ->execute();
  $this
    ->startCollectingMessages();
  $this
    ->executeMigration('d6_imagecache_presets');
  $this
    ->assertEquals([
    'error' => [
      'The Drupal 8 image crop effect does not support numeric values for x and y offsets. Use keywords to set crop effect offsets instead.',
    ],
  ], $this->migrateMessages);
}