function StringTranslationTraitTest::testFormatPlural

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Core/StringTranslation/StringTranslationTraitTest.php \Drupal\Tests\Core\StringTranslation\StringTranslationTraitTest::testFormatPlural()
  2. 8.9.x core/tests/Drupal/Tests/Core/StringTranslation/StringTranslationTraitTest.php \Drupal\Tests\Core\StringTranslation\StringTranslationTraitTest::testFormatPlural()
  3. 11.x 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 61

Class

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

Namespace

Drupal\Tests\Core\StringTranslation

Code

public function testFormatPlural() : void {
    $invokableFormatPlural = new \ReflectionMethod($this->testObject, 'formatPlural');
    $result = $invokableFormatPlural->invoke($this->testObject, 1, 'apple', 'apples');
    $this->assertInstanceOf(PluralTranslatableMarkup::class, $result);
    $this->assertEquals('apple', $result);
    $result = $invokableFormatPlural->invoke($this->testObject, 2, 'apple', 'apples');
    $this->assertInstanceOf(PluralTranslatableMarkup::class, $result);
    $this->assertEquals('apples', $result);
}

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