Test PHP headers with PHPUnit

后端 未结 7 1445
不思量自难忘°
不思量自难忘° 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:32

    As an aside: For me headers_list() kept returning 0 elements. I noticed @titel's comment on the question and figured it deserves special mention here:

    Just wanted to cover this if there are some other people interested in this as well. headers_list() doesn't work while running PHPunit (which uses PHP CLI) but xdebug_get_headers() works instead.

    HTH

提交回复
热议问题