function TwigDeprecationsTest::getDeprecationMessage

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

Get an example deprecation message for a named variable.

7 calls to TwigDeprecationsTest::getDeprecationMessage()
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::testHookThemeDeprecations in core/tests/Drupal/KernelTests/Core/Theme/TwigDeprecationsTest.php
Test deprecating variables at definition in hook_theme().
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.

... See full list

File

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

Class

TwigDeprecationsTest
Tests deprecating variables passed to twig templates.

Namespace

Drupal\KernelTests\Core\Theme

Code

protected function getDeprecationMessage($variable) : string {
    return "'{$variable}' is deprecated in drupal:X.0.0 and is removed from drupal:Y.0.0. Use 'new_{$variable}' instead. See https://www.example.com.";
}

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