function MigrationPluginManagerTest::testCreateInstancesByTag

Same name and namespace in other branches
  1. 10 core/modules/migrate/tests/src/Kernel/MigrationPluginManagerTest.php \Drupal\Tests\migrate\Kernel\MigrationPluginManagerTest::testCreateInstancesByTag()
  2. 11.x core/modules/migrate/tests/src/Kernel/MigrationPluginManagerTest.php \Drupal\Tests\migrate\Kernel\MigrationPluginManagerTest::testCreateInstancesByTag()

Tests Migration::createInstancesByTag().

@covers ::createInstancesByTag

@dataProvider providerCreateInstanceByTag

File

core/modules/migrate/tests/src/Kernel/MigrationPluginManagerTest.php, line 41

Class

MigrationPluginManagerTest
Tests the migration plugin manager.

Namespace

Drupal\Tests\migrate\Kernel

Code

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);
}

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