xref: /PHP-7.3/ext/enchant/tests/dict_check.phpt (revision 782352c5)
1--TEST--
2enchant_dict_check() function
3--CREDITS--
4marcosptf - <marcosptf@yahoo.com.br>
5--SKIPIF--
6<?php
7if(!extension_loaded('enchant')) die('skip, enchant not loader');
8if (!is_resource(enchant_broker_init())) {die("skip, resource dont load\n");}
9if (!is_array(enchant_broker_list_dicts(enchant_broker_init()))) {die("skip, dont has dictionary install in this machine! \n");}
10?>
11--FILE--
12<?php
13$broker = enchant_broker_init();
14$dicts = enchant_broker_list_dicts($broker);
15$newWord = "java";
16
17if (is_resource($broker)) {
18    echo("OK\n");
19    $requestDict = enchant_broker_request_dict($broker, $dicts[0]['lang_tag']);
20
21    if ($requestDict) {
22        echo("OK\n");
23        enchant_dict_add_to_personal($requestDict, $newWord);
24
25        if (enchant_dict_check($requestDict, $newWord)) {
26            echo("OK\n");
27
28        } else {
29            echo("dict check new word failed\n");
30        }
31
32    } else {
33	echo("broker request dict failed\n");
34
35    }
36
37} else {
38    echo("broker is not a resource; failed;\n");
39}
40echo "OK\n";
41?>
42--EXPECT--
43OK
44OK
45OK
46OK
47