]> git.mxchange.org Git - friendica.git/blobdiff - tests/src/Util/HTTPInputDataTest.php
Merge branch 'stable' into develop
[friendica.git] / tests / src / Util / HTTPInputDataTest.php
index f50755a30f94f36c5eedddbdcf7883a60126a76f..5e8fd228fd0b8fddd6c3ad88d923969f6b96a1f1 100644 (file)
@@ -42,9 +42,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',
@@ -63,6 +63,66 @@ class HTTPInputDataTest extends MockedTest
                                        ],
                                        'files' => []
                                ]
+                       ],
+                       'multipart-file' => [
+                               'contenttype' => 'multipart/form-data;boundary=6d4d5a40-651a-4468-a62e-5a6ca2bf350d;charset=utf8',
+                               'input'       => file_get_contents(__DIR__ . '/../../datasets/http/multipart-file.httpinput'),
+                               'expected'    => [
+                                       'variables' => [
+                                               'display_name'      => 'Vorname Nachname',
+                                               'note'              => 'About me',
+                                               'fields_attributes' => [
+                                                       0 => [
+                                                               'name'  => 'variable 1',
+                                                               'value' => 'value 1',
+                                                       ],
+                                                       1 => [
+                                                               'name'  => 'variable 2',
+                                                               'value' => 'value 2',
+                                                       ]
+                                               ]
+                                       ],
+                                       'files' => [
+                                               'avatar' => [
+                                                       'name'     => '8ZUCS34Y5XNH',
+                                                       'type'     => 'image/png',
+                                                       'tmp_name' => '8ZUCS34Y5XNH',
+                                                       'error'    => 0,
+                                                       'size'     => 349330
+                                               ],
+                                               'header' => [
+                                                       'name'     => 'V2B6Z1IICGPM',
+                                                       'type'     => 'image/png',
+                                                       'tmp_name' => 'V2B6Z1IICGPM',
+                                                       'error'    => 0,
+                                                       'size'     => 1323635
+                                               ]
+                                       ]
+                               ]
+                       ],
+                       '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' => []
+                               ]
                        ]
                ];
        }