From bc96a04df41afa918ea93ba191ace447c31f0fc9 Mon Sep 17 00:00:00 2001 From: php-curl-class Date: Fri, 23 Aug 2013 17:09:45 -0700 Subject: [PATCH] Add ability to POST multidimensional array of data --- tests/run.php | 13 +++++++++++++ tests/server.php | 4 ++++ 2 files changed, 17 insertions(+) diff --git a/tests/run.php b/tests/run.php index 5e8848b..9ec5003 100644 --- a/tests/run.php +++ b/tests/run.php @@ -43,6 +43,19 @@ class CurlTest extends PHPUnit_Framework_TestCase { )) === 'post'); } + public function testPostMultidimensionalData() { + $test = new Test(); + $this->assertTrue($test->server('POST', array( + 'test' => 'post_multidimensional', + 'key' => 'file', + 'file' => array( + 'wibble', + 'wubble', + 'wobble', + ), + )) === '{"test":"post_multidimensional","key":"file","file":["wibble","wubble","wobble"]}'); + } + public function testPostFilePathUpload() { $file_path = get_png(); diff --git a/tests/server.php b/tests/server.php index 49d156f..bad33a8 100644 --- a/tests/server.php +++ b/tests/server.php @@ -19,6 +19,10 @@ if ($test == 'http_basic_auth') { )); exit; } +else if ($test === 'post_multidimensional') { + echo json_encode($_POST); + exit; +} else if ($test === 'post_file_path_upload') { echo mime_content_type($_FILES[$key]['tmp_name']); exit;