Version 1
[yaffs-website] / web / core / modules / migrate_drupal / tests / src / Kernel / Plugin / migrate / source / VariableMultiRowTest.php
diff --git a/web/core/modules/migrate_drupal/tests/src/Kernel/Plugin/migrate/source/VariableMultiRowTest.php b/web/core/modules/migrate_drupal/tests/src/Kernel/Plugin/migrate/source/VariableMultiRowTest.php
new file mode 100644 (file)
index 0000000..932af99
--- /dev/null
@@ -0,0 +1,57 @@
+<?php
+
+namespace Drupal\Tests\migrate_drupal\Kernel\Plugin\migrate\source;
+
+use Drupal\Tests\migrate\Kernel\MigrateSqlSourceTestBase;
+
+/**
+ * Tests the variable multirow source plugin.
+ *
+ * @covers \Drupal\migrate_drupal\Plugin\migrate\source\VariableMultiRow
+ *
+ * @group migrate_drupal
+ */
+class VariableMultiRowTest extends MigrateSqlSourceTestBase {
+
+  /**
+   * {@inheritdoc}
+   */
+  public static $modules = ['migrate_drupal'];
+
+  /**
+   * {@inheritdoc}
+   */
+  public function providerSource() {
+    $tests = [];
+
+    // The source data.
+    $tests[0]['source_data']['variable'] = [
+      ['name' => 'foo', 'value' => 'i:1;'],
+      ['name' => 'bar', 'value' => 'b:0;'],
+    ];
+
+    // The expected results.
+    $tests[0]['expected_data'] = [
+      [
+        'name' => 'foo',
+        'value' => 1,
+      ],
+      [
+        'name' => 'bar',
+        'value' => FALSE,
+      ],
+    ];
+
+    // The expected count.
+    $tests[0]['expected_count'] = NULL;
+
+    // The source plugin configuration.
+    $tests[0]['configuration']['variables'] = [
+      'foo',
+      'bar',
+    ];
+
+    return $tests;
+  }
+
+}