public function MultipartStreamTest::testSerializesFilesWithCustomHeadersAndMultipleValues in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/guzzlehttp/psr7/tests/MultipartStreamTest.php \GuzzleHttp\Tests\MultipartStreamTest::testSerializesFilesWithCustomHeadersAndMultipleValues()
File
- vendor/
guzzlehttp/ psr7/ tests/ MultipartStreamTest.php, line 164
Class
Namespace
GuzzleHttp\TestsCode
public function testSerializesFilesWithCustomHeadersAndMultipleValues() {
$f1 = Psr7\FnStream::decorate(Psr7\stream_for('foo'), [
'getMetadata' => function () {
return '/foo/bar.txt';
},
]);
$f2 = Psr7\FnStream::decorate(Psr7\stream_for('baz'), [
'getMetadata' => function () {
return '/foo/baz.jpg';
},
]);
$b = new MultipartStream([
[
'name' => 'foo',
'contents' => $f1,
'headers' => [
'x-foo' => 'bar',
'content-disposition' => 'custom',
],
],
[
'name' => 'foo',
'contents' => $f2,
'headers' => [
'cOntenT-Type' => 'custom',
],
],
], 'boundary');
$expected = <<<EOT
--boundary
x-foo: bar
content-disposition: custom
Content-Length: 3
Content-Type: text/plain
foo
--boundary
cOntenT-Type: custom
Content-Disposition: form-data; name="foo"; filename="baz.jpg"
Content-Length: 3
baz
--boundary--
EOT;
$this
->assertEquals($expected, str_replace("\r", '', $b));
}