hasCookie example


        Services::response()->deleteCookie($name$domain$path$prefix);
    }
}

if (function_exists('has_cookie')) {
    /** * Checks if a cookie exists by name. */
    function has_cookie(string $name, ?string $value = null, string $prefix = ''): bool
    {
        return Services::response()->hasCookie($name$value$prefix);
    }
}
    // --------------------------------------------------------------------
    /** * Asserts that the response has the specified cookie. * * @param string|null $value * * @throws Exception */
    public function assertCookie(string $key$value = null, string $prefix = '')
    {
        $this->assertTrue($this->response->hasCookie($key$value$prefix), "No cookie found named '{$key}'.");
    }

    /** * Assert the Response does not have the specified cookie set. */
    public function assertCookieMissing(string $key)
    {
        $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 */
Home | Imprint | This part of the site doesn't use cookies.