function PoItemTest::testFormat

Attributes

#[DataProvider('providerStrings')]

File

core/tests/Drupal/Tests/Component/Gettext/PoItemTest.php, line 68

Class

PoItemTest
Tests Drupal\Component\Gettext\PoItem.

Namespace

Drupal\Tests\Component\Gettext

Code

public function testFormat($source, $context, $translation, $expected) : void {
  $item = new PoItem();
  $item->setSource($source);
  if (is_array($source)) {
    $item->setPlural(TRUE);
  }
  if (!empty($context)) {
    $item->setContext($context);
  }
  if (!empty($translation)) {
    $item->setTranslation($translation);
  }
  $this->assertEquals($expected, (string) $item);
}

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