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
1 <?php
2
3 namespace Drupal\Tests\migrate\Unit\process;
4
5 use Drupal\Core\Entity\EntityStorageInterface;
6 use Drupal\Core\Menu\MenuLinkManagerInterface;
7 use Drupal\migrate\MigrateSkipRowException;
8 use Drupal\migrate\Plugin\migrate\process\MenuLinkParent;
9 use Drupal\migrate\Plugin\MigrateProcessInterface;
10
11 /**
12  * Tests the menu link parent process plugin.
13  *
14  * @coversDefaultClass \Drupal\migrate\Plugin\migrate\process\MenuLinkParent
15  * @group migrate
16  */
17 class MenuLinkParentTest extends MigrateProcessTestCase {
18
19   /**
20    * {@inheritdoc}
21    */
22   protected function setUp() {
23     parent::setUp();
24     $migration_plugin = $this->prophesize(MigrateProcessInterface::class);
25     $menu_link_manager = $this->prophesize(MenuLinkManagerInterface::class);
26     $menu_link_storage = $this->prophesize(EntityStorageInterface::class);
27     $this->plugin = new MenuLinkParent([], 'map', [], $migration_plugin->reveal(), $menu_link_manager->reveal(), $menu_link_storage->reveal());
28   }
29
30   /**
31    * @covers ::transform
32    */
33   public function testTransformException() {
34     $this->setExpectedException(MigrateSkipRowException::class, "No parent link found for plid '1' in menu 'admin'.");
35     $this->plugin->transform([1, 'admin', NULL], $this->migrateExecutable, $this->row, 'destinationproperty');
36   }
37
38 }