public function testMultipartFiles() { $fixture = __DIR__ . '/fixtures/upload.txt'; $data = array('foo' => 'bar', 'bar' => 'baz'); $files = array('test' => $fixture); $body = Body::Multipart($data, $files); // echo $body; $this->assertEquals($body, array('foo' => 'bar', 'bar' => 'baz', 'test' => Body::File($fixture))); }
public function testUploadIfFilePartOfData() { $fixture = __DIR__ . '/../fixtures/upload.txt'; $response = Request::post('http://mockbin.com/request', array('Accept' => 'application/json'), array('name' => 'Mark', 'files[owl.gif]' => Request\Body::File($fixture))); $this->assertEquals(200, $response->code); $this->assertEquals('POST', $response->body->method); $this->assertEquals('Mark', $response->body->postData->params->name); $this->assertEquals('This is a test', $response->body->postData->params->{'files[owl.gif]'}); }