function TwigDeprecationsTest::testMultipleDeprecations

Same name and namespace in other branches
  1. 10 core/tests/Drupal/KernelTests/Core/Theme/TwigDeprecationsTest.php \Drupal\KernelTests\Core\Theme\TwigDeprecationsTest::testMultipleDeprecations()

Test deprecation of multiple variables triggers errors.

File

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

Class

TwigDeprecationsTest
Tests deprecating variables passed to twig templates.

Namespace

Drupal\KernelTests\Core\Theme

Code

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

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