You are here

function KernelTestBaseTest::testEnableModulesTheme in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/modules/simpletest/src/Tests/KernelTestBaseTest.php \Drupal\simpletest\Tests\KernelTestBaseTest::testEnableModulesTheme()

Tests that _theme() works right after loading a module.

File

core/modules/simpletest/src/Tests/KernelTestBaseTest.php, line 295
Contains \Drupal\simpletest\Tests\KernelTestBaseTest.

Class

KernelTestBaseTest
Tests KernelTestBase functionality.

Namespace

Drupal\simpletest\Tests

Code

function testEnableModulesTheme() {

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

  // _theme() throws an exception if modules are not loaded yet.
  $this
    ->assertTrue($renderer
    ->renderRoot($element));
  $element = $original_element;
  $this
    ->disableModules(array(
    'entity_test',
  ));
  $this
    ->assertTrue($renderer
    ->renderRoot($element));
}