function MigrationTest::testMigrationDependenciesWithValidConfig

Same name in other branches
  1. 9 core/modules/migrate/tests/src/Unit/MigrationTest.php \Drupal\Tests\migrate\Unit\MigrationTest::testMigrationDependenciesWithValidConfig()
  2. 8.9.x core/modules/migrate/tests/src/Unit/MigrationTest.php \Drupal\Tests\migrate\Unit\MigrationTest::testMigrationDependenciesWithValidConfig()
  3. 11.x core/modules/migrate/tests/src/Unit/MigrationTest.php \Drupal\Tests\migrate\Unit\MigrationTest::testMigrationDependenciesWithValidConfig()

Tests valid migration dependencies configuration returns expected values.

@covers ::getMigrationDependencies @dataProvider getValidMigrationDependenciesProvider

Parameters

array|null $source: The migration dependencies configuration being tested.

array $expected_value: The migration dependencies configuration array expected.

Throws

\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException

File

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

Class

MigrationTest
@coversDefaultClass \Drupal\migrate\Plugin\Migration

Namespace

Drupal\Tests\migrate\Unit

Code

public function testMigrationDependenciesWithValidConfig($source, array $expected_value) : void {
    $migration = new TestMigration();
    // Set the plugin manager to support getMigrationDependencies().
    $plugin_manager = $this->createMock('Drupal\\migrate\\Plugin\\MigrationPluginManagerInterface');
    $migration->setMigrationPluginManager($plugin_manager);
    $plugin_manager->expects($this->exactly(2))
        ->method('expandPluginIds')
        ->willReturnArgument(0);
    if (!is_null($source)) {
        $migration->set('migration_dependencies', $source);
    }
    $this->assertSame($migration->getMigrationDependencies(TRUE), $expected_value);
}

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