1--TEST--
2enchant_broker_free() 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 = array("iLoveJava","iLoveJavascript","iLoveRuby","iLovePerl","iLoveAwk","iLoveC");
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        for($x=0;$x<count($newWord);$x++) {
24            $AddtoPersonalDict = enchant_dict_add_to_personal($requestDict,$newWord[$x]);
25        }
26
27        if (NULL === $AddtoPersonalDict) {
28            var_dump($AddtoPersonalDict);
29
30            if (enchant_broker_free_dict($requestDict)) {
31                echo("OK\n");
32
33                if (enchant_broker_free($broker)) {
34                    echo("OK\n");
35
36                } else {
37                    echo("broker free failed\n");
38                }
39            } else {
40                echo("broker dict free failed\n");
41            }
42        } else {
43            echo("dict add to personal failed\n");
44        }
45    } else {
46        echo("broker request dict failed\n");
47    }
48} else {
49    echo("init failed\n");
50}
51echo("OK\n");
52?>
53--EXPECT--
54OK
55OK
56NULL
57OK
58OK
59OK
60