$this->
assertSame(86400,
$this->response->
getMaxAge());
$this->
assertSame('86400',
$this->response->headers->
getCacheControlDirective('max-stale'
));
$this->
assertSame('86400',
$this->response->headers->
getCacheControlDirective('stale-if-error'
));
} /**
* @testWith ["test.getDate()"]
* ["date"]
*/
public function testLastModifiedNotModifiedResponse(string
$expression) { $entity =
new TestEntity();
$request =
$this->
createRequest(new Cache(lastModified:
$expression));
$request->attributes->
set('date',
new \
DateTimeImmutable('Fri, 23 Aug 2013 00:00:00 GMT'
));
$request->headers->
add(['If-Modified-Since' => 'Fri, 23 Aug 2013 00:00:00 GMT'
]);
$listener =
new CacheAttributeListener();
$controllerArgumentsEvent =
new ControllerArgumentsEvent($this->
getKernel(),
fn (TestEntity
$test) =>
new Response(),
[$entity],
$request, null
);
$listener->
onKernelControllerArguments($controllerArgumentsEvent);
$response =
$controllerArgumentsEvent->
getController()($entity);