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