protected function BlockStorageUnitTest::deleteTests

Tests the deleting of blocks.

1 call to BlockStorageUnitTest::deleteTests()
BlockStorageUnitTest::testBlockCRUD in drupal/core/modules/block/lib/Drupal/block/Tests/BlockStorageUnitTest.php
Tests CRUD operations.

File

drupal/core/modules/block/lib/Drupal/block/Tests/BlockStorageUnitTest.php, line 184
Contains \Drupal\block\Tests\BlockStorageUnitTest.

Class

BlockStorageUnitTest
Tests the storage of blocks.

Namespace

Drupal\block\Tests

Code

protected function deleteTests() {
  $entities = $this->controller
    ->load(array(
    'stark.test_block',
  ));
  $entity = reset($entities);

  // 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.');
}