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 <?php class FooTest extends PHPUnit_Framework_TestCase { /** * @runInSeparateProcess */ public function testBar() { header(‘Location : http://foo.com’); } … Read more