Fix releases link
[m6w6/ext-raphf] / tests / http004.phpt
1 --TEST--
2 pecl/http-v2 - partial clean
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 $h = (array) raphf\stat_persistent_handles();
17 var_dump(array_intersect_key($h, array_flip(preg_grep("/^http/", array_keys($h)))));
18
19 $c = new http\Client("curl", "PHP");
20 $c2 = new http\Client("curl", "PHP");
21 do {
22 $c->enqueue(new http\Client\Request("GET", "http://php.net"));
23 $c2->enqueue(new http\Client\Request("GET", "http://php.net"));
24 } while (count($c) < 3);
25
26 $h = (array) raphf\stat_persistent_handles();
27 var_dump(array_intersect_key($h, array_flip(preg_grep("/^http/", array_keys($h)))));
28
29 unset($c);
30
31 $h = (array) raphf\stat_persistent_handles();
32 var_dump(array_intersect_key($h, array_flip(preg_grep("/^http/", array_keys($h)))));
33
34 raphf\clean_persistent_handles();
35
36 $h = (array) raphf\stat_persistent_handles();
37 var_dump(array_intersect_key($h, array_flip(preg_grep("/^http/", array_keys($h)))));
38
39 ?>
40 Done
41 --EXPECTF--
42 Test
43 array(2) {
44 ["http\Client\Curl"]=>
45 array(0) {
46 }
47 ["http\Client\Curl\Request"]=>
48 array(0) {
49 }
50 }
51 array(2) {
52 ["http\Client\Curl"]=>
53 array(1) {
54 ["PHP"]=>
55 array(2) {
56 ["used"]=>
57 int(2)
58 ["free"]=>
59 int(0)
60 }
61 }
62 ["http\Client\Curl\Request"]=>
63 array(1) {
64 ["PHP:php.net:80"]=>
65 array(2) {
66 ["used"]=>
67 int(6)
68 ["free"]=>
69 int(0)
70 }
71 }
72 }
73 array(2) {
74 ["http\Client\Curl"]=>
75 array(1) {
76 ["PHP"]=>
77 array(2) {
78 ["used"]=>
79 int(1)
80 ["free"]=>
81 int(1)
82 }
83 }
84 ["http\Client\Curl\Request"]=>
85 array(1) {
86 ["PHP:php.net:80"]=>
87 array(2) {
88 ["used"]=>
89 int(3)
90 ["free"]=>
91 int(3)
92 }
93 }
94 }
95 array(2) {
96 ["http\Client\Curl"]=>
97 array(1) {
98 ["PHP"]=>
99 array(2) {
100 ["used"]=>
101 int(1)
102 ["free"]=>
103 int(0)
104 }
105 }
106 ["http\Client\Curl\Request"]=>
107 array(1) {
108 ["PHP:php.net:80"]=>
109 array(2) {
110 ["used"]=>
111 int(3)
112 ["free"]=>
113 int(0)
114 }
115 }
116 }
117 Done