Version 1
[yaffs-website] / web / core / modules / image / tests / src / Kernel / Plugin / migrate / source / d6 / ImageCachePresetTest.php
diff --git a/web/core/modules/image/tests/src/Kernel/Plugin/migrate/source/d6/ImageCachePresetTest.php b/web/core/modules/image/tests/src/Kernel/Plugin/migrate/source/d6/ImageCachePresetTest.php
new file mode 100644 (file)
index 0000000..edd2ad3
--- /dev/null
@@ -0,0 +1,69 @@
+<?php
+
+namespace Drupal\Tests\image\Kernel\Plugin\migrate\source\d6;
+
+use Drupal\Tests\migrate\Kernel\MigrateSqlSourceTestBase;
+
+/**
+ * Tests the d6_imagecache_presets source plugin.
+ *
+ * @covers \Drupal\image\Plugin\migrate\source\d6\ImageCachePreset
+ *
+ * @group image
+ */
+class ImageCachePresetTest extends MigrateSqlSourceTestBase {
+
+  /**
+   * {@inheritdoc}
+   */
+  public static $modules = ['image', 'migrate_drupal'];
+
+  /**
+   * {@inheritdoc}
+   */
+  public function providerSource() {
+    $tests = [];
+
+    // The source data.
+    $tests[0]['source_data']['imagecache_preset'] = [
+      [
+        'presetid' => '1',
+        'presetname' => 'slackjaw_boys',
+      ],
+    ];
+    $tests[0]['source_data']['imagecache_action'] = [
+      [
+        '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%";}',
+      ],
+    ];
+
+    // The expected results.
+    $tests[0]['expected_data'] = [
+      [
+        'presetid' => '1',
+        'presetname' => 'slackjaw_boys',
+        'actions' => [
+          [
+            'actionid' => '3',
+            'presetid' => '1',
+            'weight' => '0',
+            'module' => 'imagecache',
+            'action' => 'imagecache_scale_and_crop',
+            'data' => [
+              'width' => '100%',
+              'height' => '100%',
+            ],
+          ],
+        ],
+      ],
+    ];
+
+    return $tests;
+  }
+
+}