Fix releases link
[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");
17 do {
18 $c->enqueue(new http\Client\Request("GET", "http://php.net"));
19 } while (count($c) < 3);
20
21 unset($c);
22
23 $h = (array) raphf\stat_persistent_handles();
24 var_dump(array_intersect_key($h, array_flip(preg_grep("/^http/", array_keys($h)))));
25
26
27 raphf\clean_persistent_handles("http\\Client\\Curl");
28 raphf\clean_persistent_handles("http\\Client\\Curl\\Request", "PHP:php.net:80");
29
30 $h = (array) raphf\stat_persistent_handles();
31 var_dump(array_intersect_key($h, array_flip(preg_grep("/^http/", array_keys($h)))));
32
33 ?>
34 Done
35 --EXPECTF--
36 Test
37 array(2) {
38 ["http\Client\Curl"]=>
39 array(1) {
40 ["PHP"]=>
41 array(2) {
42 ["used"]=>
43 int(0)
44 ["free"]=>
45 int(1)
46 }
47 }
48 ["http\Client\Curl\Request"]=>
49 array(1) {
50 ["PHP:php.net:80"]=>
51 array(2) {
52 ["used"]=>
53 int(0)
54 ["free"]=>
55 int(3)
56 }
57 }
58 }
59 array(2) {
60 ["http\Client\Curl"]=>
61 array(0) {
62 }
63 ["http\Client\Curl\Request"]=>
64 array(1) {
65 ["PHP:php.net:80"]=>
66 array(2) {
67 ["used"]=>
68 int(0)
69 ["free"]=>
70 int(0)
71 }
72 }
73 }
74 Done