Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cookie attributes (e.g. secure, samesite, etc) are not mocked and cannot be tested #10338

Open
GuySartorelli opened this issue May 29, 2022 · 0 comments

Comments

@GuySartorelli
Copy link
Member

Currently cookies are set in CookieJar, which uses setcookie() directly to set cookies rather than adding them to the HTTPResponse object, which means we aren't fully including them in mock requests.

The cookie values are being set in mock requests by pulling them out of the cookie jar and setting the $_COOKIE env variable. So we are mocking cookie values but not the other attributes in cookie headers.

A good enhancement would be to make sure the HTTPResponse object is aware of cookies, either by setting the cookies via HTTPResponse::addHeader() (assuming that's something that can be done), or perhaps through a new method like registerCookie() or similar that just sets some private cookies array on the response object that can then be checked in functional tests... or by some other mechanism.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants