add pecl/http-v2 tests; release 1.0.3
[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.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(null, "php.net:80");
26
27 var_dump(raphf\stat_persistent_handles());
28
29 ?>
30 Done
31 --EXPECTF--
32 Test
33 object(stdClass)#%d (2) {
34 ["http\Client\Curl"]=>
35 array(1) {
36 ["php.net:80"]=>
37 array(2) {
38 ["used"]=>
39 int(0)
40 ["free"]=>
41 int(1)
42 }
43 }
44 ["http\Client\Curl\Request"]=>
45 array(1) {
46 ["php.net:80"]=>
47 array(2) {
48 ["used"]=>
49 int(0)
50 ["free"]=>
51 int(3)
52 }
53 }
54 }
55 object(stdClass)#%d (2) {
56 ["http\Client\Curl"]=>
57 array(1) {
58 ["php.net:80"]=>
59 array(2) {
60 ["used"]=>
61 int(0)
62 ["free"]=>
63 int(0)
64 }
65 }
66 ["http\Client\Curl\Request"]=>
67 array(1) {
68 ["php.net:80"]=>
69 array(2) {
70 ["used"]=>
71 int(0)
72 ["free"]=>
73 int(0)
74 }
75 }
76 }
77 Done