You are here

public function UnicodeTest::testStrpos in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/tests/Drupal/Tests/Component/Utility/UnicodeTest.php \Drupal\Tests\Component\Utility\UnicodeTest::testStrpos()

Tests multibyte strpos.

@dataProvider providerStrpos @covers ::strpos

File

core/tests/Drupal/Tests/Component/Utility/UnicodeTest.php, line 539
Contains \Drupal\Tests\Component\Utility\UnicodeTest.

Class

UnicodeTest
Test unicode handling features implemented in Unicode component.

Namespace

Drupal\Tests\Component\Utility

Code

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));
}