function BlockValidationTest::testInvalidPluginId

Same name in other branches
  1. 11.x core/modules/block/tests/src/Kernel/BlockValidationTest.php \Drupal\Tests\block\Kernel\BlockValidationTest::testInvalidPluginId()

Tests validating a block with an unknown plugin ID.

File

core/modules/block/tests/src/Kernel/BlockValidationTest.php, line 44

Class

BlockValidationTest
Tests validation of block entities.

Namespace

Drupal\Tests\block\Kernel

Code

public function testInvalidPluginId() : void {
    $this->entity
        ->set('plugin', 'block_content:d7c9d8ba-663f-41b4-8756-86bc55c44653');
    // Block config entities with invalid block plugin IDs automatically fall
    // back to the `broken` block plugin.
    // @see https://www.drupal.org/node/2249303
    // @see \Drupal\Core\Block\BlockManager::getFallbackPluginId()
    // @see \Drupal\Core\Block\Plugin\Block\Broken
    $this->assertValidationErrors([]);
    $this->entity
        ->set('plugin', 'non_existent');
    // @todo Expect error for this in https://www.drupal.org/project/drupal/issues/3377709
    $this->assertValidationErrors([]);
}

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