rbbiter_getRuleStatusVec_basic.phpt 765 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. --TEST--
  2. IntlRuleBasedBreakIterator::getRuleStatusVec(): basic test
  3. --EXTENSIONS--
  4. intl
  5. --FILE--
  6. <?php
  7. ini_set("intl.error_level", E_WARNING);
  8. ini_set("intl.default_locale", "pt_PT");
  9. $rules = <<<RULES
  10. \$LN = [[:letter:] [:number:]];
  11. \$S = [.;,:];
  12. !!forward;
  13. \$LN+ {1};
  14. [^.]+ {4};
  15. \$S+ {42};
  16. !!reverse;
  17. \$LN+ {1};
  18. [^.]+ {4};
  19. \$S+ {42};
  20. !!safe_forward;
  21. !!safe_reverse;
  22. RULES;
  23. $rbbi = new IntlRuleBasedBreakIterator($rules);
  24. $rbbi->setText('sdfkjsdf88á.... ,;');
  25. do {
  26. var_dump($rbbi->current(), $rbbi->getRuleStatusVec());
  27. } while ($rbbi->next() != IntlBreakIterator::DONE);
  28. ?>
  29. --EXPECT--
  30. int(0)
  31. array(1) {
  32. [0]=>
  33. int(0)
  34. }
  35. int(12)
  36. array(2) {
  37. [0]=>
  38. int(1)
  39. [1]=>
  40. int(4)
  41. }
  42. int(16)
  43. array(1) {
  44. [0]=>
  45. int(42)
  46. }
  47. int(19)
  48. array(1) {
  49. [0]=>
  50. int(4)
  51. }