update test
[m6w6/ext-http] / tests / client010.phpt
1 --TEST--
2 client upload
3 --SKIPIF--
4 <?php
5 include "skipif.inc";
6 skip_online_test();
7 ?>
8 --FILE--
9 <?php
10 echo "Test\n";
11
12 $RE =
13 '/(Array
14 \(
15 \[upload\] \=\> Array
16 \(
17 \[name\] \=\> client010\.php
18 \[type\] \=\> text\/plain
19 \[tmp_name\] \=\> .+
20 \[error\] \=\> 0
21 \[size\] \=\> \d+
22 \)
23
24 \)
25 )+/';
26 $request = new http\Client\Request("POST", "http://dev.iworks.at/ext-http/.print_request.php");
27 $request->getBody()->addForm(null, array("file"=>__FILE__, "name"=>"upload", "type"=>"text/plain"));
28
29 foreach (http\Client::getAvailableDrivers() as $driver) {
30 $client = new http\Client($driver);
31 $client->enqueue($request)->send();
32 if (!preg_match($RE, $s = $client->getResponse()->getBody()->toString())) {
33 echo($s);
34 }
35 }
36 ?>
37 Done
38 --EXPECT--
39 Test
40 Done