In PHP, file uploads can be tested using phpt files as explained
here. However, when I wanted to execute phpt test with --POST_RAW-- or --POST-- sections, pear run-tests was giving an error that:
--cgi option needed for this test, type 'pear help run-tests'
My phpt file was as follows: The layout of phpt files is explained
here. To overcome this problem I installed php5-cgi package for ubuntu
sudo apt-get install php5-cgi
This allowed for correct execution of the test
pear run-tests --cgi=/usr/lib/cgi-bin/php5 example-upload.phpt
Running 1 tests
PASS Example test emulating a file upload[example-upload.phpt]
TOTAL TIME: 00:00
1 PASSED TESTS
0 SKIPPED TESTS