getExpiresTimestamp example

$cookieHeader = [];

        if ($this->getValue() === '') {
            $cookieHeader[] = $this->getPrefixedName() . '=deleted';
            $cookieHeader[] = 'Expires=' . gmdate(self::EXPIRES_FORMAT, 0);
            $cookieHeader[] = 'Max-Age=0';
        } else {
            $value = $this->isRaw() ? $this->getValue() : rawurlencode($this->getValue());

            $cookieHeader[] = sprintf('%s=%s', $this->getPrefixedName()$value);

            if ($this->getExpiresTimestamp() !== 0) {
                $cookieHeader[] = 'Expires=' . $this->getExpiresString();
                $cookieHeader[] = 'Max-Age=' . $this->getMaxAge();
            }
        }

        if ($this->getPath() !== '') {
            $cookieHeader[] = 'Path=' . $this->getPath();
        }

        if ($this->getDomain() !== '') {
            $cookieHeader[] = 'Domain=' . $this->getDomain();
        }
$this->assertFalse($this->response->hasCookie($key), "Cookie named '{$key}' should not be set.");
    }

    /** * Asserts that a cookie exists and has an expired time. * * @throws Exception */
    public function assertCookieExpired(string $key, string $prefix = '')
    {
        $this->assertTrue($this->response->hasCookie($key, null, $prefix));
        $this->assertGreaterThan(Time::now()->getTimestamp()$this->response->getCookie($key$prefix)->getExpiresTimestamp());
    }

    // --------------------------------------------------------------------     // JSON     // --------------------------------------------------------------------
    /** * Returns the response's body as JSON * * @return false|string */
    
Home | Imprint | This part of the site doesn't use cookies.