function FormattableMarkupTest::testNoReplacementUnsupportedVariable

@group legacy

File

core/tests/Drupal/Tests/Component/Render/FormattableMarkupTest.php, line 131

Class

FormattableMarkupTest
Tests the TranslatableMarkup class.

Namespace

Drupal\Tests\Component\Render

Code

public function testNoReplacementUnsupportedVariable() {
    $this->expectDeprecation('Support for keys without a placeholder prefix is deprecated in Drupal 9.1.0 and will be removed in Drupal 10.0.0. Invalid placeholder (foo) with string: "No replacements"');
    $markup = new FormattableMarkup('No replacements', [
        'foo' => 'bar',
    ]);
    // Cast it to a string which will generate the deprecation notice.
    $output = (string) $markup;
}

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