function MigrationTest::testMigrationDependenciesWithInvalidConfig

Tests that getting migration dependencies fails with invalid configuration.

@legacy-covers ::getMigrationDependencies

Attributes

#[DataProvider('getInvalidMigrationDependenciesProvider')] #[IgnoreDeprecations]

Parameters

array $dependencies: An array of migration dependencies.

File

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

Class

MigrationTest
Tests Drupal\migrate\Plugin\Migration.

Namespace

Drupal\Tests\migrate\Unit

Code

public function testMigrationDependenciesWithInvalidConfig(array $dependencies) : void {
  $migration = new TestMigration();
  // Set the plugin ID to test the returned message.
  $plugin_id = 'test_migration';
  $migration->setPluginId($plugin_id);
  // Migration dependencies expects ['optional' => []] or ['required' => []]].
  $migration->set('migration_dependencies', $dependencies);
  $this->expectException(InvalidPluginDefinitionException::class);
  $this->expectExceptionMessage("Invalid migration dependencies configuration for migration {$plugin_id}");
  $migration->getMigrationDependencies();
}

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