You are here

public function BlockStorageUnitTest::testDefaultBlocks in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/block/src/Tests/BlockStorageUnitTest.php \Drupal\block\Tests\BlockStorageUnitTest::testDefaultBlocks()

Tests the installation of default blocks.

File

core/modules/block/src/Tests/BlockStorageUnitTest.php, line 147
Contains \Drupal\block\Tests\BlockStorageUnitTest.

Class

BlockStorageUnitTest
Tests the storage of blocks.

Namespace

Drupal\block\Tests

Code

public function testDefaultBlocks() {
  \Drupal::service('theme_handler')
    ->install([
    'classy',
  ]);
  $entities = $this->controller
    ->loadMultiple();
  $this
    ->assertTrue(empty($entities), 'There are no blocks initially.');

  // Install the block_test.module, so that its default config is installed.
  $this
    ->installConfig(array(
    'block_test',
  ));
  $entities = $this->controller
    ->loadMultiple();
  $entity = reset($entities);
  $this
    ->assertEqual($entity
    ->id(), 'test_block', 'The default test block was loaded.');
}