You are here

public function LegacyMigrationLookupTest::testCreateStubRow in Drupal 8

Tests ::createStubRow()

@covers ::createStubRow

@expectedDeprecation Drupal\migrate\Plugin\migrate\process\MigrationLookup::createStubRow is deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use the migrate.stub service to create stubs. See https://www.drupal.org/node/3047268

File

core/modules/migrate/tests/src/Unit/process/LegacyMigrationLookupTest.php, line 24

Class

LegacyMigrationLookupTest
Tests deprecated features of the migration lookup plugin.

Namespace

Drupal\Tests\migrate\Unit\process

Code

public function testCreateStubRow() {
  $this
    ->prepareContainer();
  $lookup = MigrationLookup::create($this
    ->prepareContainer(), [], '', [], $this
    ->prophesize(MigrationInterface::class)
    ->reveal());
  $method = new \ReflectionMethod($lookup, 'createStubRow');
  $method
    ->setAccessible(TRUE);

  /** @var \Drupal\migrate\Row $row */
  $row = $method
    ->invoke($lookup, [
    'id' => 1,
    'value' => 'test',
  ], [
    'id' => [
      'type' => 'integer',
    ],
  ]);
  $this
    ->assertTrue($row
    ->isStub());
  $this
    ->assertSame('test', $row
    ->get('value'));
}