function ConfigActionsTest::testEntityMethodActions

File

core/modules/block/tests/src/Kernel/ConfigActionsTest.php, line 49

Class

ConfigActionsTest
@covers \Drupal\block\Plugin\ConfigAction\PlaceBlock @covers \Drupal\block\Plugin\ConfigAction\PlaceBlockDeriver @group block

Namespace

Drupal\Tests\block\Kernel

Code

public function testEntityMethodActions() : void {
    $block = $this->placeBlock('system_messages_block', [
        'theme' => 'olivero',
    ]);
    $this->assertSame('content', $block->getRegion());
    $this->assertSame(0, $block->getWeight());
    $this->configActionManager
        ->applyAction('entity_method:block.block:setRegion', $block->getConfigDependencyName(), 'highlighted');
    $this->configActionManager
        ->applyAction('entity_method:block.block:setWeight', $block->getConfigDependencyName(), -10);
    $block = Block::load($block->id());
    $this->assertSame('highlighted', $block->getRegion());
    $this->assertSame(-10, $block->getWeight());
}

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