Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
assertResponseHasCookie example
$this
->
getResponseTester
(
new
Response
(
)
)
->
assertResponseHeaderNotSame
(
'Cache-Control', 'public'
)
;
$this
->
expectException
(
AssertionFailedError::
class
)
;
$this
->
expectExceptionMessage
(
'Failed asserting that the Response does not have header "Cache-Control" with value "no-cache, private".'
)
;
$this
->
getResponseTester
(
new
Response
(
)
)
->
assertResponseHeaderNotSame
(
'Cache-Control', 'no-cache, private'
)
;
}
public
function
testAssertResponseHasCookie
(
)
{
$response
=
new
Response
(
)
;
$response
->headers->
setCookie
(
HttpFoundationCookie::
create
(
'foo', 'bar'
)
)
;
$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'
)
;