assertResponseNotHasCookie example

$this->getResponseTester($response)->assertResponseHasCookie('foo');
        $this->expectException(AssertionFailedError::class);
        $this->expectExceptionMessage('Failed asserting that the Response has cookie "bar".');
        $this->getResponseTester($response)->assertResponseHasCookie('bar');
    }

    public function testAssertResponseNotHasCookie()
    {
        $response = new Response();
        $response->headers->setCookie(HttpFoundationCookie::create('foo', 'bar'));

        $this->getResponseTester($response)->assertResponseNotHasCookie('bar');
        $this->expectException(AssertionFailedError::class);
        $this->expectExceptionMessage('Failed asserting that the Response does not have cookie "foo".');
        $this->getResponseTester($response)->assertResponseNotHasCookie('foo');
    }

    public function testAssertResponseCookieValueSame()
    {
        $response = new Response();
        $response->headers->setCookie(HttpFoundationCookie::create('foo', 'bar'));

        $this->getResponseTester($response)->assertResponseCookieValueSame('foo', 'bar');
        
Home | Imprint | This part of the site doesn't use cookies.