You are here

public function UnicodeTest::providerTruncate 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::providerTruncate()

Data provider for testTruncate().

Return value

array An array containing:

  • The string to test.
  • The max length to truncate this string to.
  • The expected string result.
  • (optional) Boolean for the $wordsafe flag. Defaults to FALSE.
  • (optional) Boolean for the $add_ellipsis flag. Defaults to FALSE.

See also

testTruncate()

File

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

Class

UnicodeTest
Test unicode handling features implemented in Unicode component.

Namespace

Drupal\Tests\Component\Utility

Code

public function providerTruncate() {
  return array(
    array(
      'frànçAIS is über-åwesome',
      24,
      'frànçAIS is über-åwesome',
    ),
    array(
      'frànçAIS is über-åwesome',
      23,
      'frànçAIS is über-åwesom',
    ),
    array(
      'frànçAIS is über-åwesome',
      17,
      'frànçAIS is über-',
    ),
    array(
      '以呂波耳・ほへとち。リヌルヲ。',
      6,
      '以呂波耳・ほ',
    ),
    array(
      'frànçAIS is über-åwesome',
      24,
      'frànçAIS is über-åwesome',
      FALSE,
      TRUE,
    ),
    array(
      'frànçAIS is über-åwesome',
      23,
      'frànçAIS is über-åweso…',
      FALSE,
      TRUE,
    ),
    array(
      'frànçAIS is über-åwesome',
      17,
      'frànçAIS is über…',
      FALSE,
      TRUE,
    ),
    array(
      '123',
      1,
      '…',
      TRUE,
      TRUE,
    ),
    array(
      '123',
      2,
      '1…',
      TRUE,
      TRUE,
    ),
    array(
      '123',
      3,
      '123',
      TRUE,
      TRUE,
    ),
    array(
      '1234',
      3,
      '12…',
      TRUE,
      TRUE,
    ),
    array(
      '1234567890',
      10,
      '1234567890',
      TRUE,
      TRUE,
    ),
    array(
      '12345678901',
      10,
      '123456789…',
      TRUE,
      TRUE,
    ),
    array(
      '12345678901',
      11,
      '12345678901',
      TRUE,
      TRUE,
    ),
    array(
      '123456789012',
      11,
      '1234567890…',
      TRUE,
      TRUE,
    ),
    array(
      '12345 7890',
      10,
      '12345 7890',
      TRUE,
      TRUE,
    ),
    array(
      '12345 7890',
      9,
      '12345…',
      TRUE,
      TRUE,
    ),
    array(
      '123 567 90',
      10,
      '123 567 90',
      TRUE,
      TRUE,
    ),
    array(
      '123 567 901',
      10,
      '123 567…',
      TRUE,
      TRUE,
    ),
    array(
      'Stop. Hammertime.',
      17,
      'Stop. Hammertime.',
      TRUE,
      TRUE,
    ),
    array(
      'Stop. Hammertime.',
      16,
      'Stop…',
      TRUE,
      TRUE,
    ),
    array(
      'frànçAIS is über-åwesome',
      24,
      'frànçAIS is über-åwesome',
      TRUE,
      TRUE,
    ),
    array(
      'frànçAIS is über-åwesome',
      23,
      'frànçAIS is über…',
      TRUE,
      TRUE,
    ),
    array(
      'frànçAIS is über-åwesome',
      17,
      'frànçAIS is über…',
      TRUE,
      TRUE,
    ),
    array(
      '¿Dónde está el niño?',
      20,
      '¿Dónde está el niño?',
      TRUE,
      TRUE,
    ),
    array(
      '¿Dónde está el niño?',
      19,
      '¿Dónde está el…',
      TRUE,
      TRUE,
    ),
    array(
      '¿Dónde está el niño?',
      13,
      '¿Dónde está…',
      TRUE,
      TRUE,
    ),
    array(
      '¿Dónde está el niño?',
      10,
      '¿Dónde…',
      TRUE,
      TRUE,
    ),
    array(
      'Help! Help! Help!',
      17,
      'Help! Help! Help!',
      TRUE,
      TRUE,
    ),
    array(
      'Help! Help! Help!',
      16,
      'Help! Help!…',
      TRUE,
      TRUE,
    ),
    array(
      'Help! Help! Help!',
      15,
      'Help! Help!…',
      TRUE,
      TRUE,
    ),
    array(
      'Help! Help! Help!',
      14,
      'Help! Help!…',
      TRUE,
      TRUE,
    ),
    array(
      'Help! Help! Help!',
      13,
      'Help! Help!…',
      TRUE,
      TRUE,
    ),
    array(
      'Help! Help! Help!',
      12,
      'Help! Help!…',
      TRUE,
      TRUE,
    ),
    array(
      'Help! Help! Help!',
      11,
      'Help! Help…',
      TRUE,
      TRUE,
    ),
    array(
      'Help! Help! Help!',
      10,
      'Help!…',
      TRUE,
      TRUE,
    ),
    array(
      'Help! Help! Help!',
      9,
      'Help!…',
      TRUE,
      TRUE,
    ),
    array(
      'Help! Help! Help!',
      8,
      'Help!…',
      TRUE,
      TRUE,
    ),
    array(
      'Help! Help! Help!',
      7,
      'Help!…',
      TRUE,
      TRUE,
    ),
    array(
      'Help! Help! Help!',
      6,
      'Help!…',
      TRUE,
      TRUE,
    ),
    array(
      'Help! Help! Help!',
      5,
      'Help…',
      TRUE,
      TRUE,
    ),
    array(
      'Help! Help! Help!',
      4,
      'Hel…',
      TRUE,
      TRUE,
    ),
    array(
      'Help! Help! Help!',
      3,
      'He…',
      TRUE,
      TRUE,
    ),
    array(
      'Help! Help! Help!',
      2,
      'H…',
      TRUE,
      TRUE,
    ),
  );
}