0da72d00ba9f0d2b2c683898314d61e03a746799
[m6w6/ext-http] / tests / client002.phpt
1 --TEST--
2 client observer
3 --SKIPIF--
4 <?php
5 include "skipif.inc";
6 skip_client_test();
7 ?>
8 --FILE--
9 <?php
10
11 include "helper/server.inc";
12
13 echo "Test\n";
14
15 class Observer implements SplObserver
16 {
17 #[ReturnTypeWillChange]
18 function update(SplSubject $client, http\Client\Request $request = null, StdClass $progress = null) {
19 echo "P";
20 if ($progress->info !== "prepare" && $client->getProgressInfo($request) != $progress) {
21 var_dump($progress);
22 }
23 }
24 }
25
26 server("proxy.inc", function($port, $stdin, $stdout, $stderr) {
27 foreach (http\Client::getAvailableDrivers() as $driver) {
28 $client = new http\Client($driver);
29 $client->attach(new Observer);
30 $client->enqueue(new http\Client\Request("GET", "http://localhost:$port/"));
31 $client->send();
32 }
33 });
34
35 ?>
36
37 Done
38 --EXPECTREGEX--
39 Test
40 P+
41 Done