spoofchecker_007.phpt 662 B

1234567891011121314151617181920212223242526272829
  1. --TEST--
  2. spoofchecker with restriction level
  3. --EXTENSIONS--
  4. intl
  5. --SKIPIF--
  6. <?php if(!class_exists("Spoofchecker")) print 'skip'; ?>
  7. <?php
  8. $r = new ReflectionClass("SpoofChecker");
  9. if (false === $r->getConstant("SINGLE_SCRIPT_RESTRICTIVE")) {
  10. die("skip Incompatible ICU version");
  11. }
  12. ?>
  13. --FILE--
  14. <?php
  15. $x = new Spoofchecker();
  16. $x->setRestrictionLevel(Spoofchecker::HIGHLY_RESTRICTIVE);
  17. $mixed = "\u{91CE}\u{7403}\u{30FC}";
  18. var_dump($x->isSuspicious($mixed));
  19. $x->setRestrictionLevel(Spoofchecker::SINGLE_SCRIPT_RESTRICTIVE);
  20. $mixed = "\u{91CE}\u{7403}\u{30FC} abc";
  21. var_dump($x->isSuspicious($mixed));
  22. ?>
  23. --EXPECT--
  24. bool(false)
  25. bool(true)