use Symfony\Component\HttpKernel\HttpCache\Esi;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\HttpKernel\KernelEvents;
class SurrogateListenerTest extends TestCase
{ public function testFilterDoesNothingForSubRequests() { $dispatcher =
new EventDispatcher();
$kernel =
$this->
createMock(HttpKernelInterface::
class);
$response =
new Response('foo <esi:include src="" />'
);
$listener =
new SurrogateListener(new Esi());
$dispatcher->
addListener(KernelEvents::RESPONSE,
$listener->
onKernelResponse(...
));
$event =
new ResponseEvent($kernel,
new Request(), HttpKernelInterface::SUB_REQUEST,
$response);
$dispatcher->
dispatch($event, KernelEvents::RESPONSE
);
$this->
assertEquals('',
$event->
getResponse()->headers->
get('Surrogate-Control'
));
} public function testFilterWhenThereIsSomeEsiIncludes() { $dispatcher =
new EventDispatcher();