mirror of
https://github.com/php-curl-class/php-curl-class.git
synced 2026-08-30 04:01:47 +00:00
Merge pull request #232 from zachborboa/master
Add test for PATCHing a multidimensional array (#205)
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user