]> git.mxchange.org Git - friendica.git/commitdiff
Adapt tests using a content file
authorPhilipp <admin@philipp.info>
Sun, 23 May 2021 18:30:27 +0000 (20:30 +0200)
committerPhilipp <admin@philipp.info>
Sun, 23 May 2021 18:30:27 +0000 (20:30 +0200)
src/Util/HTTPInputData.php
tests/datasets/http/example1.httpinput [new file with mode: 0644]
tests/src/Util/HTTPInputDataTest.php

index aebae9ac20e834b44ff73dead96e8d9341f63352..322a462f12a0a79771ab2f9eb74208d0f1538b37 100644 (file)
@@ -271,7 +271,7 @@ class HTTPInputData
        }
 
        /**
        }
 
        /**
-        * Returns the content of tje current PHP input
+        * Returns the content of the current PHP input
         * Mainly used for test doubling
         * @return false|string
         */
         * Mainly used for test doubling
         * @return false|string
         */
diff --git a/tests/datasets/http/example1.httpinput b/tests/datasets/http/example1.httpinput
new file mode 100644 (file)
index 0000000..24cef8c
--- /dev/null
@@ -0,0 +1,3 @@
+anything you want
+As you
+like it
index f1deaa7ffa5c2365a06605a4c2da0f6461c7aa66..a343e1a76e41e66ad3d0e89f1487895c75e0097c 100644 (file)
@@ -41,11 +41,11 @@ class HTTPInputDataTest extends MockedTest
        {
                return [
                        'example' => [
        {
                return [
                        'example' => [
-                               'input'    => 'anything you want',
+                               'input'    => file_get_contents(__DIR__ . '/../../datasets/http/example1.httpinput'),
                                'expected' => [
                                        'variables' => [
                                'expected' => [
                                        'variables' => [
-                                               'var1' => 'value',
-                                               'var2' => 'value',
+                                               'var1' => 'value1',
+                                               'var2' => 'value2',
                                        ],
                                        'files' => []
                                ]
                                        ],
                                        'files' => []
                                ]
@@ -69,6 +69,6 @@ class HTTPInputDataTest extends MockedTest
 
                HTTPInputDataDouble::setPhpInputStream($stream);
                $output = HTTPInputDataDouble::process();
 
                HTTPInputDataDouble::setPhpInputStream($stream);
                $output = HTTPInputDataDouble::process();
-               $this->assertEqualsCanonicalizing($output, $expected);
+               $this->assertEqualsCanonicalizing($expected, $output);
        }
 }
        }
 }