xref: /PHP-8.2/ext/enchant/tests/bug13181.phpt (revision 74859783)
1--TEST--
2bug #13181, leaving a context frees the broker resources
3--EXTENSIONS--
4enchant
5--SKIPIF--
6<?php
7$broker = enchant_broker_init();
8
9if (!$broker) {
10    echo "skip: Unable to init broker\n";
11    exit;
12}
13
14if (!enchant_broker_list_dicts($broker)) {
15    @enchant_broker_free($broker);
16
17    echo "skip: No broker dicts installed\n";
18}
19
20@enchant_broker_free($broker);
21?>
22--FILE--
23<?php
24function get_dictionnary() {
25    $rBroker = enchant_broker_init();
26    $t = enchant_broker_request_dict($rBroker, 'en');
27    var_dump($t);
28    return $t;
29}
30$rDict = get_dictionnary();
31var_dump($rDict);
32enchant_dict_suggest($rDict, "soong");
33
34function get_broker() {
35    $t = enchant_broker_init();
36    var_dump($t);
37    return $t;
38}
39
40$rbroker = get_broker();
41var_dump($rbroker);
42
43function get_dict($broker) {
44    $t = enchant_broker_request_dict($broker, 'en');
45    var_dump($t);
46    return $t;
47}
48$rDict = get_dict($rbroker);
49var_dump($rDict);
50?>
51--EXPECTF--
52object(EnchantDictionary)#%d (0) {
53}
54object(EnchantDictionary)#%d (0) {
55}
56object(EnchantBroker)#%d (0) {
57}
58object(EnchantBroker)#%d (0) {
59}
60object(EnchantDictionary)#%d (0) {
61}
62object(EnchantDictionary)#%d (0) {
63}
64
65