Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / web / core / modules / statistics / tests / src / Kernel / Plugin / migrate / source / NodeCounterTest.php
diff --git a/web/core/modules/statistics/tests/src/Kernel/Plugin/migrate/source/NodeCounterTest.php b/web/core/modules/statistics/tests/src/Kernel/Plugin/migrate/source/NodeCounterTest.php
new file mode 100644 (file)
index 0000000..0cbc76a
--- /dev/null
@@ -0,0 +1,67 @@
+<?php
+
+namespace Drupal\Tests\statistics\Kernel\Plugin\migrate\source;
+
+use Drupal\Tests\migrate\Kernel\MigrateSqlSourceTestBase;
+
+/**
+ * Tests the node_counter source plugin.
+ *
+ * @covers \Drupal\statistics\Plugin\migrate\source\NodeCounter
+ *
+ * @group statistics
+ */
+class NodeCounterTest extends MigrateSqlSourceTestBase {
+
+  /**
+   * {@inheritdoc}
+   */
+  public static $modules = ['migrate_drupal', 'statistics'];
+
+  /**
+   * {@inheritdoc}
+   */
+  public function providerSource() {
+    $tests = [];
+
+    // The source data.
+    $tests[0]['source_data']['node_counter'] = [
+      [
+        'nid' => 1,
+        'totalcount' => 2,
+        'daycount' => 0,
+        'timestamp' => 1421727536,
+      ],
+      [
+        'nid' => 2,
+        'totalcount' => 1,
+        'daycount' => 0,
+        'timestamp' => 1471428059,
+      ],
+      [
+        'nid' => 3,
+        'totalcount' => 1,
+        'daycount' => 0,
+        'timestamp' => 1471428153,
+      ],
+      [
+        'nid' => 4,
+        'totalcount' => 1,
+        'daycount' => 1,
+        'timestamp' => 1478755275,
+      ],
+      [
+        'nid' => 5,
+        'totalcount' => 1,
+        'daycount' => 1,
+        'timestamp' => 1478755314,
+      ],
+    ];
+
+    // The expected results.
+    $tests[0]['expected_data'] = $tests[0]['source_data']['node_counter'];
+
+    return $tests;
+  }
+
+}