You are here

public function UnicodeTest::testTruncate in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/tests/Drupal/Tests/Component/Utility/UnicodeTest.php \Drupal\Tests\Component\Utility\UnicodeTest::testTruncate()

Tests multibyte truncate.

@dataProvider providerTruncate @covers ::truncate

File

core/tests/Drupal/Tests/Component/Utility/UnicodeTest.php, line 361
Contains \Drupal\Tests\Component\Utility\UnicodeTest.

Class

UnicodeTest
Test unicode handling features implemented in Unicode component.

Namespace

Drupal\Tests\Component\Utility

Code

public function testTruncate($text, $max_length, $expected, $wordsafe = FALSE, $add_ellipsis = FALSE) {
  $this
    ->assertEquals($expected, Unicode::truncate($text, $max_length, $wordsafe, $add_ellipsis));
}