Hey!

I was wondering whether it is possible to test with PHPUnit if a HTTP header was sent.
It is definitely possible with PHP if run by a webserver.

e.g.
<?php
header ("Some-Header: Value");
var_dump (in_array ("Some-Header: Value", headers_list ()));
?>

However I am running my Unit Tests via PHP CLI, so HTTP Headers aren't sent and therefore headers_list () returns an empty array.

So is there anyway to test if the header function was called with a specific value from PHP CLI?

PS: I'm currently testing with Exceptions, so if HttpResponse::trigger404 () throws an Exception the header couldn't be sent otherwise it was sent, but I don't really like this solution.

Cheers,
Jay
_______________________________________________
New York PHP Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk

NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com

Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php

Reply via email to