Skip to content

Commit

Permalink
Merge pull request #139 from pulkitjalan/patch-1
Browse files Browse the repository at this point in the history
[5.x] Remove cookie prefix in seeCookie
  • Loading branch information
taylorotwell authored Aug 5, 2020
2 parents c202f99 + 9ab30ed commit ada9025
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Concerns/MakesHttpRequests.php
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@ protected function seePlainCookie($cookieName, $value = null)
* @param bool $unserialize
* @return $this
*/
protected function seeCookie($cookieName, $value = null, $encrypted = true, $unserialize = true)
protected function seeCookie($cookieName, $value = null, $encrypted = true, $unserialize = false)
{
$headers = $this->response->headers;

Expand All @@ -643,6 +643,10 @@ protected function seeCookie($cookieName, $value = null, $encrypted = true, $uns
$actual = $encrypted
? $this->app['encrypter']->decrypt($cookieValue, $unserialize) : $cookieValue;

$hasValidPrefix = strpos($actual, CookieValuePrefix::create($cookieName, app('encrypter')->getKey())) === 0;

$actual = $hasValidPrefix ? CookieValuePrefix::remove($actual) : null;

$this->assertEquals(
$actual, $value,
"Cookie [{$cookieName}] was found, but value [{$actual}] does not match [{$value}]."
Expand Down

0 comments on commit ada9025

Please sign in to comment.