Merge pull request #232 from zachborboa/master

Add test for PATCHing a multidimensional array (#205)
This commit is contained in:
Zach Borboa
2015-08-20 00:55:56 -07:00
2 changed files with 20 additions and 0 deletions
+16
View File
@@ -409,6 +409,22 @@ class CurlTest extends PHPUnit_Framework_TestCase
$this->assertEquals('PATCH', $test->server('request_method', 'PATCH'));
}
public function testPatchRequestMethodWithMultidimArray()
{
$data = array(
'data' => array(
'foo' => 'bar',
'wibble' => 'wubble',
),
);
$curl = new Curl();
$curl->setHeader('X-DEBUG-TEST', 'data_values');
$curl->patch(Test::TEST_URL, $data);
$this->assertEquals('{"data":{"foo":"bar","wibble":"wubble"}}', $curl->rawResponse);
$this->assertEquals(json_decode(json_encode($data), false), $curl->response);
}
public function testDeleteRequestMethod()
{
$test = new Test();
+4
View File
@@ -236,6 +236,10 @@ if ($test == 'http_basic_auth') {
'delete' => $_DELETE,
));
exit;
} elseif ($test === 'data_values') {
header('Content-Type: application/json');
echo json_encode($data_values);
exit;
}
header('Content-Type: text/plain');