You are here

public function FormattableMarkupTest::testNoReplacementUnsupportedVariable in Drupal 9

@group legacy

File

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

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;
}