]> git.mxchange.org Git - friendica.git/blobdiff - tests/src/Util/HTTPInputDataTest.php
Merge remote-tracking branch 'upstream/2021.12-rc' into api-fixes
[friendica.git] / tests / src / Util / HTTPInputDataTest.php
index 55328e7a431d4347ea75aa37807c4fb9f49b7e33..0d7c3938b50f94e5f13a0c51661f7c86e44b207e 100644 (file)
@@ -66,7 +66,7 @@ class HTTPInputDataTest extends MockedTest
                        ],
                        'multipart-file' => [
                                'contenttype' => 'multipart/form-data;boundary=6d4d5a40-651a-4468-a62e-5a6ca2bf350d;charset=utf8',
-                               'input'       => file_get_contents(__DIR__ . '/../../datasets/http/multipart.httpinput'),
+                               'input'       => file_get_contents(__DIR__ . '/../../datasets/http/multipart-file.httpinput'),
                                'expected'    => [
                                        'variables' => [
                                                'display_name'      => 'Vorname Nachname',
@@ -86,14 +86,14 @@ class HTTPInputDataTest extends MockedTest
                                                'avatar' => [
                                                        'name'     => '8ZUCS34Y5XNH',
                                                        'type'     => 'image/png',
-                                                       'tmp_name' => '/tmp/phpf85nKJ',
+                                                       'tmp_name' => '8ZUCS34Y5XNH',
                                                        'error'    => 0,
                                                        'size'     => 349330
                                                ],
                                                'header' => [
                                                        'name'     => 'V2B6Z1IICGPM',
                                                        'type'     => 'image/png',
-                                                       'tmp_name' => '/tmp/phpe3sqHT',
+                                                       'tmp_name' => 'V2B6Z1IICGPM',
                                                        'error'    => 0,
                                                        'size'     => 1323635
                                                ]
@@ -139,14 +139,15 @@ class HTTPInputDataTest extends MockedTest
         */
        public function testHttpInput(string $contentType, string $input, array $expected)
        {
-               HTTPInputDataDouble::setPhpInputContentType($contentType);
-               HTTPInputDataDouble::setPhpInputContent($input);
+               $httpInput = new HTTPInputDataDouble(['CONTENT_TYPE' => $contentType]);
+               $httpInput->setPhpInputContent($input);
+
                $stream = fopen('php://memory', 'r+');
                fwrite($stream, $input);
                rewind($stream);
 
-               HTTPInputDataDouble::setPhpInputStream($stream);
-               $output = HTTPInputDataDouble::process();
+               $httpInput->setPhpInputStream($stream);
+               $output = $httpInput->process();
                $this->assertEqualsCanonicalizing($expected, $output);
        }
 }