I’m trying to test a migration with a KernelTest, but I’m running into an issue when I try to load the migration plugin.
My migration is defined in my_module/migrations/my_migration.yml. In my KernelTest, I’ve listed my_module
and migrate
in the $modules
static property.
In a custom form, I use the following to load a migration plugin:
/** @var DrupalmigratePluginMigrationPluginManagerInterface $plugin_manager */ $plugin_manager = Drupal::service('plugin.manager.migration'); $migration = $plugin_manager ->createInstance('MY_MIGRATION'); // Next, create MigrateExecutable, etc...
However, when I use this same code in my KernelTest, $migration
is always FALSE
. I feel like this is because my migration is not loaded (?) when I enable my module in the test, but I’m not sure what to do about it. What am I missing here? How can I load my migration in the test?