summaryrefslogtreecommitdiff
path: root/ext/pspell/tests/005.phpt
blob: 17ed1904b893eb0446c107ff4fd6fd7c29c89f5f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
--TEST--
pspell configs
--SKIPIF--
<?php
if (!extension_loaded('pspell')) die('skip');
if (!@pspell_new('en')) die('skip English dictionary is not available');
?>
--FILE--
<?php

$wordlist = dirname(__FILE__).'/wordlist.txt';

var_dump(pspell_new_personal(__FILE__, 'en'));
$p = pspell_new_personal($wordlist, 'en');

var_dump(pspell_check($p, 'dfnvnsafksfksf'));

echo "--\n";
$cfg = pspell_config_create('en');
var_dump(pspell_config_personal($cfg, "$wordlist.tmp"));
$p = pspell_new_config($cfg);

copy($wordlist, "$wordlist.tmp");

var_dump(pspell_check($p, 'ola'));
var_dump(pspell_add_to_personal($p, 'ola'));
var_dump(pspell_check($p, 'ola'));

echo "--\n";
var_dump(pspell_save_wordlist($p));
var_dump(strpos(file_get_contents("$wordlist.tmp"), 'ola') !== FALSE);

unlink("$wordlist.tmp");
?>
--EXPECTF--
Warning: 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
bool(false)
bool(true)
--
bool(true)
bool(false)
bool(true)
bool(true)
--
bool(true)
bool(true)