do the release
[m6w6/ext-raphf] / tests / http002.phpt
1 --TEST--
2 pecl/http-v2 - clean with name and id
3 --SKIPIF--
4 <?php
5 if (!extension_loaded("http")) {
6 die("skip pecl/http needed");
7 }
8 if (!class_exists("http\\Client", false)) {
9 die("skip pecl/http-v2 with curl support needed");
10 }
11 ?>
12 --FILE--
13 <?php
14 echo "Test\n";
15
16 $c = new http\Client("curl", "php.net:80");
17 do {
18 $c->enqueue(new http\Client\Request("GET", "http://php.net"));
19 } while (count($c) < 3);
20
21 unset($c);
22
23 var_dump(raphf\stat_persistent_handles());
24
25 raphf\clean_persistent_handles("http\\Client\\Curl");
26 raphf\clean_persistent_handles("http\\Client\\Curl\\Request", "php.net:80");
27
28 var_dump(raphf\stat_persistent_handles());
29
30 ?>
31 Done
32 --EXPECTF--
33 Test
34 object(stdClass)#%d (2) {
35 ["http\Client\Curl"]=>
36 array(1) {
37 ["php.net:80"]=>
38 array(2) {
39 ["used"]=>
40 int(0)
41 ["free"]=>
42 int(1)
43 }
44 }
45 ["http\Client\Curl\Request"]=>
46 array(1) {
47 ["php.net:80"]=>
48 array(2) {
49 ["used"]=>
50 int(0)
51 ["free"]=>
52 int(3)
53 }
54 }
55 }
56 object(stdClass)#%d (2) {
57 ["http\Client\Curl"]=>
58 array(0) {
59 }
60 ["http\Client\Curl\Request"]=>
61 array(1) {
62 ["php.net:80"]=>
63 array(2) {
64 ["used"]=>
65 int(0)
66 ["free"]=>
67 int(0)
68 }
69 }
70 }
71 Done