function ByteSizeMarkupTest::testTranslatableMarkupObject

Same name in other branches
  1. 10 core/tests/Drupal/Tests/Core/StringTranslation/ByteSizeMarkupTest.php \Drupal\Tests\Core\StringTranslation\ByteSizeMarkupTest::testTranslatableMarkupObject()

@covers ::create

File

core/tests/Drupal/Tests/Core/StringTranslation/ByteSizeMarkupTest.php, line 70

Class

ByteSizeMarkupTest
@coversDefaultClass \Drupal\Core\StringTranslation\ByteSizeMarkup @group StringTranslation

Namespace

Drupal\Tests\Core\StringTranslation

Code

public function testTranslatableMarkupObject() : void {
    $result = ByteSizeMarkup::create(1, NULL, $this->getStringTranslationStub());
    $this->assertInstanceOf(PluralTranslatableMarkup::class, $result);
    $this->assertEquals("1 byte\x03@count bytes", $result->getUntranslatedString());
    $result = ByteSizeMarkup::create(1048576, 'fr', $this->getStringTranslationStub());
    $this->assertInstanceOf(TranslatableMarkup::class, $result);
    $this->assertEquals("@size MB", $result->getUntranslatedString());
    $this->assertEquals('fr', $result->getOption('langcode'));
}

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