You are here

public function MigrationTest::testSkipOnEmpty in Drupal 8

Tests that processing is skipped when the input value is empty.

@expectedDeprecation Not passing the migrate lookup service as the fifth parameter to Drupal\migrate\Plugin\migrate\process\MigrationLookup::__construct is deprecated in drupal:8.8.0 and will throw a type error in drupal:9.0.0. Pass an instance of \Drupal\migrate\MigrateLookupInterface. See https://www.drupal.org/node/3047268 @expectedDeprecation Not passing the migrate stub service as the sixth parameter to Drupal\migrate\Plugin\migrate\process\MigrationLookup::__construct is deprecated in drupal:8.8.0 and will throw a type error in drupal:9.0.0. Pass an instance of \Drupal\migrate\MigrateStubInterface. See https://www.drupal.org/node/3047268

File

core/modules/migrate/tests/src/Unit/process/MigrationTest.php, line 110

Class

MigrationTest
@coversDefaultClass \Drupal\migrate\Plugin\migrate\process\Migration @group migrate @group legacy

Namespace

Drupal\Tests\migrate\Unit\process

Code

public function testSkipOnEmpty() {
  $configuration = [
    'migration' => 'foobaz',
  ];
  $this->migration_plugin
    ->id()
    ->willReturn(uniqid());
  $this->migration_plugin_manager
    ->createInstances([
    'foobaz',
  ])
    ->willReturn([
    'foobaz' => $this->migration_plugin
      ->reveal(),
  ]);
  $this
    ->prepareContainer();
  $migration = new Migration($configuration, 'migration', [], $this->migration_plugin
    ->reveal(), $this->migration_plugin_manager
    ->reveal(), $this->process_plugin_manager
    ->reveal());
  $this
    ->expectException(MigrateSkipProcessException::class);
  $migration
    ->transform(FALSE, $this->migrateExecutable, $this->row, 'foo');
}