Merge branch 'http-input-data' of github.com:annando/friendica into http-input-data

This commit is contained in:
Michael 2021-05-24 04:33:46 +00:00
commit 436d5b4759
3 changed files with 42 additions and 6 deletions

View file

@ -27,6 +27,7 @@ use Friendica\Util\HTTPInputData;
/**
* Testing HTTPInputData
*
* @see HTTPInputData
*/
class HTTPInputDataTest extends MockedTest
@ -35,6 +36,7 @@ class HTTPInputDataTest extends MockedTest
* Returns the data stream for the unit test
* Each array element of the first hierarchy represents one test run
* Each array element of the second hierarchy represents the parameters, passed to the test function
*
* @return array[]
*/
public function dataStream()
@ -91,16 +93,17 @@ class HTTPInputDataTest extends MockedTest
/**
* Tests the HTTPInputData::process() method
* @see HTTPInputData::process()
* @param string $contenttype The content typer of the transmitted data
*
* @param string $contentType The content typer of the transmitted data
* @param string $input The input, we got from the data stream
* @param array $expected The expected output
*
* @dataProvider dataStream
* @see HTTPInputData::process()
*/
public function testHttpInput(string $contenttype, string $input, array $expected)
public function testHttpInput(string $contentType, string $input, array $expected)
{
$_SERVER['CONTENT_TYPE'] = $contenttype;
HTTPInputDataDouble::setPhpInputContentType($contentType);
HTTPInputDataDouble::setPhpInputContent($input);
$stream = fopen('php://memory', 'r+');
fwrite($stream, $input);