You are here

protected function BlockStorageUnitTest::deleteTests in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/block/tests/src/Kernel/BlockStorageUnitTest.php \Drupal\Tests\block\Kernel\BlockStorageUnitTest::deleteTests()
  2. 9 core/modules/block/tests/src/Kernel/BlockStorageUnitTest.php \Drupal\Tests\block\Kernel\BlockStorageUnitTest::deleteTests()

Tests the deleting of blocks.

File

core/modules/block/tests/src/Kernel/BlockStorageUnitTest.php, line 126

Class

BlockStorageUnitTest
Tests the storage of blocks.

Namespace

Drupal\Tests\block\Kernel

Code

protected function deleteTests() {
  $entity = $this->controller
    ->load('test_block');

  // Ensure that the storage isn't currently empty.
  $config_storage = $this->container
    ->get('config.storage');
  $config = $config_storage
    ->listAll('block.block.');
  $this
    ->assertNotEmpty($config, 'There are blocks in config storage.');

  // Delete the block.
  $entity
    ->delete();

  // Ensure that the storage is now empty.
  $config = $config_storage
    ->listAll('block.block.');
  $this
    ->assertEmpty($config, 'There are no blocks in config storage.');
}