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