public function TextUtilityTest::testCapturedOffset in Image Effects 8.2
Same name and namespace in other branches
- 8.3 tests/src/Unit/TextUtilityTest.php \Drupal\Tests\image_effects\Unit\TextUtilityTest::testCapturedOffset()
- 8 tests/src/Unit/TextUtilityTest.php \Drupal\Tests\image_effects\Unit\TextUtilityTest::testCapturedOffset()
Performs the tests for the captured offset.
File
- tests/
src/ Unit/ TextUtilityTest.php, line 36
Class
- TextUtilityTest
- Tests the UTF-8 character-based wrapper of the preg_match function.
Namespace
Drupal\Tests\image_effects\UnitCode
public function testCapturedOffset() {
$matches = [];
// Character 'п' is 2 bytes long and non-unicode preg_match would return
// 2 here.
$result = TextUtility::unicodePregMatch('/z/u', 'пz', $matches, PREG_OFFSET_CAPTURE);
$this
->assertTrue($result && $matches[0][1] === 1, 'Returned offset is character-based.');
}