Merge branch 'v2.6.x'
[m6w6/ext-http] / tests / message003.phpt
1 --TEST--
2 multipart message
3 --SKIPIF--
4 <?php
5 include "skipif.inc";
6 ?>
7 --FILE--
8 <?php
9 $m = new http\Message(fopen(__DIR__."/data/message_r_multipart_put.txt","rb"));
10 if ($m->isMultipart($boundary)) {
11 var_dump($boundary);
12
13 foreach ($m->splitMultipartBody() as $i => $mm) {
14 echo "==$i==\n",$mm,"===\n";
15 }
16 }
17 ?>
18 DONE
19 --EXPECTF--
20 string(40) "----------------------------6e182425881c"
21 ==%d==
22 Content-Disposition: form-data; name="composer"; filename="composer.json"
23 Content-Type: application/octet-stream
24 Content-Length: 567
25
26 {
27 "name": "mike_php_net/autocracy",
28 "type": "library",
29 "description": "http\\Controller preserves your autocracy",
30 "keywords": ["http", "controller", "pecl", "pecl_http"],
31 "homepage": "http://github.com/mike-php-net/autocracy",
32 "license": "BSD-2",
33 "authors": [
34 {
35 "name": "Michael Wallner",
36 "email": "mike@php.net"
37 }
38 ],
39 "require": {
40 "php": ">=5.4.0",
41 "pecl/pecl_http": "2.*"
42 },
43 "autoload": {
44 "psr-0": {
45 "http\\Controller": "lib"
46 }
47 }
48 }
49
50 ===
51 ==%d==
52 Content-Disposition: form-data; name="LICENSE"; filename="LICENSE"
53 Content-Type: application/octet-stream
54 Content-Length: 1354
55
56 Copyright (c) 2011-2012, Michael Wallner <mike@iworks.at>.
57 All rights reserved.
58
59 Redistribution and use in source and binary forms, with or without
60 modification, are permitted provided that the following conditions are met:
61
62 * Redistributions of source code must retain the above copyright notice,
63 this list of conditions and the following disclaimer.
64 * Redistributions in binary form must reproduce the above copyright
65 notice, this list of conditions and the following disclaimer in the
66 documentation and/or other materials provided with the distribution.
67
68 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
69 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
70 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
71 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
72 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
73 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
74 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
75 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
76 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
77 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
78
79
80 ===
81 DONE