Version 1
[yaffs-website] / web / core / modules / contact / tests / src / Kernel / Plugin / migrate / source / ContactCategoryTest.php
diff --git a/web/core/modules/contact/tests/src/Kernel/Plugin/migrate/source/ContactCategoryTest.php b/web/core/modules/contact/tests/src/Kernel/Plugin/migrate/source/ContactCategoryTest.php
new file mode 100644 (file)
index 0000000..619e0cd
--- /dev/null
@@ -0,0 +1,57 @@
+<?php
+
+namespace Drupal\Tests\contact\Kernel\Plugin\migrate\source;
+
+use Drupal\Tests\migrate\Kernel\MigrateSqlSourceTestBase;
+
+/**
+ * Tests D6 contact category source plugin.
+ *
+ * @covers \Drupal\contact\Plugin\migrate\source\ContactCategory
+ * @group contact
+ */
+class ContactCategoryTest extends MigrateSqlSourceTestBase {
+
+  /**
+   * {@inheritdoc}
+   */
+  public static $modules = ['contact', 'migrate_drupal', 'user'];
+
+  /**
+   * {@inheritdoc}
+   */
+  public function providerSource() {
+    $tests = [
+      [
+        'source_data' => [],
+        'expected_data' => [],
+      ],
+    ];
+
+    $tests[0]['expected_data'] = [
+      [
+        'cid' => 1,
+        'category' => 'contact category value 1',
+        'recipients' => ['admin@example.com', 'user@example.com'],
+        'reply' => 'auto reply value 1',
+        'weight' => 0,
+        'selected' => 0,
+      ],
+      [
+        'cid' => 2,
+        'category' => 'contact category value 2',
+        'recipients' => ['admin@example.com', 'user@example.com'],
+        'reply' => 'auto reply value 2',
+        'weight' => 0,
+        'selected' => 0,
+      ],
+    ];
+
+    foreach ($tests[0]['expected_data'] as $k => $row) {
+      $row['recipients'] = implode(',', $row['recipients']);
+      $tests[0]['source_data']['contact'][$k] = $row;
+    }
+    return $tests;
+  }
+
+}