function TwigDeprecationsTest::assertRendered
Assert that 'theme_test_deprecations_preprocess' renders expected text.
Parameters
string $expected: The expected text.
array $preprocess: An array to merge in theme_test_deprecations_preprocess_preprocess().
7 calls to TwigDeprecationsTest::assertRendered()
- TwigDeprecationsTest::testAssignedVariableDeprecation in core/
tests/ Drupal/ KernelTests/ Core/ Theme/ TwigDeprecationsTest.php  - Test deprecation of variables assigned inside template triggers no error.
 - TwigDeprecationsTest::testEmptyDeprecation in core/
tests/ Drupal/ KernelTests/ Core/ Theme/ TwigDeprecationsTest.php  - Test deprecation of empty variable triggers error.
 - TwigDeprecationsTest::testMultipleDeprecations in core/
tests/ Drupal/ KernelTests/ Core/ Theme/ TwigDeprecationsTest.php  - Test deprecation of multiple variables triggers errors.
 - TwigDeprecationsTest::testParentVariableDeprecation in core/
tests/ Drupal/ KernelTests/ Core/ Theme/ TwigDeprecationsTest.php  - Test deprecation of variables in parent does not leak to child.
 - TwigDeprecationsTest::testSingleDeprecation in core/
tests/ Drupal/ KernelTests/ Core/ Theme/ TwigDeprecationsTest.php  - Test deprecation of single variable triggers error.
 
File
- 
              core/
tests/ Drupal/ KernelTests/ Core/ Theme/ TwigDeprecationsTest.php, line 150  
Class
- TwigDeprecationsTest
 - Tests deprecating variables passed to twig templates.
 
Namespace
Drupal\KernelTests\Core\ThemeCode
protected function assertRendered($expected, array $preprocess) : void {
  \Drupal::state()->set('theme_test.theme_test_deprecations_preprocess', $preprocess);
  $element = [
    '#theme' => 'theme_test_deprecations_preprocess',
    '#foo' => 'foo',
    '#bar' => 'bar',
    '#gaz' => 'gaz',
    '#set_var' => 'overridden',
  ];
  $this->assertEquals($expected, $this->container
    ->get('renderer')
    ->renderRoot($element));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.