You are here

protected function FormAjaxSubscriberTest::assertResponseFromException in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/tests/Drupal/Tests/Core/Form/EventSubscriber/FormAjaxSubscriberTest.php \Drupal\Tests\Core\Form\EventSubscriber\FormAjaxSubscriberTest::assertResponseFromException()

Asserts that the expected response is derived from the given exception.

Parameters

\Symfony\Component\HttpFoundation\Request $request: The request.

\Exception $exception: The exception to pass to the event.

\Symfony\Component\HttpFoundation\Response|null $expected_response: The response expected to be set on the event.

Return value

\Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent The event used to derive the response.

6 calls to FormAjaxSubscriberTest::assertResponseFromException()
FormAjaxSubscriberTest::testOnException in core/tests/Drupal/Tests/Core/Form/EventSubscriber/FormAjaxSubscriberTest.php
@covers ::onException
FormAjaxSubscriberTest::testOnExceptionNestedException in core/tests/Drupal/Tests/Core/Form/EventSubscriber/FormAjaxSubscriberTest.php
@covers ::onException @covers ::getFormAjaxException
FormAjaxSubscriberTest::testOnExceptionNestedWrongException in core/tests/Drupal/Tests/Core/Form/EventSubscriber/FormAjaxSubscriberTest.php
@covers ::getFormAjaxException
FormAjaxSubscriberTest::testOnExceptionNewBuildId in core/tests/Drupal/Tests/Core/Form/EventSubscriber/FormAjaxSubscriberTest.php
@covers ::onException
FormAjaxSubscriberTest::testOnExceptionOtherClass in core/tests/Drupal/Tests/Core/Form/EventSubscriber/FormAjaxSubscriberTest.php
@covers ::onException

... See full list

File

core/tests/Drupal/Tests/Core/Form/EventSubscriber/FormAjaxSubscriberTest.php, line 249
Contains \Drupal\Tests\Core\Form\EventSubscriber\FormAjaxSubscriberTest.

Class

FormAjaxSubscriberTest
@coversDefaultClass \Drupal\Core\Form\EventSubscriber\FormAjaxSubscriber @group EventSubscriber

Namespace

Drupal\Tests\Core\Form\EventSubscriber

Code

protected function assertResponseFromException(Request $request, \Exception $exception, $expected_response) {
  $event = new GetResponseForExceptionEvent($this->httpKernel, $request, HttpKernelInterface::MASTER_REQUEST, $exception);
  $this->subscriber
    ->onException($event);
  $this
    ->assertSame($expected_response, $event
    ->getResponse());
  return $event;
}