function UnicodeTest::testTruncateBytes
Same name in other branches
- 9 core/tests/Drupal/Tests/Component/Utility/UnicodeTest.php \Drupal\Tests\Component\Utility\UnicodeTest::testTruncateBytes()
- 8.9.x core/tests/Drupal/Tests/Component/Utility/UnicodeTest.php \Drupal\Tests\Component\Utility\UnicodeTest::testTruncateBytes()
- 11.x core/tests/Drupal/Tests/Component/Utility/UnicodeTest.php \Drupal\Tests\Component\Utility\UnicodeTest::testTruncateBytes()
Tests multibyte truncate bytes.
@dataProvider providerTestTruncateBytes @covers ::truncateBytes
Parameters
string $text: The string to truncate.
int $max_length: The upper limit on the returned string length.
string $expected: The expected return from Unicode::truncateBytes().
File
-
core/
tests/ Drupal/ Tests/ Component/ Utility/ UnicodeTest.php, line 221
Class
- UnicodeTest
- Test unicode handling features implemented in Unicode component.
Namespace
Drupal\Tests\Component\UtilityCode
public function testTruncateBytes($text, $max_length, $expected) : void {
$this->assertEquals($expected, Unicode::truncateBytes($text, $max_length), 'The string was not correctly truncated.');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.