xref: /PHP-5.5/ext/pspell/tests/003.phpt (revision bc96985b)
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);
18var_dump(pspell_check($p2, 'yy'));
19
20echo "---\n";
21var_dump(pspell_config_ignore($cfg, 2));
22$p = pspell_new_config($cfg);
23var_dump(pspell_check($p, 'yy'));
24
25// segfault it?
26var_dump(pspell_config_ignore($cfg, PHP_INT_MAX));
27
28?>
29--EXPECTF--
30bool(false)
31
32Warning: 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
33
34Warning: pspell_check(): 0 is not a PSPELL result index in %s003.php on line 10
35bool(false)
36---
37bool(true)
38bool(true)
39bool(true)
40