->
willReturn($request_context);
$this->kernel->
expects($this->
once())->
method('handle'
)->
willReturnCallback(function DRequest
$request) { return new HtmlResponse($request->
getMethod());
});
$event =
new ExceptionEvent($this->kernel,
$request, HttpKernelInterface::MAIN_REQUEST,
new NotFoundHttpException('foo'
));
$this->customPageSubscriber->
onException($event);
$response =
$event->
getResponse();
$result =
$response->
getContent() . " " . UrlHelper::
buildQuery($request->request->
all());
$this->
assertEquals('POST name=druplicon&pass=12345',
$result);
$this->
assertEquals(AccessResult::
allowed()->
addCacheTags(['foo', 'bar'
]),
$request->attributes->
get(AccessAwareRouterInterface::ACCESS_RESULT
));
} /**
* Tests onHandleException with a GET request.
*/
public function testHandleWithGetRequest() { $request = Request::
create('/test', 'GET',
['name' => 'druplicon', 'pass' => '12345'
]);
$request->attributes->
set(AccessAwareRouterInterface::ACCESS_RESULT, AccessResult::
forbidden()->
addCacheTags(['druplicon'
]));