travis
[m6w6/ext-raphf] / tests / http003.phpt
1 --TEST--
2 pecl/http-v2 - clean with id only
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 raphf\clean_persistent_handles(null, "PHP");
27 raphf\clean_persistent_handles(null, "PHP:php.net:80");
28
29 $h = (array) raphf\stat_persistent_handles();
30 var_dump(array_intersect_key($h, array_flip(preg_grep("/^http/", array_keys($h)))));
31
32 ?>
33 Done
34 --EXPECTF--
35 Test
36 array(2) {
37 ["http\Client\Curl"]=>
38 array(1) {
39 ["PHP"]=>
40 array(2) {
41 ["used"]=>
42 int(0)
43 ["free"]=>
44 int(1)
45 }
46 }
47 ["http\Client\Curl\Request"]=>
48 array(1) {
49 ["PHP:php.net:80"]=>
50 array(2) {
51 ["used"]=>
52 int(0)
53 ["free"]=>
54 int(3)
55 }
56 }
57 }
58 array(2) {
59 ["http\Client\Curl"]=>
60 array(1) {
61 ["PHP"]=>
62 array(2) {
63 ["used"]=>
64 int(0)
65 ["free"]=>
66 int(0)
67 }
68 }
69 ["http\Client\Curl\Request"]=>
70 array(1) {
71 ["PHP:php.net:80"]=>
72 array(2) {
73 ["used"]=>
74 int(0)
75 ["free"]=>
76 int(0)
77 }
78 }
79 }
80 Done