Since this question has not been answered (rightly) for 2 years, I've decided to answer it myself since I have figured out the solution since then.
The answer turns out simple than I had thought, which simply is known as 'mocking'. In this case, when testing a file/image upload script, there is no physically upload images. All can be done with refactoring and isolating the function responsible for uploading, as in ..
Example of upload class
class Upload{
function save(){
return move_uploaded_file($tmp_name, $destination);
}
}
Example of using test for the upload class
class UploadTest{
function save(){
return true;
}
}
There is nothing much into this, as method save()
does not need to be tested considering it does not rely anymore on the
class to upload the files/images