raphf
[m6w6/ext-http] / tests / persistenthandles001.phpt
1 --TEST--
2 persistent handles
3 --SKIPIF--
4 <?php include "skipif.inc"; ?>
5 --FILE--
6 <?php
7 $f = new http\Client\Factory(array("persistentHandleId" => "foo"));
8 $r = $f->createClient()->setRequest(new http\Client\Request("GET", "http://dev.iworks.at"))
9 ->setOptions(array("connecttimeout"=> 90, "timeout" =>300))
10 ->send(null);
11 $f = new http\Client\Factory(array("persistentHandleId" => "bar"));
12 $r = $f->createClient()->setRequest(new http\Client\Request("GET", "http://dev.iworks.at"))
13 ->setOptions(array("connecttimeout"=> 90, "timeout" =>300));
14
15 var_dump(http\Env::statPersistentHandles());
16 http\Env::cleanPersistentHandles();
17 var_dump(http\Env::statPersistentHandles());
18
19 $r->send(null);
20
21 var_dump(http\Env::statPersistentHandles());
22 ?>
23 DONE
24 --EXPECTF--
25 object(stdClass)#%d (3) {
26 ["http_client.curl"]=>
27 array(2) {
28 ["foo"]=>
29 array(2) {
30 ["used"]=>
31 int(0)
32 ["free"]=>
33 int(1)
34 }
35 ["bar"]=>
36 array(2) {
37 ["used"]=>
38 int(1)
39 ["free"]=>
40 int(0)
41 }
42 }
43 ["http_client_pool.curl"]=>
44 array(0) {
45 }
46 ["http_client_datashare.curl"]=>
47 array(0) {
48 }
49 }
50 object(stdClass)#%d (3) {
51 ["http_client.curl"]=>
52 array(1) {
53 ["bar"]=>
54 array(2) {
55 ["used"]=>
56 int(1)
57 ["free"]=>
58 int(0)
59 }
60 }
61 ["http_client_pool.curl"]=>
62 array(0) {
63 }
64 ["http_client_datashare.curl"]=>
65 array(0) {
66 }
67 }
68 object(stdClass)#%d (3) {
69 ["http_client.curl"]=>
70 array(1) {
71 ["bar"]=>
72 array(2) {
73 ["used"]=>
74 int(1)
75 ["free"]=>
76 int(0)
77 }
78 }
79 ["http_client_pool.curl"]=>
80 array(0) {
81 }
82 ["http_client_datashare.curl"]=>
83 array(0) {
84 }
85 }
86 DONE