xref: /PHP-8.2/ext/pspell/tests/005.phpt (revision 74859783)
1--TEST--
2pspell configs
3--EXTENSIONS--
4pspell
5--SKIPIF--
6<?php
7if (!@pspell_new('en')) die('skip English dictionary is not available');
8if (getenv('SKIP_ASAN')) die('skip pspell leaks memory for invalid dicationaries');
9?>
10--FILE--
11<?php
12
13$wordlist = __DIR__.'/wordlist.txt';
14
15var_dump(pspell_new_personal(__FILE__, 'en'));
16$p = pspell_new_personal($wordlist, 'en');
17
18var_dump(pspell_check($p, 'dfnvnsafksfksf'));
19
20echo "--\n";
21$cfg = pspell_config_create('en');
22var_dump(pspell_config_personal($cfg, "$wordlist.tmp"));
23$p = pspell_new_config($cfg);
24
25copy($wordlist, "$wordlist.tmp");
26
27var_dump(pspell_check($p, 'ola'));
28var_dump(pspell_add_to_personal($p, 'ola'));
29var_dump(pspell_check($p, 'ola'));
30
31echo "--\n";
32var_dump(pspell_save_wordlist($p));
33var_dump(strpos(file_get_contents("$wordlist.tmp"), 'ola') !== FALSE);
34
35unlink("$wordlist.tmp");
36?>
37--EXPECTF--
38Warning: 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
39bool(false)
40bool(true)
41--
42bool(true)
43bool(false)
44bool(true)
45bool(true)
46--
47bool(true)
48bool(true)
49