function ConfigEntityImportTest::doBlockUpdate

Same name and namespace in other branches
  1. 11.x core/modules/system/tests/src/Kernel/Entity/ConfigEntityImportTest.php \Drupal\Tests\system\Kernel\Entity\ConfigEntityImportTest::doBlockUpdate()
  2. 10 core/modules/system/tests/src/Kernel/Entity/ConfigEntityImportTest.php \Drupal\Tests\system\Kernel\Entity\ConfigEntityImportTest::doBlockUpdate()
  3. 8.9.x core/modules/system/tests/src/Kernel/Entity/ConfigEntityImportTest.php \Drupal\Tests\system\Kernel\Entity\ConfigEntityImportTest::doBlockUpdate()

Tests updating a block during import.

File

core/modules/system/tests/src/Kernel/Entity/ConfigEntityImportTest.php, line 80

Class

ConfigEntityImportTest
Tests ConfigEntity importing.

Namespace

Drupal\Tests\system\Kernel\Entity

Code

protected function doBlockUpdate() {
  // Create a test block with a known label.
  $name = 'block.block.apple';
  $block = $this->placeBlock('system_powered_by_block', [
    'id' => 'apple',
    'label' => 'Red Delicious',
    'theme' => 'olivero',
  ]);
  $this->checkSinglePluginConfigSync($block, 'settings', 'label', 'Red Delicious');
  // Read the existing data, and prepare an altered version in sync.
  $custom_data = $original_data = $this->container
    ->get('config.storage')
    ->read($name);
  $custom_data['settings']['label'] = 'Granny Smith';
  $this->assertConfigUpdateImport($name, $original_data, $custom_data);
}

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