Commit 0ab2dc4e authored by catch's avatar catch
Browse files

Issue #2997771 by martin107, longwave: GetResponseForExceptionEvent: Prepare for Drupal9

parent c1cba607
......@@ -27,7 +27,7 @@ public function testOn4xx() {
$request->setRequestFormat('json');
$e = new MethodNotAllowedHttpException(['POST', 'PUT'], 'test message');
$event = new GetResponseForExceptionEvent($kernel->reveal(), $request, 'GET', $e);
$event = new GetResponseForExceptionEvent($kernel->reveal(), $request, HttpKernelInterface::MASTER_REQUEST, $e);
$subscriber = new DefaultExceptionSubscriber(new Serializer([], [new JsonEncoder()]), []);
$subscriber->on4xx($event);
$response = $event->getResponse();
......
......@@ -14,6 +14,7 @@
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\Routing\RequestContext;
/**
......@@ -138,7 +139,7 @@ public function testHandleWithPostRequest() {
return new HtmlResponse($request->getMethod());
}));
$event = new GetResponseForExceptionEvent($this->kernel, $request, 'foo', new NotFoundHttpException('foo'));
$event = new GetResponseForExceptionEvent($this->kernel, $request, HttpKernelInterface::MASTER_REQUEST, new NotFoundHttpException('foo'));
$this->customPageSubscriber->onException($event);
......@@ -165,7 +166,7 @@ public function testHandleWithGetRequest() {
return new Response($request->getMethod() . ' ' . UrlHelper::buildQuery($request->query->all()));
}));
$event = new GetResponseForExceptionEvent($this->kernel, $request, 'foo', new NotFoundHttpException('foo'));
$event = new GetResponseForExceptionEvent($this->kernel, $request, HttpKernelInterface::MASTER_REQUEST, new NotFoundHttpException('foo'));
$this->customPageSubscriber->onException($event);
$response = $event->getResponse();
......
......@@ -27,7 +27,7 @@ class ExceptionJsonSubscriberTest extends UnitTestCase {
public function testOn4xx(HttpExceptionInterface $exception, $expected_response_class) {
$kernel = $this->prophesize(HttpKernelInterface::class);
$request = Request::create('/test');
$event = new GetResponseForExceptionEvent($kernel->reveal(), $request, 'GET', $exception);
$event = new GetResponseForExceptionEvent($kernel->reveal(), $request, HttpKernelInterface::MASTER_REQUEST, $exception);
$subscriber = new ExceptionJsonSubscriber();
$subscriber->on4xx($event);
$response = $event->getResponse();
......
......@@ -28,7 +28,7 @@ public function testOnExceptionWithUnknownFormat() {
// of this so we'll hard code it here.
$request->setRequestFormat('bananas');
$e = new MethodNotAllowedHttpException(['POST', 'PUT'], 'test message');
$event = new GetResponseForExceptionEvent($kernel->reveal(), $request, 'GET', $e);
$event = new GetResponseForExceptionEvent($kernel->reveal(), $request, HttpKernelInterface::MASTER_REQUEST, $e);
$subscriber = new TestDefaultExceptionSubscriber($config_factory);
$subscriber->setStringTranslation($this->getStringTranslationStub());
$subscriber->onException($event);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment