xref: /PHP-5.5/ext/pspell/tests/005.phpt (revision bc96985b)
1--TEST--
2pspell configs
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$wordlist = dirname(__FILE__).'/wordlist.txt';
12
13var_dump(pspell_new_personal(__FILE__, 'en'));
14$p = pspell_new_personal($wordlist, 'en');
15
16var_dump(pspell_check($p, 'dfnvnsafksfksf'));
17
18echo "--\n";
19$cfg = pspell_config_create('en');
20var_dump(pspell_config_personal($cfg, "$wordlist.tmp"));
21$p = pspell_new_config($cfg);
22
23copy($wordlist, "$wordlist.tmp");
24
25var_dump(pspell_check($p, 'ola'));
26var_dump(pspell_add_to_personal($p, 'ola'));
27var_dump(pspell_check($p, 'ola'));
28
29echo "--\n";
30var_dump(pspell_save_wordlist($p));
31var_dump(strpos(file_get_contents("$wordlist.tmp"), 'ola') !== FALSE);
32
33unlink("$wordlist.tmp");
34?>
35--EXPECTF--
36Warning: 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
37bool(false)
38bool(true)
39--
40bool(true)
41bool(false)
42bool(true)
43bool(true)
44--
45bool(true)
46bool(true)
47