Merge branch 'master' into phpng
[m6w6/ext-http] / tests / client016.phpt
1 --TEST--
2 client once & wait with events
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 $request = new http\Client\Request("GET", "http://www.example.org/");
20
21 foreach (http\Client::getAvailableDrivers() as $driver) {
22 $client = new http\Client($driver);
23 $client->enableEvents(true);
24 $client->enqueue($request);
25
26 while ($client->once()) {
27 $client->wait(.1);
28 }
29
30 if (!$client->getResponse()) {
31 var_dump($client);
32 }
33 }
34 ?>
35 Done
36 --EXPECT--
37 Test
38 Done