https://bugzilla.wikimedia.org/show_bug.cgi?id=46163
Web browser: ---
Bug ID: 46163
Summary: FauxRequest should allow for adding fake files
Product: MediaWiki
Version: unspecified
Hardware: All
OS: All
Status: NEW
Severity: enhancement
Priority: Unprioritized
Component: General/Unknown
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected]
Classification: Unclassified
Mobile Platform: ---
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.
--
You are receiving this mail because:
You are on the CC list for the bug.
You are the assignee for the bug.
You are watching all bug changes.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l