By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,664 Members | 1,656 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,664 IT Pros & Developers. It's quick & easy.

How to determine if a function has set a cookie?

P: n/a

I'm using PHPUnit to test some PHP scripts and I'd like to know if there
is a means of checking which cookies have been set by setcookie() in a
function under test.

--
Ian Collins.
Feb 12 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Rik
Ian Collins wrote:
I'm using PHPUnit to test some PHP scripts and I'd like to know if there
is a means of checking which cookies have been set by setcookie() in a
function under test.
There is _no_ way to test which cookies have explicitly been set by
setcookie(). A cookie is a cookie, and can be set a lot of different ways.
You can check however which cookies this particular script tries to set:
<http://www.php.net/headers_list>.

And offcourse, you can monitor changes in the $_COOKIE array after a new
pagerequest.
--
Rik Wasmus
Feb 12 '07 #2

P: n/a
Rik wrote:
Ian Collins wrote:
>I'm using PHPUnit to test some PHP scripts and I'd like to know if there
is a means of checking which cookies have been set by setcookie() in a
function under test.


There is _no_ way to test which cookies have explicitly been set by
setcookie(). A cookie is a cookie, and can be set a lot of different
ways. You can check however which cookies this particular script tries
to set: <http://www.php.net/headers_list>.
Thanks Rik, that's exactly what I'm after.

--
Ian Collins.
Feb 12 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.