dongshen3352 2014-04-24 13:39 采纳率: 0%
浏览 60

无法发送会话cookie - 标头已经发送过PHPUnit / Laravel

I have this strange problem when i call the parent::setUp() on my TestCase class for unit test a class when i run phpunit it throw me this error:

1) MatchRequestRepositoryTest::test_find_requests_by_match_id ErrorException: session_start(): Cannot send session cookie - headers already sent by (output started at /var/www/project.dev/vendor/phpunit/phpunit/PHPUnit/TextUI/TestRunner.php:459)

What can be the problem? Thanks for any help.

  • 写回答

2条回答 默认 最新

  • doushengyou2617 2016-06-27 03:21
    关注

    One way to handle this in PHPUnit is to send output to stderr instead of stdout as is demonstrated by this answer.

    phpunit --stderr
    

    Or by adding stderr="true" in your phpunit.xml as is pointed out in this comment.

    评论

报告相同问题?