public function TextimagePregMatchTestCase::testCapturedOffset in Textimage 7.3
Same name and namespace in other branches
- 7.2 tests/textimage_preg_match.test \TextimagePregMatchTestCase::testCapturedOffset()
Performs the tests for the captured offset.
File
- tests/
textimage_preg_match.test, line 55 - Textimage - unit test case script.
Class
- TextimagePregMatchTestCase
- Checks that drupal_preg_match() function works as expected.
Code
public function testCapturedOffset() {
$matches = array();
// Character 'п' is 2 bytes long and non-unicode preg_match would return
// 2 here.
$result = drupal_preg_match('/z/u', 'пz', $matches, PREG_OFFSET_CAPTURE);
$this
->assertTrue($result && $matches[0][1] === 1, t('Returned offset is character-based.'));
}