Properly check for block content type in BlockPluginId process plugin

Created on 4 January 2023, almost 2 years ago
Updated 23 October 2023, about 1 year ago

Problem/Motivation

Running the d7_block migration without block_content installed results in an exception: Drupal\Component\Plugin\Exception\PluginNotFoundException: The "block_content" entity type does not exist.

Steps to reproduce

  1. Create a new file at core/modules/block/tests/src/Kernel/IssueTest.php with the following code:
    
    namespace Drupal\Tests\block\Kernel;
    
    use Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase;
    
    /**
     * @group block
     */
    class IssueTest extends MigrateDrupal7TestBase {
    
      /**
       * {@inheritdoc}
       */
      protected static $modules = ['block'];
    
      /**
       * {@inheritdoc}
       */
      protected function setUp(): void {
        parent::setUp();
        $this->executeMigration('d7_block');
      }
    
      /**
       * Test.
       */
      public function testIssue() {
      }
    
    }
    
  2. Run this test class.
  3. Observe the aforementioned exception is present.

The original commit was #2250429: d6_block migration not migrating all blocks β†’

Proposed resolution

Add the block_content module if it is installed.

This issue is using a patch workflow.

Remaining tasks

Commit

User interface changes

None.

API changes

Argument 4 of Drupal\block\Plugin\migrate\process\BlockPluginId::_construct can be null

Data model changes

None.

Release notes snippet

None.

πŸ› Bug report
Status

Fixed

Version

10.1 ✨

Component
MigrationΒ  β†’

Last updated about 12 hours ago

Created by

πŸ‡¬πŸ‡§United Kingdom Wongjn

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024