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);
$this->
assertSame(304,
$response->
getStatusCode());
} /**
* @testWith ["test.getDate()"]
* ["date"]
*/
public function testLastModifiedHeader(string
$expression) {