function LegacyBlockPluginIdTest::testConstruct

Tests legacy construction.

@expectedDeprecation Passing a migration process plugin as the fifth argument to Drupal\block\Plugin\migrate\process\BlockPluginId::__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/block/tests/src/Unit/Plugin/migrate/process/LegacyBlockPluginIdTest.php, line 39

Class

LegacyBlockPluginIdTest
Tests legacy usage of BlockPluginId.

Namespace

Drupal\Tests\block\Unit\Plugin\migrate\process

Code

public function testConstruct() {
    $process_plugin = $this->prophesize(MigrateProcessInterface::class);
    $process_plugin->transform(1, $this->migrateExecutable, $this->row, 'destination_property')
        ->willReturn(3);
    $block = $this->prophesize(BlockContent::class);
    $block->uuid()
        ->willReturn('123456789');
    $storage = $this->prophesize(EntityStorageInterface::class);
    $storage->load(3)
        ->willReturn($block->reveal());
    $plugin = new BlockPluginId([], '', [], $storage->reveal(), $process_plugin->reveal());
    $this->assertSame('block_content:123456789', $plugin->transform([
        'block',
        1,
    ], $this->migrateExecutable, $this->row, 'destination_property'));
}

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