Would occasionally be useful to use FauxRequest for internal API stuff with files.
Something like this maybe?
class FauxWebRequestUpload extends WebRequestUpload {
public function __construct($request, $filedata) {
$tmp = tempnam(sys_get_temp_dir(), 'fakeupload');
file_put_contents($tmp, $filedata);
$this->doesExist = true;
$this->fileInfo = array(
'name' => $tmp,
'type' => 'application/octet-stream',
'size' => strlen($filedata),
'tmp_name' => $tmp
);
}}
class FauxRequest {
...
function addUpload( $name, $filedata ) {
$this->uploads[$name] = new FauxWebRequestUpload($this, $filedata);
}...
function getUpload( $name ) {
return $this->uploads[$name];
}...
}
Or possibly allow passing FauxWebRequestUploads directly into the parameters.
Version: 1.22.0
Severity: enhancement