src/Concerns/MakesHttpRequests.php
protected function seeCookie($cookieName, $value = null, $encrypted = true, $unserialize = true)
    {
        $headers = $this->response->headers;

        $exist = false;

        foreach ($headers->getCookies() as $cookie) {
            if ($cookie->getName() === $cookieName) {
                $exist = true;
                break;
            }
        }

        $this->assertTrue($exist, "Cookie [{$cookieName}] not present on response.");

        if (! $exist || is_null($value)) {
            return $this;
        }

        $cookieValue = $cookie->getValue();

        $actual = $encrypted
            ? $this->app['encrypter']->decrypt($cookieValue, $unserialize) : $cookieValue;

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

        return $this;
    }
protected function seeCookie($cookieName, $value = null, $encrypted = true, $unserialize = true)
    {
        $headers = $this->response->headers;

        $exist = false;

        foreach ($headers->getCookies() as $cookie) {
            if ($cookie->getName() === $cookieName) {
                $exist = true;
                break;
            }
        }

        $this->assertTrue($exist, "Cookie [{$cookieName}] not present on response.");

        if (! $exist || is_null($value)) {
            return $this;
        }

        $cookieValue = $cookie->getValue();

        $actual = $encrypted
            ? $this->app['encrypter']->decrypt($cookieValue, $unserialize) : $cookieValue;

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

        return $this;
    }
protected function seeCookie ( $ cookieName , $ value = null , $ encrypted = true , $ unserialize = true ) { $ headers = $ this -> response -> headers ; $ exist = false ; foreach ( $ headers -> getCookies ( ) as $ cookie ) { if ( $ cookie -> getName ( ) === $ cookieName ) { $ exist = true ; break ; } } $ this -> assertTrue ( $ exist , "Cookie [{$cookieName}] not present on response." ) ; if ( ! $ exist || is_null ( $ value ) ) { return $ this ; } $ cookieValue = $ cookie -> getValue ( ) ; $ actual = $ encrypted ? $ this -> app [ 'encrypter' ] -> decrypt ( $ cookieValue , $ unserialize ) : $ cookieValue ; $ this -> assertEquals ( $ actual , $ value , "Cookie [{$cookieName}] was found, but value [{$actual}] does not match [{$value}]." ) ; return $ this ; }
Asserts that the response contains the given cookie and equals the optional value.

@param  string  $cookieName
@param  mixed  $value
@param  bool  $encrypted
@param  bool  $unserialize
@return $this
Asserts that the response contains the given cookie and equals the optional value .