This commit is contained in:
thefosk
2014-03-18 11:23:33 -07:00
parent 2fb13154e2
commit 6bb573b1f6

View File

@@ -86,6 +86,23 @@ class UnirestTest extends UnitTestCase
$this->assertEqual("thefosk", $form->nick); $this->assertEqual("thefosk", $form->nick);
} }
public function testPostArray()
{
$response = Unirest::post("http://httpbin.org/post", array(
"Accept" => "application/json"
), array(
"name[0]" => "Mark",
"name[1]" => "John"
));
$this->assertEqual(200, $response->code);
$form = $response->body->form;
$this->assertEqual("Mark", $form->{"name[0]"});
$this->assertEqual("John", $form->{"name[1]"});
}
public function testPostWithDots() public function testPostWithDots()
{ {
$response = Unirest::post("http://httpbin.org/post", array( $response = Unirest::post("http://httpbin.org/post", array(
@@ -118,9 +135,6 @@ class UnirestTest extends UnitTestCase
public function testUpload() public function testUpload()
{ {
var_dump(file_get_contents(dirname(__FILE__) . "/test_upload.txt"));
$response = Unirest::post("http://httpbin.org/post", array( $response = Unirest::post("http://httpbin.org/post", array(
"Accept" => "application/json" "Accept" => "application/json"
), array( ), array(
@@ -130,8 +144,6 @@ class UnirestTest extends UnitTestCase
$this->assertEqual(200, $response->code); $this->assertEqual(200, $response->code);
$files = $response->body->files; $files = $response->body->files;
var_dump($response->body);
var_dump($files);
$this->assertEqual("This is a test", $files->file); $this->assertEqual("This is a test", $files->file);
$form = $response->body->form; $form = $response->body->form;