You are here

public function BlockConfigSchemaTest::testBlockConfigSchema in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/block/src/Tests/BlockConfigSchemaTest.php \Drupal\block\Tests\BlockConfigSchemaTest::testBlockConfigSchema()

Tests the block config schema for block plugins.

File

core/modules/block/src/Tests/BlockConfigSchemaTest.php, line 73
Contains \Drupal\block\Tests\BlockConfigSchemaTest.

Class

BlockConfigSchemaTest
Tests the block config schema.

Namespace

Drupal\block\Tests

Code

public function testBlockConfigSchema() {
  foreach ($this->blockManager
    ->getDefinitions() as $block_id => $definition) {
    $id = strtolower($this
      ->randomMachineName());
    $block = Block::create(array(
      'id' => $id,
      'theme' => 'classy',
      'weight' => 00,
      'status' => TRUE,
      'region' => 'content',
      'plugin' => $block_id,
      'settings' => array(
        'label' => $this
          ->randomMachineName(),
        'provider' => 'system',
        'label_display' => FALSE,
      ),
      'visibility' => array(),
    ));
    $block
      ->save();
    $config = $this
      ->config("block.block.{$id}");
    $this
      ->assertEqual($config
      ->get('id'), $id);
    $this
      ->assertConfigSchema($this->typedConfig, $config
      ->getName(), $config
      ->get());
  }
}