function BlockStorageUnitTest::deleteTests

Same name in other branches
  1. 8.9.x 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()
  3. 11.x 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 129

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

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