function ConfigActionsTest::testPlaceBlockInStaticRegion

@testWith ["placeBlockInDefaultTheme", "olivero"]
["placeBlockInAdminTheme", "claro"]

File

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

Class

ConfigActionsTest
@covers \Drupal\block\Plugin\ConfigAction\PlaceBlock[[api-linebreak]] @covers \Drupal\block\Plugin\ConfigAction\PlaceBlockDeriver[[api-linebreak]] @group block

Namespace

Drupal\Tests\block\Kernel

Code

public function testPlaceBlockInStaticRegion(string $action, string $expected_theme) : void {
  $this->configActionManager
    ->applyAction($action, 'block.block.test_block', [
    'plugin' => 'system_powered_by_block',
    'region' => 'content',
  ]);
  $block = Block::load('test_block');
  $this->assertInstanceOf(Block::class, $block);
  $this->assertSame('system_powered_by_block', $block->getPluginId());
  $this->assertSame($expected_theme, $block->getTheme());
  $this->assertSame('content', $block->getRegion());
}

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