function TranslationManagerTest::testFormatPluralWithNonNumericCount

Same name and namespace in other branches
  1. 11.x core/tests/Drupal/Tests/Core/StringTranslation/TranslationManagerTest.php \Drupal\Tests\Core\StringTranslation\TranslationManagerTest::testFormatPluralWithNonNumericCount()

Tests that a non-numeric count is rejected rather than rendered.

File

core/tests/Drupal/Tests/Core/StringTranslation/TranslationManagerTest.php, line 93

Class

TranslationManagerTest
Tests Drupal\Core\StringTranslation\TranslationManager.

Namespace

Drupal\Tests\Core\StringTranslation

Code

public function testFormatPluralWithNonNumericCount() : void {
  $this->expectException(\TypeError::class);
  $this->translationManager
    ->formatPlural('not a number', 'Singular', '@count plural')
    ->render();
}

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