Exemplo n.º 1
0
 public function testApplyingWithFilesAddsMultipartUpload()
 {
     $b = new PostBody();
     $p = new PostFile('foo', fopen(__FILE__, 'r'));
     $b->addFile($p);
     $this->assertEquals([$p], $b->getFiles());
     $this->assertNull($b->getFile('missing'));
     $this->assertSame($p, $b->getFile('foo'));
     $m = new Request('POST', '/');
     $b->applyRequestHeaders($m);
     $this->assertContains('multipart/form-data', $m->getHeader('Content-Type'));
     $this->assertTrue($m->hasHeader('Content-Length'));
 }