You are here

public function StringTranslationTraitTest::testT in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Core/StringTranslation/StringTranslationTraitTest.php \Drupal\Tests\Core\StringTranslation\StringTranslationTraitTest::testT()
  2. 9 core/tests/Drupal/Tests/Core/StringTranslation/StringTranslationTraitTest.php \Drupal\Tests\Core\StringTranslation\StringTranslationTraitTest::testT()

@covers ::t

File

core/tests/Drupal/Tests/Core/StringTranslation/StringTranslationTraitTest.php, line 50

Class

StringTranslationTraitTest
@coversDefaultClass \Drupal\Core\StringTranslation\StringTranslationTrait @group StringTranslation

Namespace

Drupal\Tests\Core\StringTranslation

Code

public function testT() {
  $method = $this->reflection
    ->getMethod('t');
  $method
    ->setAccessible(TRUE);
  $result = $method
    ->invoke($this->translation, 'something');
  $this
    ->assertInstanceOf(TranslatableMarkup::class, $result);
  $this
    ->assertEquals('something', $result);
}