rbbiter_getBinaryRules_basic.phpt 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. --TEST--
  2. IntlRuleBasedBreakIterator::getBinaryRules(): basic test
  3. --SKIPIF--
  4. <?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
  5. <?php if (version_compare(INTL_ICU_VERSION, '61.1') >= 0) die('skip for ICU < 61.1'); ?>
  6. <?php if(version_compare(INTL_ICU_VERSION, '4.8') < 0) print 'skip ICU >= 4.8 only'; ?>
  7. --FILE--
  8. <?php
  9. ini_set("intl.error_level", E_WARNING);
  10. ini_set("intl.default_locale", "pt_PT");
  11. $rules = <<<RULES
  12. \$LN = [[:letter:] [:number:]];
  13. \$S = [.;,:];
  14. !!forward;
  15. \$LN+ {1};
  16. \$S+ {42};
  17. !!reverse;
  18. \$LN+ {1};
  19. \$S+ {42};
  20. !!safe_forward;
  21. !!safe_reverse;
  22. RULES;
  23. $rbbi = new IntlRuleBasedBreakIterator($rules);
  24. $rbbi->setText('sdfkjsdf88á.... ,;');
  25. $br = $rbbi->getBinaryRules();
  26. $rbbi2 = new IntlRuleBasedBreakIterator($br, true);
  27. var_dump($rbbi->getRules(), $rbbi2->getRules());
  28. var_dump($rbbi->getRules() == $rbbi2->getRules());
  29. ?>
  30. ==DONE==
  31. --EXPECT--
  32. string(128) "$LN = [[:letter:] [:number:]];$S = [.;,:];!!forward;$LN+ {1};$S+ {42};!!reverse;$LN+ {1};$S+ {42};!!safe_forward;!!safe_reverse;"
  33. string(128) "$LN = [[:letter:] [:number:]];$S = [.;,:];!!forward;$LN+ {1};$S+ {42};!!reverse;$LN+ {1};$S+ {42};!!safe_forward;!!safe_reverse;"
  34. bool(true)
  35. ==DONE==