Skip to content
Snippets Groups Projects
Verified Commit b8667210 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3390693 by mikelutz, smustgrave:...

Issue #3390693 by mikelutz, smustgrave: MigrationPluginManager::ExpandPluginIds can lose derivative plugins under certain circumstances

(cherry picked from commit d5d6431e)
parent 5331d0e6
Branches
Tags
20 merge requests!8376Drupal views: adding more granularity to the ‘use ajax’ functionality,!8300Issue #3443586 View area displays even when parent view has no results.,!7567Issue #3153723 by quietone, Hardik_Patel_12: Change the scaffolding...,!7565Issue #3153723 by quietone, Hardik_Patel_12: Change the scaffolding...,!7509Change label "Block description" to "Block type",!7344Issue #3292350 by O'Briat, KlemenDEV, hswong3i, smustgrave, quietone: Update...,!6922Issue #3412959 by quietone, smustgrave, longwave: Fix 12 'un' words,!6848Issue #3417553 by longwave: Remove withConsecutive() in CacheCollectorTest,!6720Revert "Issue #3358581 by pfrenssen, _tarik_, a.dmitriiev, smustgrave:...,!6560Update ClaroPreRender.php, confirming classes provided are in array format,!6528Issue #3414261 by catch: Add authenticated user umami performance tests,!6501Issue #3263668 by omkar-pd, Wim Leers, hooroomoo: Re-enable inline form errors...,!6354Draft: Issue #3380392 by phma: Updating language weight from the overview reverts label if translated,!6324Issue #3416723 by Ludo.R: Provide a "node type" views default argument,!6119Issue #3405704 by Spokje, longwave: symfony/psr-http-message-bridge major version bump,!5950Issue #3403653 by alexpott, longwave: Incorporate improvements to how contrib runs PHPStan to core,!5858Issue #3401971 by fjgarlin: Test-only job shouldn't require constant rebases...,!5716Draft: Issue #3401102 by Spokje, longwave, smustgrave: Nightwatch artifacts on GitLab not retained,!5674Transaction autocommit during shutdown relies on unreliable object destruction order,!5644Issue #3395563 by nireneko, marvil07, lauriii, borisson_, smustgrave, Wim...
Pipeline #52563 passed
Pipeline: drupal

#52565

    ......@@ -145,7 +145,7 @@ public function expandPluginIds(array $migration_ids) {
    $plugin_ids = [];
    $all_ids = array_keys($this->getDefinitions());
    foreach ($migration_ids as $id) {
    $plugin_ids += preg_grep('/^' . preg_quote($id, '/') . PluginBase::DERIVATIVE_SEPARATOR . '/', $all_ids);
    $plugin_ids = array_merge($plugin_ids, preg_grep('/^' . preg_quote($id, '/') . PluginBase::DERIVATIVE_SEPARATOR . '/', $all_ids));
    if ($this->hasDefinition($id)) {
    $plugin_ids[] = $id;
    }
    ......
    ......@@ -2,6 +2,7 @@
    namespace Drupal\Tests\migrate\Unit;
    use Drupal\Core\Cache\CacheBackendInterface;
    use Drupal\migrate\Plugin\Migration;
    use Drupal\migrate\Plugin\MigrationPluginManager;
    use Drupal\Tests\UnitTestCase;
    ......@@ -65,6 +66,25 @@ public function testDependencyBuilding($migrations_data, $result_ids) {
    }
    }
    /**
    * Tests that expandPluginIds returns all derivatives.
    */
    public function testExpandPluginIds() {
    $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);
    }
    /**
    * Provide dependency data for testing.
    */
    ......
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Please register or to comment