You are here

public function MultipartStreamTest::testSerializesFilesWithCustomHeaders in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/guzzlehttp/psr7/tests/MultipartStreamTest.php \GuzzleHttp\Tests\MultipartStreamTest::testSerializesFilesWithCustomHeaders()

File

vendor/guzzlehttp/psr7/tests/MultipartStreamTest.php, line 130

Class

MultipartStreamTest

Namespace

GuzzleHttp\Tests

Code

public function testSerializesFilesWithCustomHeaders() {
  $f1 = Psr7\FnStream::decorate(Psr7\stream_for('foo'), [
    'getMetadata' => function () {
      return '/foo/bar.txt';
    },
  ]);
  $b = new MultipartStream([
    [
      'name' => 'foo',
      'contents' => $f1,
      'headers' => [
        'x-foo' => 'bar',
        'content-disposition' => 'custom',
      ],
    ],
  ], 'boundary');
  $expected = <<<EOT
--boundary
x-foo: bar
content-disposition: custom
Content-Length: 3
Content-Type: text/plain

foo
--boundary--

EOT;
  $this
    ->assertEquals($expected, str_replace("\r", '', $b));
}