My blog, keeping you up-to-date on my latest news.


Testing upload file with php

PHP • 2012-12-29


A few days ago I've been wondering how to test file upload with PHPUnit.
PHPUnit is the de-facto standard for unit testing in PHP projects. It provides both a framework that makes the writing of tests easy as well as the functionality to easily run the tests and analyse their results.
But some fonctions are safe and can't be executed in other scope than HTTP POST like is_uploaded_file and move_uploaded_file.
You will find in this article some useful tips allowing you to test reliability of you applicaton, concerning file upload.