Browse Source

Two (hopefully) easy tests added

pull/10294/head
Michael 8 months ago
parent
commit
49c2431f1f
  1. 1
      tests/datasets/http/form-urlencoded-json.httpinput
  2. 1
      tests/datasets/http/form-urlencoded.httpinput
  3. 0
      tests/datasets/http/multipart.httpinput
  4. 28
      tests/src/Util/HTTPInputDataTest.php

1
tests/datasets/http/form-urlencoded-json.httpinput

@ -0,0 +1 @@
{"media_ids":[],"sensitive":false,"status":"Test Status","visibility":"private","spoiler_text":"Title"}

1
tests/datasets/http/form-urlencoded.httpinput

@ -0,0 +1 @@
title=Test2

0
tests/datasets/http/example1.httpinput → tests/datasets/http/multipart.httpinput

28
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' => []
]
]
];
}

Loading…
Cancel
Save