You are here

public function BlockTest::testUninstallTheme in Zircon Profile 8

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

Tests that uninstalling a theme removes its block configuration.

File

core/modules/block/src/Tests/BlockTest.php, line 435
Contains \Drupal\block\Tests\BlockTest.

Class

BlockTest
Tests basic block functionality.

Namespace

Drupal\block\Tests

Code

public function testUninstallTheme() {

  /** @var \Drupal\Core\Extension\ThemeHandlerInterface $theme_handler */
  $theme_handler = \Drupal::service('theme_handler');
  $theme_handler
    ->install([
    'seven',
  ]);
  $theme_handler
    ->setDefault('seven');
  $block = $this
    ->drupalPlaceBlock('system_powered_by_block', [
    'theme' => 'seven',
    'region' => 'help',
  ]);
  $this
    ->drupalGet('<front>');
  $this
    ->assertText('Powered by Drupal');
  $theme_handler
    ->setDefault('classy');
  $theme_handler
    ->uninstall([
    'seven',
  ]);

  // Ensure that the block configuration does not exist anymore.
  $this
    ->assertIdentical(NULL, Block::load($block
    ->id()));
}