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