[6.x] Fix the value generated when setting encrypted cookies #857
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR updates the Dusk
Browser
object so that it sets encrypted cookies to match the way laravel/framework does.Without this, setting an encrypted cookie results in an invalid value that Laravel ignores:
For reference, this is where Laravel/Framework encrypts and decrypts cookies:
https://github.com/laravel/framework/blob/8.x/src/Illuminate/Cookie/Middleware/EncryptCookies.php#L147
https://github.com/laravel/framework/blob/8.x/src/Illuminate/Cookie/Middleware/EncryptCookies.php#L86
I'm not sure how to go about testing this within this package, as some of the functionality that's used to set cookies isn't available. (eg. the
encrypt
helper, Laravel'sapp
object, etc).I have tested this separately in a Laravel installation by using addCookie to set an encrypted cookie, and then make a request to a page that spits out the cookies that were decrypted by the EncryptsCookies middleware.