How can I write tests for file upload in PHP?

后端 未结 4 1370
小鲜肉
小鲜肉 2020-12-15 21:14

I\'m using simpleTest to write my PHP tests. I\'m writing a file upload plugin and was wondering how I may be testing it.

I would like to check that the file is corr

4条回答
  •  忘掉有多难
    2020-12-15 22:09

    For unit testing (as opposed to functional testing) try uploading a file (a short text file) to a test page, and var_dump($_FILES) and var_dump($_POST). Then you know what to populate them (or your mocks) with.

提交回复
热议问题