function BlockConfigSchemaTest::testBlockConfigSchema

Same name in this branch
  1. 10 core/modules/block/tests/src/Kernel/BlockConfigSchemaTest.php \Drupal\Tests\block\Kernel\BlockConfigSchemaTest::testBlockConfigSchema()
Same name and namespace in other branches
  1. 9 core/modules/block/tests/src/Kernel/BlockConfigSchemaTest.php \Drupal\Tests\block\Kernel\BlockConfigSchemaTest::testBlockConfigSchema()
  2. 8.9.x core/modules/block/tests/src/Kernel/BlockConfigSchemaTest.php \Drupal\Tests\block\Kernel\BlockConfigSchemaTest::testBlockConfigSchema()
  3. 11.x core/modules/block/tests/src/Kernel/BlockConfigSchemaTest.php \Drupal\Tests\block\Kernel\BlockConfigSchemaTest::testBlockConfigSchema()
  4. 11.x core/modules/book/tests/src/Kernel/Block/BlockConfigSchemaTest.php \Drupal\Tests\book\Kernel\Block\BlockConfigSchemaTest::testBlockConfigSchema()

Tests the block config schema for block plugins.

File

core/modules/book/tests/src/Kernel/Block/BlockConfigSchemaTest.php, line 54

Class

BlockConfigSchemaTest
Tests the block config schema.

Namespace

Drupal\Tests\book\Kernel\Block

Code

public function testBlockConfigSchema() : void {
  $id = strtolower($this->randomMachineName());
  $block = Block::create([
    'id' => $id,
    'theme' => 'stark',
    'weight' => 00,
    'status' => TRUE,
    'region' => 'content',
    'plugin' => 'book_navigation',
    'settings' => [
      'label' => $this->randomMachineName(),
      'provider' => 'system',
      'label_display' => FALSE,
    ],
    'visibility' => [],
  ]);
  $block->save();
  $config = $this->config("block.block.{$id}");
  $this->assertEquals($id, $config->get('id'));
  $this->assertConfigSchema($this->typedConfig, $config->getName(), $config->get());
}

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