function UnicodeTest::providerTestTruncateBytes

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Component/Utility/UnicodeTest.php \Drupal\Tests\Component\Utility\UnicodeTest::providerTestTruncateBytes()
  2. 8.9.x core/tests/Drupal/Tests/Component/Utility/UnicodeTest.php \Drupal\Tests\Component\Utility\UnicodeTest::providerTestTruncateBytes()
  3. 10 core/tests/Drupal/Tests/Component/Utility/UnicodeTest.php \Drupal\Tests\Component\Utility\UnicodeTest::providerTestTruncateBytes()

Provides data for self::testTruncateBytes().

Return value

array An array of arrays, each containing the parameters to self::testTruncateBytes().

File

core/tests/Drupal/Tests/Component/Utility/UnicodeTest.php, line 232

Class

UnicodeTest
Test unicode handling features implemented in Unicode component.

Namespace

Drupal\Tests\Component\Utility

Code

public static function providerTestTruncateBytes() {
    return [
        // String shorter than max length.
[
            'Short string',
            42,
            'Short string',
        ],
        // Simple string longer than max length.
[
            'Longer string than previous.',
            10,
            'Longer str',
        ],
        // Unicode.
[
            '以呂波耳・ほへとち。リヌルヲ。',
            10,
            '以呂波',
        ],
    ];
}

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