Merge branch 'master' into phpng
[m6w6/ext-http] / tests / client015.phpt
1 --TEST--
2 http client event base
3 --SKIPIF--
4 <?php
5 include "skipif.inc";
6 try {
7 $client = new http\Client;
8 if (!$client->enableEvents())
9 throw new Exception("need events support");
10 } catch (Exception $e) {
11 die("skip ".$e->getMessage());
12 }
13 skip_online_test();
14 ?>
15 --FILE--
16 <?php
17 echo "Test\n";
18
19 $client1 = new http\Client;
20 $client2 = new http\Client;
21
22 $client1->enableEvents();
23 $client2->enableEvents();
24
25 $client1->enqueue(new http\Client\Request("GET", "http://www.google.ca/"));
26 $client2->enqueue(new http\Client\Request("GET", "http://www.google.co.uk/"));
27
28 $client1->send();
29
30 if (($r = $client1->getResponse())) {
31 var_dump($r->getTransferInfo("response_code"));
32 }
33 if (($r = $client2->getResponse())) {
34 var_dump($r->getTransferInfo("response_code"));
35 }
36
37 ?>
38 DONE
39 --EXPECT--
40 Test
41 int(200)
42 DONE