public function CustomPageExceptionHtmlSubscriberTest::testHandleWithPostRequest in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/tests/Drupal/Tests/Core/EventSubscriber/CustomPageExceptionHtmlSubscriberTest.php \Drupal\Tests\Core\EventSubscriber\CustomPageExceptionHtmlSubscriberTest::testHandleWithPostRequest()
Tests onHandleException with a POST request.
File
- core/
tests/ Drupal/ Tests/ Core/ EventSubscriber/ CustomPageExceptionHtmlSubscriberTest.php, line 114 - Contains \Drupal\Tests\Core\EventSubscriber\CustomPageExceptionHtmlSubscriberTest.
Class
- CustomPageExceptionHtmlSubscriberTest
- @coversDefaultClass \Drupal\Core\EventSubscriber\CustomPageExceptionHtmlSubscriber @group EventSubscriber
Namespace
Drupal\Tests\Core\EventSubscriberCode
public function testHandleWithPostRequest() {
$this
->setupStubAliasManager();
$request = Request::create('/test', 'POST', array(
'name' => 'druplicon',
'pass' => '12345',
));
$this->kernel
->expects($this
->once())
->method('handle')
->will($this
->returnCallback(function (Request $request) {
return new Response($request
->getMethod());
}));
$event = new GetResponseForExceptionEvent($this->kernel, $request, 'foo', 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);
}