How to test PHP headers with PHPUnit?

Posted by Prem Tiwari | Updated on | PHPUnit

Want to test PHP headers with PHPUnit? The issue is that PHPUnit will print a header to the screen and at that point you can’t add more headers. The work around is to run the test in an isolated process.

Here is an example:

The output will be like:


If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.

Related Questions & Answers