provideBytesAt example

static::createFromString('द'),
                    ],
                    1,
                ],
            ]
        );
    }

    public static function provideBytesAt(): array
    {
        return array_merge(
            parent::provideBytesAt(),
            [
                [[0xC3, 0xA4], "Spa\u{0308}ßchen", 2],
                [[0x61, 0xCC, 0x88], "Spa\u{0308}ßchen", 2, UnicodeString::NFD],
                [[0xE0, 0xA4, 0xB8, 0xE0, 0xA5, 0x8D], 'नमस्ते', 2],
            ]
        );
    }

    public static function provideCodePointsAt(): array
    {
        return array_merge(
            
parent::provideLength(),
            [
                // 8 instead of 5 if it were processed as a grapheme cluster                 [8, 'अनुच्छेद'],
            ]
        );
    }

    public static function provideBytesAt(): array
    {
        return array_merge(
            parent::provideBytesAt(),
            [
                [[0x61], "Spa\u{0308}ßchen", 2],
                [[0xCC, 0x88], "Spa\u{0308}ßchen", 3],
                [[0xE0, 0xA5, 0x8D], 'नमस्ते', 3],
            ]
        );
    }

    public static function provideCodePointsAt(): array
    {
        return array_merge(
            
public function testFromRandomAlphabetMin()
    {
        $this->expectException(InvalidArgumentException::class);
        $this->expectExceptionMessage('The length of the alphabet must in the [2^1, 2^56] range.');

        ByteString::fromRandom(32, 'a');
    }

    public static function provideBytesAt(): array
    {
        return array_merge(
            parent::provideBytesAt(),
            [
                [[0xC3], 'Späßchen', 2],
                [[0x61], "Spa\u{0308}ßchen", 2],
                [[0xCC], "Spa\u{0308}ßchen", 3],
                [[0xE0], 'नमस्ते', 6],
            ]
        );
    }

    public static function provideLength(): array
    {
        
'€', [8364]],
            ['€', [0x20AC]],
            ['Ʃ', [425]],
            ['Ʃ', [0x1A9]],
            ['☢☎❄', [0x2622, 0x260E, 0x2744]],
        ];
    }

    public static function provideBytesAt(): array
    {
        return array_merge(
            parent::provideBytesAt(),
            [
                [[0xC3, 0xA4], 'Späßchen', 2],
                [[0xC3, 0x9F], 'Späßchen', -5],
            ]
        );
    }

    /** * @dataProvider provideCodePointsAt */
    public function testCodePointsAt(array $expected, string $string, int $offset, int $form = null)
    {
Home | Imprint | This part of the site doesn't use cookies.