1--TEST--
2@enchant_broker_free() function
3--CREDITS--
4marcosptf - <marcosptf@yahoo.com.br>
5--EXTENSIONS--
6enchant
7--SKIPIF--
8<?php
9if(!is_object(enchant_broker_init())) {die("skip, resource dont load\n");}
10if(!is_array(enchant_broker_list_dicts(enchant_broker_init()))) {die("skip, no dictionary installed on this machine! \n");}
11?>
12--FILE--
13<?php
14$broker = enchant_broker_init();
15$dicts = enchant_broker_list_dicts($broker);
16$newWord = array("iLoveJava","iLoveJavascript","iLoveRuby","iLovePerl","iLoveAwk","iLoveC");
17
18if (is_object($broker)) {
19    echo("OK\n");
20    $requestDict = enchant_broker_request_dict($broker, $dicts[0]['lang_tag']);
21
22    if ($requestDict) {
23        echo("OK\n");
24        for($x=0;$x<count($newWord);$x++) {
25            $AddtoPersonalDict = enchant_dict_add($requestDict,$newWord[$x]);
26        }
27
28        if (NULL === $AddtoPersonalDict) {
29            var_dump($AddtoPersonalDict);
30
31            if (@enchant_broker_free_dict($requestDict)) {
32                echo("OK\n");
33
34                if (@enchant_broker_free($broker)) {
35                    echo("OK\n");
36
37                } else {
38                    echo("broker free failed\n");
39                }
40            } else {
41                echo("broker dict free failed\n");
42            }
43        } else {
44            echo("dict add to personal failed\n");
45        }
46    } else {
47        echo("broker request dict failed\n");
48    }
49} else {
50    echo("init failed\n");
51}
52echo("OK\n");
53?>
54--EXPECT--
55OK
56OK
57NULL
58OK
59OK
60OK
61