Test PHP headers with PHPUnit

后端 未结 7 1457
不思量自难忘°
不思量自难忘° 2020-11-30 22:05

I\'m trying to use PHPunit to test a class that outputs some custom headers.

The problem is that on my machine this:



        
7条回答
  •  没有蜡笔的小新
    2020-11-30 22:33

    An alternative solution to @runInSeparateProcess is to specify the --process-isolation option when running PHPUnit:

    name@host [~/test]# phpunit --process-isolation HeadersTest.php
    

    That is analogous to set the processIsolation="true" option in phpunit.xml.

    This solution has similar advantages/disadvantages to specifying the --stderr option, which however did not work in my case. Basically no code changes are necessary, even though there may be a performance hit due to running each test in a separate PHP process.

提交回复
热议问题