function BlockValidationTest::setLabel

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

Overrides ConfigEntityValidationTestBase::setLabel

1 call to BlockValidationTest::setLabel()
BlockValidationTest::testLabelValidation in core/modules/block/tests/src/Kernel/BlockValidationTest.php
Tests validation of config entity's label.

File

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

Class

BlockValidationTest
Tests validation of block entities.

Namespace

Drupal\Tests\block\Kernel

Code

protected static function setLabel(ConfigEntityInterface $block, string $label) : void {
    static::assertInstanceOf(Block::class, $block);
    $settings = $block->get('settings');
    static::assertNotEmpty($settings['label']);
    $settings['label'] = $label;
    $block->set('settings', $settings);
}

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