function MigrationPluginManagerTest::testExpandPluginIds

Same name in other branches
  1. 11.x core/modules/migrate/tests/src/Unit/MigrationPluginManagerTest.php \Drupal\Tests\migrate\Unit\MigrationPluginManagerTest::testExpandPluginIds()

Tests that expandPluginIds returns all derivatives.

File

core/modules/migrate/tests/src/Unit/MigrationPluginManagerTest.php, line 74

Class

MigrationPluginManagerTest
@coversDefaultClass \Drupal\migrate\Plugin\MigrationPluginManager @group migrate

Namespace

Drupal\Tests\migrate\Unit

Code

public function testExpandPluginIds() : void {
    $backend = $this->prophesize(CacheBackendInterface::class);
    $cache = new \stdClass();
    $cache->data = [
        'a:a' => [
            'provider' => 'core',
        ],
        'a:b' => [
            'provider' => 'core',
        ],
        'b' => [
            'provider' => 'core',
        ],
    ];
    $backend->get('migration_plugins')
        ->willReturn($cache);
    $this->pluginManager
        ->setCacheBackend($backend->reveal(), 'migration_plugins');
    $plugin_ids = $this->pluginManager
        ->expandPluginIds([
        'b',
        'a',
    ]);
    $this->assertContains('a:a', $plugin_ids);
    $this->assertContains('a:b', $plugin_ids);
    $this->assertContains('b', $plugin_ids);
}

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