005.phpt 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. --TEST--
  2. pspell configs
  3. --EXTENSIONS--
  4. pspell
  5. --SKIPIF--
  6. <?php
  7. if (!@pspell_new('en')) die('skip English dictionary is not available');
  8. if (getenv('SKIP_ASAN')) die('skip pspell leaks memory for invalid dicationaries');
  9. ?>
  10. --FILE--
  11. <?php
  12. $wordlist = __DIR__.'/wordlist.txt';
  13. var_dump(pspell_new_personal(__FILE__, 'en'));
  14. $p = pspell_new_personal($wordlist, 'en');
  15. var_dump(pspell_check($p, 'dfnvnsafksfksf'));
  16. echo "--\n";
  17. $cfg = pspell_config_create('en');
  18. var_dump(pspell_config_personal($cfg, "$wordlist.tmp"));
  19. $p = pspell_new_config($cfg);
  20. copy($wordlist, "$wordlist.tmp");
  21. var_dump(pspell_check($p, 'ola'));
  22. var_dump(pspell_add_to_personal($p, 'ola'));
  23. var_dump(pspell_check($p, 'ola'));
  24. echo "--\n";
  25. var_dump(pspell_save_wordlist($p));
  26. var_dump(strpos(file_get_contents("$wordlist.tmp"), 'ola') !== FALSE);
  27. unlink("$wordlist.tmp");
  28. ?>
  29. --EXPECTF--
  30. Warning: pspell_new_personal(): PSPELL couldn't open the dictionary. reason: The file "%s005.php" is not in the proper format. in %s005.php on line 5
  31. bool(false)
  32. bool(true)
  33. --
  34. bool(true)
  35. bool(false)
  36. bool(true)
  37. bool(true)
  38. --
  39. bool(true)
  40. bool(true)