Esempio n. 1
0
 public function testFilenamelessUpload()
 {
     $this->setExpectedException('LogicException');
     $upload = new FormUpload();
     $upload->setContent('foobar');
     $request = new FormRequest();
     $request->setField('user[name]', 'Kris');
     $request->setField('user[image]', $upload);
     $content = $request->getContent();
 }
Esempio n. 2
0
 public function testMultipartContent()
 {
     $upload = new FormUpload();
     $upload->setContent('foobar');
     $request = new FormRequest();
     $request->setField('user[name]', 'Kris');
     $request->setField('user[image]', $upload);
     $content = $request->getContent();
     $this->assertContains("Content-Disposition: form-data; name=\"user[name]\"\r\n\r\nKris\r\n", $content);
     $this->assertContains("Content-Disposition: form-data; name=\"user[image]\"\r\nContent-Type: text/plain\r\n\r\nfoobar\r\n", $content);
 }
Esempio n. 3
0
 /**
  * @dataProvider provideClient
  */
 public function testPlus($client)
 {
     $request = new FormRequest();
     $request->fromUrl($_SERVER['TEST_SERVER']);
     $request->setField('math', '1+1=2');
     $response = new Response();
     $client->send($request, $response);
     $data = json_decode($response->getContent(), true);
     parse_str($data['INPUT'], $fields);
     $this->assertEquals(array('math' => '1+1=2'), $fields);
 }