You are here

public function TranslatableMarkupTest::testIsStringAssertion in Drupal 8

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Core/StringTranslation/TranslatableMarkupTest.php \Drupal\Tests\Core\StringTranslation\TranslatableMarkupTest::testIsStringAssertion()
  2. 10 core/tests/Drupal/Tests/Core/StringTranslation/TranslatableMarkupTest.php \Drupal\Tests\Core\StringTranslation\TranslatableMarkupTest::testIsStringAssertion()

@covers ::__construct

File

core/tests/Drupal/Tests/Core/StringTranslation/TranslatableMarkupTest.php, line 87

Class

TranslatableMarkupTest
Tests the TranslatableMarkup class.

Namespace

Drupal\Tests\Core\StringTranslation

Code

public function testIsStringAssertion() {
  $translation = $this
    ->getStringTranslationStub();
  $this
    ->expectException(\InvalidArgumentException::class);
  $this
    ->expectExceptionMessage('$string ("foo") must be a string.');
  new TranslatableMarkup(new TranslatableMarkup('foo', [], [], $translation));
}