You are here

protected function BlockStorageUnitTest::deleteTests in Drupal 8

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

Tests the deleting of blocks.

1 call to BlockStorageUnitTest::deleteTests()
BlockStorageUnitTest::testBlockCRUD in core/modules/block/tests/src/Kernel/BlockStorageUnitTest.php
Tests CRUD operations.

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
    ->assertFalse(empty($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
    ->assertTrue(empty($config), 'There are no blocks in config storage.');
}