rbbiter_getBinaryRules_basic.phpt 1.1 KB

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