xref: /PHP-8.3/ext/pspell/tests/003.phpt (revision 7936c808)
1--TEST--
2pspell_config_ignore
3--EXTENSIONS--
4pspell
5--SKIPIF--
6<?php
7if (!@pspell_new('en')) die('skip English dictionary is not available');
8?>
9--FILE--
10<?php
11
12$cfg = pspell_config_create('en', 'british', '', 'iso8859-1');
13$cfg2 = pspell_config_create('en', 'british', '', 'b0rked');
14
15$p = pspell_new_config($cfg);
16var_dump(pspell_check($p, 'yy'));
17
18$p2 = pspell_new_config($cfg2);
19try {
20    pspell_check($p2, 'yy');
21} catch (Error $exception) {
22    echo $exception->getMessage() . "\n";
23}
24
25echo "---\n";
26var_dump(pspell_config_ignore($cfg, 2));
27$p = pspell_new_config($cfg);
28var_dump(pspell_check($p, 'yy'));
29
30// segfault it?
31var_dump(pspell_config_ignore($cfg, PHP_INT_MAX));
32
33?>
34--EXPECTF--
35bool(false)
36
37Warning: 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
38pspell_check(): Argument #1 ($dictionary) must be of type PSpell\Dictionary, false given
39---
40bool(true)
41bool(true)
42bool(true)
43