I am trying to simulate an image file upload but unable to bypass the file validation(because it calls is_uploaded_file to verify the file is actually uploaded) and my code uses move_uploaded_files to upload the files.

I am using the fzaninotto/faker library to generate image for test.

function file_upload_test()
    $_FILES = [
        'image' => [
            'name' => 'image.jpg',
            'tmp' => $this->faker->image(), 
            'type' => 'image/jpeg',
            'size' => 100,
            'error' => 0,



Any solutions?