function MigrationTest::testMigrationDependenciesWithInvalidConfig

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

Tests that getting migration dependencies fails with invalid configuration.

@covers ::getMigrationDependencies

@dataProvider getInvalidMigrationDependenciesProvider

@group legacy

Parameters

array $dependencies: An array of migration dependencies.

File

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

Class

MigrationTest
@coversDefaultClass \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' => []]].
    $this->expectDeprecation("Invalid migration dependencies for {$plugin_id} is deprecated in drupal:10.1.0 and will cause an error in drupal:11.0.0. See https://www.drupal.org/node/3266691");
    $migration->set('migration_dependencies', $dependencies);
    $this->expectException(InvalidPluginDefinitionException::class);
    $this->expectExceptionMessage("Invalid migration dependencies configuration for migration {$plugin_id}");
    $migration->getMigrationDependencies(TRUE);
}

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