diff --git a/core/modules/migrate_drupal/src/Tests/Table/d6/ImagecacheAction.php b/core/modules/migrate_drupal/src/Tests/Table/d6/ImagecacheAction.php new file mode 100644 index 0000000..55f3bef --- /dev/null +++ b/core/modules/migrate_drupal/src/Tests/Table/d6/ImagecacheAction.php @@ -0,0 +1,112 @@ +createTable("imagecache_action", array( + 'primary key' => array( + 'actionid', + ), + 'fields' => array( + 'actionid' => array( + 'type' => 'serial', + 'not null' => TRUE, + 'length' => '10', + 'unsigned' => TRUE, + ), + 'presetid' => array( + 'type' => 'int', + 'not null' => TRUE, + 'length' => '10', + 'default' => '0', + 'unsigned' => TRUE, + ), + 'weight' => array( + 'type' => 'int', + 'not null' => TRUE, + 'length' => '11', + 'default' => '0', + ), + 'module' => array( + 'type' => 'varchar', + 'not null' => TRUE, + 'length' => '255', + ), + 'action' => array( + 'type' => 'varchar', + 'not null' => TRUE, + 'length' => '255', + ), + 'data' => array( + 'type' => 'text', + 'not null' => TRUE, + 'length' => 100, + ), + ), + 'mysql_character_set' => 'utf8', + )); + $this->database->insert("imagecache_action")->fields(array( + 'actionid', + 'presetid', + 'weight', + 'module', + 'action', + 'data', + )) + ->values(array( + 'actionid' => '2', + 'presetid' => '1', + 'weight' => '0', + 'module' => 'imagecache', + 'action' => 'imagecache_deprecated_scale', + 'data' => 'a:3:{s:3:"fit";s:7:"outside";s:5:"width";s:3:"200";s:6:"height";s:3:"200";}', + ))->values(array( + 'actionid' => '3', + 'presetid' => '1', + 'weight' => '0', + 'module' => 'imagecache', + 'action' => 'imagecache_scale_and_crop', + 'data' => 'a:2:{s:5:"width";s:4:"100%";s:6:"height";s:4:"100%";}', + ))->values(array( + 'actionid' => '4', + 'presetid' => '2', + 'weight' => '0', + 'module' => 'imagecache', + 'action' => 'imagecache_crop', + 'data' => 'a:4:{s:5:"width";s:3:"555";s:6:"height";s:4:"5555";s:7:"xoffset";s:6:"center";s:7:"yoffset";s:6:"center";}', + ))->values(array( + 'actionid' => '5', + 'presetid' => '2', + 'weight' => '0', + 'module' => 'imagecache', + 'action' => 'imagecache_resize', + 'data' => 'a:2:{s:5:"width";s:3:"55%";s:6:"height";s:3:"55%";}', + ))->values(array( + 'actionid' => '6', + 'presetid' => '2', + 'weight' => '0', + 'module' => 'imagecache', + 'action' => 'imagecache_rotate', + 'data' => 'a:3:{s:7:"degrees";s:2:"55";s:6:"random";i:0;s:7:"bgcolor";s:0:"";}', + ))->execute(); + } + +} +#79a19aa7a4e9c76e439882490c8c9bdb diff --git a/core/modules/migrate_drupal/src/Tests/Table/d6/ImagecachePreset.php b/core/modules/migrate_drupal/src/Tests/Table/d6/ImagecachePreset.php new file mode 100644 index 0000000..154662c --- /dev/null +++ b/core/modules/migrate_drupal/src/Tests/Table/d6/ImagecachePreset.php @@ -0,0 +1,56 @@ +createTable("imagecache_preset", array( + 'primary key' => array( + 'presetid', + ), + 'fields' => array( + 'presetid' => array( + 'type' => 'serial', + 'not null' => TRUE, + 'length' => '10', + 'unsigned' => TRUE, + ), + 'presetname' => array( + 'type' => 'varchar', + 'not null' => TRUE, + 'length' => '255', + ), + ), + 'mysql_character_set' => 'utf8', + )); + $this->database->insert("imagecache_preset")->fields(array( + 'presetid', + 'presetname', + )) + ->values(array( + 'presetid' => '1', + 'presetname' => 'slackjaw_boys', + ))->values(array( + 'presetid' => '2', + 'presetname' => 'big_blue_cheese', + ))->execute(); + } + +} +#b2102d82ad5b3d8be026fe23cea75674 diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateDrupal6Test.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateDrupal6Test.php index b277e3b..8ab7f92 100644 --- a/core/modules/migrate_drupal/src/Tests/d6/MigrateDrupal6Test.php +++ b/core/modules/migrate_drupal/src/Tests/d6/MigrateDrupal6Test.php @@ -95,6 +95,7 @@ class MigrateDrupal6Test extends MigrateFullDrupalTestBase { 'd6_file', 'd6_filter_format', 'd6_forum_settings', + 'd6_imagecache_presets', 'd6_locale_settings', 'd6_menu_settings', 'd6_menu', @@ -227,6 +228,8 @@ protected function getDumps() { $tests_path . '/Files.php', $tests_path . '/FilterFormats.php', $tests_path . '/Filters.php', + $tests_path . '/ImagecacheAction.php', + $tests_path . '/ImagecachePreset.php', $tests_path . '/MenuCustom.php', $tests_path . '/MenuLinks.php', $tests_path . '/Node.php', @@ -285,6 +288,7 @@ protected function getTestClassesList() { __NAMESPACE__ . '\MigrateFileTest', __NAMESPACE__ . '\MigrateFilterFormatTest', __NAMESPACE__ . '\MigrateForumConfigsTest', + __NAMESPACE__ . '\MigrateImageCacheTest', __NAMESPACE__ . '\MigrateLocaleConfigsTest', __NAMESPACE__ . '\MigrateMenuConfigsTest', __NAMESPACE__ . '\MigrateMenuLinkTest', diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateImageCacheTest.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateImageCacheTest.php new file mode 100644 index 0000000..53a9c9d --- /dev/null +++ b/core/modules/migrate_drupal/src/Tests/d6/MigrateImageCacheTest.php @@ -0,0 +1,75 @@ +installConfig(array('image')); + $migration = entity_load('migration', 'd6_imagecache_presets'); + + $dumps = array( + $this->getDumpDirectory() . '/ImagecachePreset', + $this->getDumpDirectory() . '/ImagecacheAction', + ); + + $this->prepare($migration, $dumps); + $executable = new MigrateExecutable($migration, $this); + $executable->import(); + } + + public function testImageCache() { + $migration = entity_load('migration', 'd6_imagecache_presets'); + $style = ImageStyle::load('big_blue_cheese'); + + //check for failed style creation due to missing plugin + $this->assertNull(ImageStyle::load('slackjaw_boys')); + + //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'); + + //check crop effect + $image_crop = $style->getEffect('image_crop')->getConfiguration(); + $this->assertIdentical('555',$image_crop['data']['width'], 'ImageEffect crop Width set correctly'); + $this->assertIdentical('5555', $image_crop['data']['height'], 'ImageEffect crop Height set correctly'); + $this->assertIdentical('center-center', $image_crop['data']['anchor'], 'ImageEffect crop Anchor set correctly'); + + //check resize effect + $image_resize = $style->getEffect('image_resize')->getConfiguration(); + $this->assertIdentical('55', $image_resize['data']['width'], 'ImageEffect resize Width set correctly'); + $this->assertIdentical('55', $image_resize['data']['height'], 'ImageEffect resize Height set correctly'); + + //check rotate effect + $image_rotate = $style->getEffect('image_rotate')->getConfiguration(); + $this->assertIdentical('55', $image_rotate['data']['degrees'], 'ImageEffect rotate Degrees set correctly'); + $this->assertIdentical('0', $image_rotate['data']['random'], 'ImageEffect rotate Random set correctly'); + $this->assertIdentical('0', $image_resize['data']['bgcolor'], 'ImageEffect rotate color set correctly'); + } +}