mirror of
https://github.com/friendica/friendica
synced 2025-05-01 09:04:24 +02:00
Make HTTPInputData dynamic
- Removing DI:: dependency inside App class - Making testability easier & adapting tests
This commit is contained in:
parent
2e4d654c0a
commit
9cec38f916
5 changed files with 54 additions and 57 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue