function UnicodeTest::providerSubstr

Data provider for testSubstr().

Return value

array An array containing:

  • The string to test.
  • The start number to be processed by substr.
  • The length number to be processed by substr.
  • The expected string result.

See also

testSubstr()

File

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

Class

UnicodeTest
Test unicode handling features implemented in Unicode component.

Namespace

Drupal\Tests\Component\Utility

Code

public function providerSubstr() {
    return [
        [
            'frànçAIS is über-åwesome',
            0,
            NULL,
            'frànçAIS is über-åwesome',
        ],
        [
            'frànçAIS is über-åwesome',
            0,
            0,
            '',
        ],
        [
            'frànçAIS is über-åwesome',
            0,
            1,
            'f',
        ],
        [
            'frànçAIS is über-åwesome',
            0,
            8,
            'frànçAIS',
        ],
        [
            'frànçAIS is über-åwesome',
            0,
            23,
            'frànçAIS is über-åwesom',
        ],
        [
            'frànçAIS is über-åwesome',
            0,
            24,
            'frànçAIS is über-åwesome',
        ],
        [
            'frànçAIS is über-åwesome',
            0,
            25,
            'frànçAIS is über-åwesome',
        ],
        [
            'frànçAIS is über-åwesome',
            0,
            100,
            'frànçAIS is über-åwesome',
        ],
        [
            'frànçAIS is über-åwesome',
            4,
            4,
            'çAIS',
        ],
        [
            'frànçAIS is über-åwesome',
            1,
            0,
            '',
        ],
        [
            'frànçAIS is über-åwesome',
            100,
            0,
            '',
        ],
        [
            'frànçAIS is über-åwesome',
            -4,
            2,
            'so',
        ],
        [
            'frànçAIS is über-åwesome',
            -4,
            3,
            'som',
        ],
        [
            'frànçAIS is über-åwesome',
            -4,
            4,
            'some',
        ],
        [
            'frànçAIS is über-åwesome',
            -4,
            5,
            'some',
        ],
        [
            'frànçAIS is über-åwesome',
            -7,
            10,
            'åwesome',
        ],
        [
            'frànçAIS is über-åwesome',
            5,
            -10,
            'AIS is üb',
        ],
        [
            'frànçAIS is über-åwesome',
            0,
            -10,
            'frànçAIS is üb',
        ],
        [
            'frànçAIS is über-åwesome',
            0,
            -1,
            'frànçAIS is über-åwesom',
        ],
        [
            'frànçAIS is über-åwesome',
            -7,
            -2,
            'åweso',
        ],
        [
            'frànçAIS is über-åwesome',
            -7,
            -6,
            'å',
        ],
        [
            'frànçAIS is über-åwesome',
            -7,
            -7,
            '',
        ],
        [
            'frànçAIS is über-åwesome',
            -7,
            -8,
            '',
        ],
        [
            '...',
            0,
            2,
            '..',
        ],
        [
            '以呂波耳・ほへとち。リヌルヲ。',
            1,
            3,
            '呂波耳',
        ],
    ];
}

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