function MigrationTest::testMigrationDependenciesWithInvalidConfig

Same name and namespace in other branches
  1. 8.9.x core/modules/migrate/tests/src/Unit/MigrationTest.php \Drupal\Tests\migrate\Unit\MigrationTest::testMigrationDependenciesWithInvalidConfig()
  2. 10 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

File

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

Class

MigrationTest
@coversDefaultClass \Drupal\migrate\Plugin\Migration[[api-linebreak]]

Namespace

Drupal\Tests\migrate\Unit

Code

public function testMigrationDependenciesWithInvalidConfig() {
  $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', [
    'test_migration_dependency',
  ]);
  $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.