function SubProcessWithSkipTest::testSubProcessSkip

Same name and namespace in other branches
  1. 10 core/modules/migrate/tests/src/Kernel/process/SubProcessWithSkipTest.php \Drupal\Tests\migrate\Kernel\process\SubProcessWithSkipTest::testSubProcessSkip()

Test use of skip_on_empty within sub_process.

@dataProvider providerTestSubProcessSkip

Parameters

string $method: The method to use with skip_on_empty (row or process).

array $expected_data: The expected result of the migration.

File

core/modules/migrate/tests/src/Kernel/process/SubProcessWithSkipTest.php, line 93

Class

SubProcessWithSkipTest
Tests process pipelines when a sub_process skips a row or process.

Namespace

Drupal\Tests\migrate\Kernel\process

Code

public function testSubProcessSkip(string $method, array $expected_data) : void {
    $definition = $this->getDefinition();
    $definition['process']['second']['process']['prop_1'][0]['method'] = $method;
    $migration = \Drupal::service('plugin.manager.migration')->createStubMigration($definition);
    $executable = new MigrateExecutable($migration);
    $result = $executable->import();
    // Migration needs to succeed before further assertions are made.
    $this->assertSame(MigrationInterface::RESULT_COMPLETED, $result);
    // Compare with expected data.
    $this->assertEquals($expected_data, \Drupal::config('migrate_test.settings')->get());
}

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