function I18nQueryTraitTest::testMigrateSourcePluginUsingI18nQueryTraitDiscovery

Same name and namespace in other branches
  1. 11.x core/modules/migrate_drupal/tests/src/Kernel/I18nQueryTraitTest.php \Drupal\Tests\migrate_drupal\Kernel\I18nQueryTraitTest::testMigrateSourcePluginUsingI18nQueryTraitDiscovery()

Tests instantiating migrate source plugins using I18nQueryTrait.

I18nQueryTrait was originally in the content_translation module, which could lead to fatal errors instantiating the source plugins that use it when the content_translation module was not installed.

Attributes

#[DataProvider('providerI18nQueryTraitPlugins')]

Parameters

string $plugin_id: The ID of a Migrate source plugin that uses I18nQueryTrait.

File

core/modules/migrate_drupal/tests/src/Kernel/I18nQueryTraitTest.php, line 42

Class

I18nQueryTraitTest
Tests instantiating migrate source plugins using I18nQueryTrait.

Namespace

Drupal\Tests\migrate_drupal\Kernel

Code

public function testMigrateSourcePluginUsingI18nQueryTraitDiscovery(string $plugin_id) : void {
  // Namespace for uninstalled module content_translation needs to be removed
  // for this test.
  $this->disablePsr4ForUninstalledModules([
    'content_translation',
  ]);
  $migration = $this->createMock(MigrationInterface::class);
  $this->assertInstanceOf(SourcePluginBase::class, \Drupal::service('plugin.manager.migrate.source')->createInstance($plugin_id, [], $migration));
}

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