Add ContentType Injection for HTTPInputData tests

This commit is contained in:
Philipp 2021-05-23 22:40:41 +02:00
parent a69e128fe4
commit 15216266d9
No known key found for this signature in database
GPG key ID: 9A28B7D4FF5667BD
3 changed files with 42 additions and 6 deletions

View file

@ -33,9 +33,12 @@ class HTTPInputDataDouble extends HTTPInputData
protected static $injectedStream = false;
/** @var false|string */
protected static $injectedContent = false;
/** @var false|string */
protected static $injectedContentType = false;
/**
* injects the PHP input stream for a test
*
* @param false|resource $stream
*/
public static function setPhpInputStream($stream)
@ -45,6 +48,7 @@ class HTTPInputDataDouble extends HTTPInputData
/**
* injects the PHP input content for a test
*
* @param false|string $content
*/
public static function setPhpInputContent($content)
@ -52,6 +56,16 @@ class HTTPInputDataDouble extends HTTPInputData
self::$injectedContent = $content;
}
/**
* injects the PHP input content type for a test
*
* @param false|string $contentType
*/
public static function setPhpInputContentType($contentType)
{
self::$injectedContentType = $contentType;
}
/** {@inheritDoc} */
protected static function getPhpInputStream()
{
@ -63,4 +77,10 @@ class HTTPInputDataDouble extends HTTPInputData
{
return static::$injectedContent;
}
/** {@inheritDoc} */
protected static function getContentType()
{
return static::$injectedContentType;
}
}