diff --git a/tests/datasets/http/form-urlencoded-json.httpinput b/tests/datasets/http/form-urlencoded-json.httpinput new file mode 100644 index 0000000000..1970e30800 --- /dev/null +++ b/tests/datasets/http/form-urlencoded-json.httpinput @@ -0,0 +1 @@ +{"media_ids":[],"sensitive":false,"status":"Test Status","visibility":"private","spoiler_text":"Title"} \ No newline at end of file diff --git a/tests/datasets/http/form-urlencoded.httpinput b/tests/datasets/http/form-urlencoded.httpinput new file mode 100644 index 0000000000..3a71aff994 --- /dev/null +++ b/tests/datasets/http/form-urlencoded.httpinput @@ -0,0 +1 @@ +title=Test2 \ No newline at end of file diff --git a/tests/datasets/http/example1.httpinput b/tests/datasets/http/multipart.httpinput similarity index 100% rename from tests/datasets/http/example1.httpinput rename to tests/datasets/http/multipart.httpinput diff --git a/tests/src/Util/HTTPInputDataTest.php b/tests/src/Util/HTTPInputDataTest.php index a4e3ce20df..19e87e438a 100644 --- a/tests/src/Util/HTTPInputDataTest.php +++ b/tests/src/Util/HTTPInputDataTest.php @@ -40,9 +40,9 @@ class HTTPInputDataTest extends MockedTest public function dataStream() { return [ - 'example' => [ + 'multipart' => [ 'contenttype' => 'multipart/form-data;boundary=43395968-f65c-437e-b536-5b33e3e3c7e5;charset=utf8', - 'input' => file_get_contents(__DIR__ . '/../../datasets/http/example1.httpinput'), + 'input' => file_get_contents(__DIR__ . '/../../datasets/http/multipart.httpinput'), 'expected' => [ 'variables' => [ 'display_name' => 'User Name', @@ -61,6 +61,30 @@ class HTTPInputDataTest extends MockedTest ], 'files' => [] ] + ], + 'form-urlencoded' => [ + 'contenttype' => 'application/x-www-form-urlencoded;charset=utf8', + 'input' => file_get_contents(__DIR__ . '/../../datasets/http/form-urlencoded.httpinput'), + 'expected' => [ + 'variables' => [ + 'title' => 'Test2', + ], + 'files' => [] + ] + ], + 'form-urlencoded-json' => [ + 'contenttype' => 'application/x-www-form-urlencoded;charset=utf8', + 'input' => file_get_contents(__DIR__ . '/../../datasets/http/form-urlencoded-json.httpinput'), + 'expected' => [ + 'variables' => [ + 'media_ids' => [], + 'sensitive' => false, + 'status' => 'Test Status', + 'visibility' => 'private', + 'spoiler_text' => 'Title' + ], + 'files' => [] + ] ] ]; }