function MenuLinkParentTest::testTransformExternal
Tests the plugin when the parent is an external link.
@covers ::transform
File
-
core/
modules/ migrate/ tests/ src/ Unit/ process/ MenuLinkParentTest.php, line 83
Class
- MenuLinkParentTest
- Tests the menu link parent process plugin.
Namespace
Drupal\Tests\migrate\Unit\processCode
public function testTransformExternal() {
$menu_link_content = $this->prophesize(MenuLinkContentInterface::class);
$menu_link_content->getPluginId()
->willReturn('menu_link_content:fe151460-dfa2-4133-8864-c1746f28ab27');
$this->menuLinkStorage
->loadByProperties([
'link__uri' => 'http://example.com',
])
->willReturn([
9054 => $menu_link_content,
]);
$plugin = $this->prophesize(PluginInspectionInterface::class);
$this->menuLinkManager
->createInstance('menu_link_content:fe151460-dfa2-4133-8864-c1746f28ab27')
->willReturn($plugin->reveal());
$plugin = new MenuLinkParent([], 'map', [], $this->migrateLookup
->reveal(), $this->menuLinkManager
->reveal(), $this->menuLinkStorage
->reveal(), $this->migration
->reveal());
$result = $plugin->transform([
1,
'admin',
'http://example.com',
], $this->migrateExecutable, $this->row, 'destination_property');
$this->assertEquals('menu_link_content:fe151460-dfa2-4133-8864-c1746f28ab27', $result);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.