class MigrationPluginManagerTest
Same name in this branch
- 9 core/modules/migrate/tests/src/Unit/MigrationPluginManagerTest.php \Drupal\Tests\migrate\Unit\MigrationPluginManagerTest
Same name and namespace in other branches
- 11.x core/modules/migrate/tests/src/Unit/MigrationPluginManagerTest.php \Drupal\Tests\migrate\Unit\MigrationPluginManagerTest
- 11.x core/modules/migrate/tests/src/Kernel/MigrationPluginManagerTest.php \Drupal\Tests\migrate\Kernel\MigrationPluginManagerTest
Tests the migration plugin manager.
@group migrate
@coversDefaultClass \Drupal\migrate\Plugin\MigrationPluginManager
Hierarchy
- class \Drupal\KernelTests\KernelTestBase extends \Drupal\Core\DependencyInjection\ServiceProviderInterface uses \Drupal\KernelTests\AssertLegacyTrait, \Drupal\KernelTests\AssertContentTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\ExtensionListTestTrait, \Drupal\Tests\TestRequirementsTrait, \Drupal\Tests\Traits\PhpUnitWarnings, \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait implements \PHPUnit\Framework\TestCase
- class \Drupal\Tests\migrate\Kernel\MigrateTestBase extends \Drupal\migrate\MigrateMessageInterface implements \Drupal\KernelTests\KernelTestBase
- class \Drupal\Tests\migrate\Kernel\MigrationPluginManagerTest implements \Drupal\Tests\migrate\Kernel\MigrateTestBase
- class \Drupal\Tests\migrate\Kernel\MigrateTestBase extends \Drupal\migrate\MigrateMessageInterface implements \Drupal\KernelTests\KernelTestBase
Expanded class hierarchy of MigrationPluginManagerTest
File
-
core/
modules/ migrate/ tests/ src/ Kernel/ MigrationPluginManagerTest.php, line 12
Namespace
Drupal\Tests\migrate\KernelView source
class MigrationPluginManagerTest extends MigrateTestBase {
/**
* {@inheritdoc}
*/
protected static $modules = [
'migrate',
'migrate_tag_test',
];
/**
* The migration plugin manager.
*
* @var \Drupal\migrate\Plugin\MigrationPluginManager
*/
protected $migrationPluginManager;
/**
* {@inheritdoc}
*/
public function setUp() : void {
parent::setUp();
$this->migrationPluginManager = \Drupal::service('plugin.manager.migration');
}
/**
* Tests Migration::createInstancesByTag().
*
* @covers ::createInstancesByTag
*
* @dataProvider providerCreateInstanceByTag
*/
public function testCreateInstancesByTag($tags, $expected) {
// The test module includes a migration that does not use the migration_tags
// property. It is there to confirm that it is not included in the results.
// We create it to ensure it is a valid migration.
$migration = $this->migrationPluginManager
->createInstances([
'tag_test_no_tag',
]);
$this->assertArrayHasKey('tag_test_no_tag', $migration);
$migrations = $this->migrationPluginManager
->createInstancesByTag($tags);
$actual = array_keys($migrations);
$this->assertSame($expected, $actual);
}
/**
* Data provider for testCreateInstancesByTag.
*/
public function providerCreateInstanceByTag() {
return [
'get test' => [
'test',
[
'tag_test_0',
'tag_test_1',
],
],
'get tag_test_1' => [
'tag_test_1',
[
'tag_test_1',
],
],
'get no tags' => [
'',
[],
],
];
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.