예제 #1
0
 /**
  * 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));
 }
예제 #2
0
 /**
  * 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));
 }