Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / modules / migrate / tests / src / Unit / Plugin / migrate / destination / EntityTestBase.php
diff --git a/web/core/modules/migrate/tests/src/Unit/Plugin/migrate/destination/EntityTestBase.php b/web/core/modules/migrate/tests/src/Unit/Plugin/migrate/destination/EntityTestBase.php
new file mode 100644 (file)
index 0000000..a2dd7c6
--- /dev/null
@@ -0,0 +1,78 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\Tests\migrate\Unit\Plugin\migrate\destination\EntityTestBase
+ */
+
+namespace Drupal\Tests\migrate\Unit\Plugin\migrate\destination;
+
+use Drupal\Core\Entity\EntityManagerInterface;
+use Drupal\Core\Entity\EntityStorageInterface;
+use Drupal\Core\Entity\EntityTypeInterface;
+use Drupal\Core\Field\BaseFieldDefinition;
+use Drupal\migrate\Plugin\MigrationInterface;
+use Drupal\Tests\UnitTestCase;
+
+/**
+ * Base test class forentity migration destination functionality.
+ */
+class EntityTestBase extends UnitTestCase {
+
+  /**
+   * @var \Drupal\migrate\Plugin\MigrationInterface
+   */
+  protected $migration;
+
+  /**
+   * @var \Drupal\Core\Entity\EntityStorageInterface
+   */
+  protected $storage;
+
+  /**
+   * @var \Drupal\Core\Entity\EntityTypeInterface
+   */
+  protected $entityType;
+
+  /**
+   * @var \Drupal\Core\Entity\EntityManagerInterface
+   */
+  protected $entityManager;
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function setUp() {
+    parent::setUp();
+
+    $this->migration = $this->prophesize(MigrationInterface::class);
+    $this->storage = $this->prophesize(EntityStorageInterface::class);
+
+    $this->entityType = $this->prophesize(EntityTypeInterface::class);
+    $this->entityType->getPluralLabel()->willReturn('wonkiness');
+    $this->storage->getEntityType()->willReturn($this->entityType->reveal());
+    $this->storage->getEntityTypeId()->willReturn('foo');
+
+    $this->entityManager = $this->prophesize(EntityManagerInterface::class);
+  }
+
+}
+
+/**
+ * Stub class for BaseFieldDefinition.
+ */
+class BaseFieldDefinitionTest extends BaseFieldDefinition {
+
+  public static function create($type) {
+    return new static([]);
+  }
+
+  public function getSettings() {
+    return [];
+  }
+
+  public function getType() {
+    return 'integer';
+  }
+
+}