public function MenuLinkParentTest::testLegacyTransformExternal in Drupal 8
Tests the plugin when the parent is an external link.
@covers ::transform
@group legacy
@expectedDeprecation Passing a migration process plugin as the fourth argument to Drupal\migrate\Plugin\migrate\process\MenuLinkParent::__construct is deprecated in drupal:8.8.0 and will throw an error in drupal:9.0.0. Pass the migrate.lookup service instead. See https://www.drupal.org/node/3047268
File
- core/
modules/ migrate/ tests/ src/ Unit/ process/ MenuLinkParentTest.php, line 108
Class
- MenuLinkParentTest
- Tests the menu link parent process plugin.
Namespace
Drupal\Tests\migrate\Unit\processCode
public function testLegacyTransformExternal() {
$migration_plugin = $this
->prophesize(MigrateProcessInterface::class);
$menu_link_manager = $this
->prophesize(MenuLinkManagerInterface::class);
$menu_link_storage = $this
->prophesize(EntityStorageInterface::class);
$menu_link_content = $this
->prophesize(MenuLinkContentInterface::class);
$menu_link_content
->getPluginId()
->willReturn('menu_link_content:fe151460-dfa2-4133-8864-c1746f28ab27');
$menu_link_storage
->loadByProperties([
'link__uri' => 'http://example.com',
])
->willReturn([
9054 => $menu_link_content,
]);
$plugin = $this
->prophesize(PluginInspectionInterface::class);
$menu_link_manager
->createInstance('menu_link_content:fe151460-dfa2-4133-8864-c1746f28ab27')
->willReturn($plugin
->reveal());
$plugin = new MenuLinkParent([], 'map', [], $migration_plugin
->reveal(), $menu_link_manager
->reveal(), $menu_link_storage
->reveal());
$result = $plugin
->transform([
1,
'admin',
'http://example.com',
], $this->migrateExecutable, $this->row, 'destinationproperty');
$this
->assertEquals('menu_link_content:fe151460-dfa2-4133-8864-c1746f28ab27', $result);
}