function MenuLinkParentTest::doTransform

Same name in other branches
  1. 10 core/modules/migrate/tests/src/Unit/process/MenuLinkParentTest.php \Drupal\Tests\migrate\Unit\process\MenuLinkParentTest::doTransform()
  2. 11.x core/modules/migrate/tests/src/Unit/process/MenuLinkParentTest.php \Drupal\Tests\migrate\Unit\process\MenuLinkParentTest::doTransform()

Helper to finish setup and run the test.

Parameters

string[] $source_value: The source value(s) for the migration process plugin.

string $plugin_id: The menu link plugin ID.

Return value

string The transformed menu link.

Throws

\Drupal\migrate\MigrateSkipRowException

1 call to MenuLinkParentTest::doTransform()
MenuLinkParentTest::testMenuLinkParent in core/modules/migrate/tests/src/Unit/process/MenuLinkParentTest.php
Tests the menu link content process plugin.

File

core/modules/migrate/tests/src/Unit/process/MenuLinkParentTest.php, line 206

Class

MenuLinkParentTest
Tests the menu link parent process plugin.

Namespace

Drupal\Tests\migrate\Unit\process

Code

public function doTransform(array $source_value, $plugin_id) {
    [
        $parent_id,
        $menu_name,
        $parent_link_path,
    ] = $source_value;
    $menu_link_content = $this->prophesize(MenuLinkContent::class);
    $menu_link_content->getPluginId()
        ->willReturn($plugin_id);
    $this->menuLinkStorage
        ->load($parent_id)
        ->willReturn($menu_link_content);
    $this->menuLinkStorage
        ->loadByProperties([
        'menu_name' => $menu_name,
        'link.uri' => $parent_link_path,
    ])
        ->willReturn([
        $parent_id => $menu_link_content,
    ]);
    $plugin = new MenuLinkParent([], 'menu_link', [], $this->migrateLookup
        ->reveal(), $this->menuLinkManager
        ->reveal(), $this->menuLinkStorage
        ->reveal(), $this->migration
        ->reveal());
    return $plugin->transform($source_value, $this->migrateExecutable, $this->row, 'destination');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.