Make HTTPInputData dynamic

- Removing DI:: dependency inside App class
- Making testability easier & adapting tests
This commit is contained in:
Philipp 2021-11-28 14:01:13 +01:00 committed by Hypolite Petovan
parent 2e4d654c0a
commit 9cec38f916
5 changed files with 54 additions and 57 deletions

View file

@ -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);
}
}