diff --git a/core/modules/image/config/schema/image.source.schema.yml b/core/modules/image/config/schema/image.source.schema.yml new file mode 100644 index 0000000..1230023 --- /dev/null +++ b/core/modules/image/config/schema/image.source.schema.yml @@ -0,0 +1,3 @@ +migrate.source.d6_imagecache_presets: + type: migrate_source_sql + label: 'Drupal 6 ImageCache Presets' diff --git a/core/modules/image/src/Plugin/migrate/destination/EntityImageStyle.php b/core/modules/image/src/Plugin/migrate/destination/EntityImageStyle.php index a63d8c4..35de88e 100644 --- a/core/modules/image/src/Plugin/migrate/destination/EntityImageStyle.php +++ b/core/modules/image/src/Plugin/migrate/destination/EntityImageStyle.php @@ -24,8 +24,6 @@ class EntityImageStyle extends EntityConfigBase { /** * {@inheritdoc} - * - * @throws \Drupal\migrate\MigrateException */ public function import(Row $row, array $old_destination_id_values = []) { $effects = []; @@ -47,7 +45,7 @@ public function import(Row $row, array $old_destination_id_values = []) { $style->addImageEffect($effect); } catch (PluginNotFoundException $e) { - throw new MigrateException($e->getMessage()); + throw new MigrateException($e->getMessage(), 0, $e); } } @@ -55,4 +53,5 @@ public function import(Row $row, array $old_destination_id_values = []) { return array($style->id()); } + } diff --git a/core/modules/image/src/Plugin/migrate/process/d6/ImageCacheActions.php b/core/modules/image/src/Plugin/migrate/process/d6/ImageCacheActions.php index 54055b5..deb9934 100644 --- a/core/modules/image/src/Plugin/migrate/process/d6/ImageCacheActions.php +++ b/core/modules/image/src/Plugin/migrate/process/d6/ImageCacheActions.php @@ -21,8 +21,6 @@ class ImageCacheActions extends ProcessPluginBase { /** * {@inheritdoc} - * - * @throws \Drupal\migrate\MigrateSkipRowException. */ public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) { $effects = []; @@ -53,4 +51,5 @@ public function transform($value, MigrateExecutableInterface $migrate_executable return $effects; } + } diff --git a/core/modules/image/src/Plugin/migrate/source/d6/ImageCachePreset.php b/core/modules/image/src/Plugin/migrate/source/d6/ImageCachePreset.php index 4380c19..8c563f0 100644 --- a/core/modules/image/src/Plugin/migrate/source/d6/ImageCachePreset.php +++ b/core/modules/image/src/Plugin/migrate/source/d6/ImageCachePreset.php @@ -17,7 +17,6 @@ * id = "d6_imagecache_presets" * ) */ - class ImageCachePreset extends DrupalSqlBase { /** @@ -25,11 +24,7 @@ class ImageCachePreset extends DrupalSqlBase { */ public function query() { $query = $this->select('imagecache_preset', 'icp') - ->fields('icp', [ - 'presetid', - 'presetname', - ] - ); + ->fields('icp'); return $query; } @@ -71,4 +66,5 @@ public function prepareRow(Row $row) { $row->setSourceProperty('actions', $actions); return parent::prepareRow($row); } + } diff --git a/core/modules/image/src/Tests/Migrate/d6/MigrateImageCacheTest.php b/core/modules/image/src/Tests/Migrate/d6/MigrateImageCacheTest.php index e9a8268..68efb34 100644 --- a/core/modules/image/src/Tests/Migrate/d6/MigrateImageCacheTest.php +++ b/core/modules/image/src/Tests/Migrate/d6/MigrateImageCacheTest.php @@ -55,27 +55,27 @@ public function testPassingMigration() { /** @var \Drupal\image\Entity\ImageStyle $style */ $style = ImageStyle::load('big_blue_cheese'); - //check basic Style info + // 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 + // Test effects. $effects = $style->getEffects(); - //check crop effect + // Check crop effect. $this->assertImageEffect($effects, 'image_crop', [ 'width' => 555, 'height' => 5555, 'anchor' => 'center-center', ]); - //check resize effect + // Check resize effect. $this->assertImageEffect($effects, 'image_resize', [ 'width' => 55, 'height' => 55, ]); - //check rotate effect + // Check rotate effect. $this->assertImageEffect($effects, 'image_rotate', [ 'degrees' => 55, 'random' => FALSE, @@ -84,7 +84,7 @@ public function testPassingMigration() { } /** - * Test that missing action's causes failures. + * Test that missing actions causes failures. */ public function testMissingEffectPlugin() { Database::getConnection('default', 'migrate')->insert("imagecache_action") @@ -158,9 +158,12 @@ protected function assertImageEffect($collection, $id, $config) { $effect_config = $effect->getConfiguration(); if ($effect_config['id'] == $id && $effect_config['data'] == $config) { + // We found this effect so succeed and return. return $this->pass('Effect ' . $id . ' imported correctly'); } } + // The loop did not find the effect so we it was not imported correctly. return $this->fail('Effect ' . $id . ' did not import correctly'); } + } diff --git a/core/modules/migrate_drupal/config/schema/migrate_drupal.source.schema.yml b/core/modules/migrate_drupal/config/schema/migrate_drupal.source.schema.yml index 428db2f..6152f9e 100644 --- a/core/modules/migrate_drupal/config/schema/migrate_drupal.source.schema.yml +++ b/core/modules/migrate_drupal/config/schema/migrate_drupal.source.schema.yml @@ -50,10 +50,6 @@ migrate.source.variable_multirow: type: string label: 'Variable' -migrate.source.d6_imagecache_presets: - type: migrate_source_sql - label: 'Drupal 6 ImageCache Presets' - migrate_entity_constant: type: mapping mapping: