You are here

public function KernelTestBaseTest::testEnableModulesTheme in SimpleTest 8.3

Tests that ThemeManager works right after loading a module.

File

src/Tests/KernelTestBaseTest.php, line 294

Class

KernelTestBaseTest
Tests KernelTestBase functionality.

Namespace

Drupal\simpletest\Tests

Code

public function testEnableModulesTheme() {

  /** @var \Drupal\Core\Render\RendererInterface $renderer */
  $renderer = $this->container
    ->get('renderer');
  $original_element = $element = [
    '#type' => 'container',
    '#markup' => 'Foo',
    '#attributes' => [],
  ];
  $this
    ->enableModules([
    'system',
  ]);

  // \Drupal\Core\Theme\ThemeManager::render() throws an exception if modules
  // are not loaded yet.
  $this
    ->assertTrue($renderer
    ->renderRoot($element));
  $element = $original_element;
  $this
    ->disableModules([
    'entity_test',
  ]);
  $this
    ->assertTrue($renderer
    ->renderRoot($element));
}