function TwigDeprecationsTest::testAssignedVariableDeprecation

Same name in other branches
  1. 11.x core/tests/Drupal/KernelTests/Core/Theme/TwigDeprecationsTest.php \Drupal\KernelTests\Core\Theme\TwigDeprecationsTest::testAssignedVariableDeprecation()

Test deprecation of variables assigned inside template triggers no error.

File

core/tests/Drupal/KernelTests/Core/Theme/TwigDeprecationsTest.php, line 105

Class

TwigDeprecationsTest
Tests deprecating variables passed to twig templates.

Namespace

Drupal\KernelTests\Core\Theme

Code

public function testAssignedVariableDeprecation() : void {
    $preprocess = [
        'contents' => [
            'content',
        ],
        'deprecations' => [
            'set_var' => $this->getDeprecationMessage('set_var'),
            'for_var' => $this->getDeprecationMessage('for_var'),
        ],
    ];
    $this->assertRendered('foo|set_var|content|bar', $preprocess);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.