You are here

public function StringTranslationTraitTest::testFormatPlural in Drupal 9

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

@covers ::formatPlural

File

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

Class

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

Namespace

Drupal\Tests\Core\StringTranslation

Code

public function testFormatPlural() {
  $method = $this->reflection
    ->getMethod('formatPlural');
  $method
    ->setAccessible(TRUE);
  $result = $method
    ->invoke($this->translation, 2, 'apple', 'apples');
  $this
    ->assertInstanceOf(PluralTranslatableMarkup::class, $result);
  $this
    ->assertEquals('apples', $result);
}