function ConfigActionsTest::testPlaceBlockActionDoesNotChangeExistingBlock

Same name and namespace in other branches
  1. main core/modules/block/tests/src/Kernel/ConfigActionsTest.php \Drupal\Tests\block\Kernel\ConfigActionsTest::testPlaceBlockActionDoesNotChangeExistingBlock()

Verifies placeBlockInDefaultTheme action doesn't alter an existing block.

File

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

Class

ConfigActionsTest
Tests Config Actions.

Namespace

Drupal\Tests\block\Kernel

Code

public function testPlaceBlockActionDoesNotChangeExistingBlock() : void {
  $this->config('system.theme')
    ->set('default', 'default_admin')
    ->save();
  $extant_region = Block::load('default_admin_breadcrumbs')->getRegion();
  $this->assertNotSame('content', $extant_region);
  $this->configActionManager
    ->applyAction('placeBlockInDefaultTheme', 'block.block.default_admin_powered', [
    'plugin' => 'system_powered_by_block',
    'region' => [
      'default_admin' => 'content',
    ],
  ]);
  // The extant block should be unchanged.
  $this->assertSame($extant_region, Block::load('default_admin_breadcrumbs')->getRegion());
}

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