/** * Tests multibyte substr. * * @dataProvider providerSubstr * @covers ::substr */ public function testSubstr($text, $start, $length, $expected) { // Run through multibyte code path. Unicode::setStatus(Unicode::STATUS_MULTIBYTE); $this->assertEquals($expected, Unicode::substr($text, $start, $length)); // Run through singlebyte code path. Unicode::setStatus(Unicode::STATUS_SINGLEBYTE); $this->assertEquals($expected, Unicode::substr($text, $start, $length)); }
/** * Tests multibyte strpos. * * @dataProvider providerStrpos * @covers ::strpos */ public function testStrpos($haystack, $needle, $offset, $expected) { // Run through multibyte code path. Unicode::setStatus(Unicode::STATUS_MULTIBYTE); $this->assertEquals($expected, Unicode::strpos($haystack, $needle, $offset)); // Run through singlebyte code path. Unicode::setStatus(Unicode::STATUS_SINGLEBYTE); $this->assertEquals($expected, Unicode::strpos($haystack, $needle, $offset)); }