function BlockConfigSchemaTest::testBlockConfigSchema

Same name in this branch
  1. 11.x 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. 10 core/modules/block/tests/src/Kernel/BlockConfigSchemaTest.php \Drupal\Tests\block\Kernel\BlockConfigSchemaTest::testBlockConfigSchema()
  4. 10 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 52

Class

BlockConfigSchemaTest
Tests the block config schema.

Namespace

Drupal\Tests\book\Kernel\Block

Code

public function testBlockConfigSchema() {
    $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.