We do this in core for the parser tests. In
/tests/parser/ParserTestRunner.php, a fake-ish upload backend is
created, and several files "uploaded" into it. See createRepoGroup() for
creating the backends, setupUploads() (and setupUploadBackend()) for
creating the uploads, and teardownUploadBackend() for cleaning them up
afterwards. I'm not sure how easy this code will be to extricate…
--
Bartosz Dziewoński