function PluralTranslatableMarkupTest::providerExplicitCountArgument

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

Data provider for ::testExplicitCountArgument().

File

core/tests/Drupal/Tests/Core/StringTranslation/PluralTranslatableMarkupTest.php, line 77

Class

PluralTranslatableMarkupTest
Tests the TranslatableMarkup class.

Namespace

Drupal\Tests\Core\StringTranslation

Code

public static function providerExplicitCountArgument() : array {
  return [
    // The plural form is selected with the count, but the explicitly passed
    // replacement is what gets displayed.
'singular' => [
      1,
      'one',
      'singular one',
    ],
    'plural' => [
      2,
      'a couple of',
      'plural a couple of',
    ],
    // A fractional count selects the plural form, while the argument keeps
    // control over the formatting of the displayed value.
'fraction' => [
      1.5,
      '1½',
      'plural 1½',
    ],
  ];
}

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