当使用PHPUnit
测试的PHP
代码中包含session_start()
时,就会出现以下的错误提示:
PHPUnit 4.8.36 by Sebastian Bergmann and contributors. E Time: 110 ms, Memory: 12.00MB There was 1 error: 1) ExampleTest::testBasicExample ErrorException: session_start(): Cannot start session when headers already sent
解决办法是打开phpunit.xml
文件,设置processIsolation
属性为true