Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / modules / migrate / tests / src / Unit / process / MenuLinkParentTest.php
diff --git a/web/core/modules/migrate/tests/src/Unit/process/MenuLinkParentTest.php b/web/core/modules/migrate/tests/src/Unit/process/MenuLinkParentTest.php
new file mode 100644 (file)
index 0000000..e835436
--- /dev/null
@@ -0,0 +1,38 @@
+<?php
+
+namespace Drupal\Tests\migrate\Unit\process;
+
+use Drupal\Core\Entity\EntityStorageInterface;
+use Drupal\Core\Menu\MenuLinkManagerInterface;
+use Drupal\migrate\MigrateSkipRowException;
+use Drupal\migrate\Plugin\migrate\process\MenuLinkParent;
+use Drupal\migrate\Plugin\MigrateProcessInterface;
+
+/**
+ * Tests the menu link parent process plugin.
+ *
+ * @coversDefaultClass \Drupal\migrate\Plugin\migrate\process\MenuLinkParent
+ * @group migrate
+ */
+class MenuLinkParentTest extends MigrateProcessTestCase {
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function setUp() {
+    parent::setUp();
+    $migration_plugin = $this->prophesize(MigrateProcessInterface::class);
+    $menu_link_manager = $this->prophesize(MenuLinkManagerInterface::class);
+    $menu_link_storage = $this->prophesize(EntityStorageInterface::class);
+    $this->plugin = new MenuLinkParent([], 'map', [], $migration_plugin->reveal(), $menu_link_manager->reveal(), $menu_link_storage->reveal());
+  }
+
+  /**
+   * @covers ::transform
+   */
+  public function testTransformException() {
+    $this->setExpectedException(MigrateSkipRowException::class, "No parent link found for plid '1' in menu 'admin'.");
+    $this->plugin->transform([1, 'admin', NULL], $this->migrateExecutable, $this->row, 'destinationproperty');
+  }
+
+}