003.phpt 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. --TEST--
  2. pspell_config_ignore
  3. --EXTENSIONS--
  4. pspell
  5. --SKIPIF--
  6. <?php
  7. if (!@pspell_new('en')) die('skip English dictionary is not available');
  8. ?>
  9. --FILE--
  10. <?php
  11. $cfg = pspell_config_create('en', 'british', '', 'iso8859-1');
  12. $cfg2 = pspell_config_create('en', 'british', '', 'b0rked');
  13. $p = pspell_new_config($cfg);
  14. var_dump(pspell_check($p, 'yy'));
  15. $p2 = pspell_new_config($cfg2);
  16. try {
  17. pspell_check($p2, 'yy');
  18. } catch (Error $exception) {
  19. echo $exception->getMessage() . "\n";
  20. }
  21. echo "---\n";
  22. var_dump(pspell_config_ignore($cfg, 2));
  23. $p = pspell_new_config($cfg);
  24. var_dump(pspell_check($p, 'yy'));
  25. // segfault it?
  26. var_dump(pspell_config_ignore($cfg, PHP_INT_MAX));
  27. ?>
  28. --EXPECTF--
  29. bool(false)
  30. Warning: pspell_new_config(): PSPELL couldn't open the dictionary. reason: The encoding "b0rked" is not known. This could also mean that the file "%sb0rked.%s" could not be opened for reading or does not exist. in %s003.php on line 9
  31. pspell_check(): Argument #1 ($dictionary) must be of type PSpell\Dictionary, bool given
  32. ---
  33. bool(true)
  34. bool(true)
  35. bool(true)