diff --git a/core/lib/Drupal/Core/EventSubscriber/FormControllerSubscriber.php b/core/lib/Drupal/Core/EventSubscriber/FormControllerSubscriber.php index 2aee50d..3993fa5 100644 --- a/core/lib/Drupal/Core/EventSubscriber/FormControllerSubscriber.php +++ b/core/lib/Drupal/Core/EventSubscriber/FormControllerSubscriber.php @@ -37,7 +37,7 @@ class FormControllerSubscriber implements EventSubscriberInterface { * * @var \Drupal\Core\Form\FormAjaxResponseHandlerInterface */ - protected $formAjaxHandler; + protected $formAjaxResponseHandler; /** * The controller resolver. @@ -49,13 +49,13 @@ class FormControllerSubscriber implements EventSubscriberInterface { /** * Constructs a new FormControllerSubscriber. * - * @param \Drupal\Core\Form\FormAjaxResponseHandlerInterface $form_ajax_handler + * @param \Drupal\Core\Form\FormAjaxResponseHandlerInterface $form_ajax_response_handler * The form AJAX handler. * @param \Drupal\Core\Controller\ControllerResolverInterface $controller_resolver * The controller resolver. */ - public function __construct(FormAjaxResponseHandlerInterface $form_ajax_handler, ControllerResolverInterface $controller_resolver) { - $this->formAjaxHandler = $form_ajax_handler; + public function __construct(FormAjaxResponseHandlerInterface $form_ajax_response_handler, ControllerResolverInterface $controller_resolver) { + $this->formAjaxResponseHandler = $form_ajax_response_handler; $this->controllerResolver = $controller_resolver; } @@ -90,7 +90,7 @@ public function onControllerWrapAjaxFormSubmission(FilterControllerEvent $event) // If the form build ID has changed, issue an Ajax command to update it. $commands[] = new UpdateBuildIdCommand($form_build_id, $form['#build_id']); } - return $this->formAjaxHandler->buildResponse($request, $form, $form_state, $commands); + return $this->formAjaxResponseHandler->buildResponse($request, $form, $form_state, $commands); }); } } diff --git a/core/tests/Drupal/Tests/Core/EventSubscriber/FormControllerSubscriberTest.php b/core/tests/Drupal/Tests/Core/EventSubscriber/FormControllerSubscriberTest.php index 96b68a1..63a23d0 100644 --- a/core/tests/Drupal/Tests/Core/EventSubscriber/FormControllerSubscriberTest.php +++ b/core/tests/Drupal/Tests/Core/EventSubscriber/FormControllerSubscriberTest.php @@ -27,9 +27,9 @@ class FormControllerSubscriberTest extends UnitTestCase { * @covers ::onViewFormAndFormState */ public function testOnViewFormAndFormState() { - $form_ajax_handler = $this->getMock('Drupal\Core\Form\FormAjaxResponseHandlerInterface'); + $form_ajax_response_handler = $this->getMock('Drupal\Core\Form\FormAjaxResponseHandlerInterface'); $controller_resolver = $this->getMock('Drupal\Core\Controller\ControllerResolverInterface'); - $subscriber = new FormControllerSubscriber($form_ajax_handler, $controller_resolver); + $subscriber = new FormControllerSubscriber($form_ajax_response_handler, $controller_resolver); $http_kernel = $this->getMock('Symfony\Component\HttpKernel\HttpKernelInterface'); $request = new Request(); @@ -67,16 +67,16 @@ public function testOnControllerWrapAjaxFormSubmission() { $request = new Request([FormControllerSubscriber::POST_TO_ORIGINAL_URL => FormControllerSubscriber::DRUPAL_AJAX_POST], ['form_build_id' => 'the_build_id']); $commands = []; - $form_ajax_handler = $this->getMock('Drupal\Core\Form\FormAjaxResponseHandlerInterface'); - $form_ajax_handler->expects($this->once()) - ->method('handle') + $form_ajax_response_handler = $this->getMock('Drupal\Core\Form\FormAjaxResponseHandlerInterface'); + $form_ajax_response_handler->expects($this->once()) + ->method('buildResponse') ->with($request, $form, $form_state, $commands) ->willReturn('the ajax result'); $controller_resolver = $this->getMock('Drupal\Core\Controller\ControllerResolverInterface'); $controller_resolver->expects($this->once()) ->method('getArguments') ->willReturn([$form, $form_state]); - $subscriber = new FormControllerSubscriber($form_ajax_handler, $controller_resolver); + $subscriber = new FormControllerSubscriber($form_ajax_response_handler, $controller_resolver); $http_kernel = $this->getMock('Symfony\Component\HttpKernel\HttpKernelInterface'); @@ -104,16 +104,16 @@ public function testOnControllerWrapAjaxFormSubmissionUsingGet() { $request = new Request([FormControllerSubscriber::POST_TO_ORIGINAL_URL => FormControllerSubscriber::DRUPAL_AJAX_POST, 'form_build_id' => 'the_build_id']); $commands = []; - $form_ajax_handler = $this->getMock('Drupal\Core\Form\FormAjaxResponseHandlerInterface'); - $form_ajax_handler->expects($this->once()) - ->method('handle') + $form_ajax_response_handler = $this->getMock('Drupal\Core\Form\FormAjaxResponseHandlerInterface'); + $form_ajax_response_handler->expects($this->once()) + ->method('buildResponse') ->with($request, $form, $form_state, $commands) ->willReturn('the ajax result'); $controller_resolver = $this->getMock('Drupal\Core\Controller\ControllerResolverInterface'); $controller_resolver->expects($this->once()) ->method('getArguments') ->willReturn([$form, $form_state]); - $subscriber = new FormControllerSubscriber($form_ajax_handler, $controller_resolver); + $subscriber = new FormControllerSubscriber($form_ajax_response_handler, $controller_resolver); $http_kernel = $this->getMock('Symfony\Component\HttpKernel\HttpKernelInterface'); @@ -142,16 +142,16 @@ public function testOnControllerWrapAjaxFormSubmissionMismatchedBuildId() { $commands = []; $commands[] = new UpdateBuildIdCommand('a_new_build_id', 'the_build_id'); - $form_ajax_handler = $this->getMock('Drupal\Core\Form\FormAjaxResponseHandlerInterface'); - $form_ajax_handler->expects($this->once()) - ->method('handle') + $form_ajax_response_handler = $this->getMock('Drupal\Core\Form\FormAjaxResponseHandlerInterface'); + $form_ajax_response_handler->expects($this->once()) + ->method('buildResponse') ->with($request, $form, $form_state, $commands) ->willReturn('the ajax result'); $controller_resolver = $this->getMock('Drupal\Core\Controller\ControllerResolverInterface'); $controller_resolver->expects($this->once()) ->method('getArguments') ->willReturn([$form, $form_state]); - $subscriber = new FormControllerSubscriber($form_ajax_handler, $controller_resolver); + $subscriber = new FormControllerSubscriber($form_ajax_response_handler, $controller_resolver); $http_kernel = $this->getMock('Symfony\Component\HttpKernel\HttpKernelInterface'); @@ -179,14 +179,14 @@ public function testOnControllerWrapAjaxFormSubmissionMismatchedBuildId() { public function testOnControllerWrapAjaxFormSubmissionException() { $request = new Request([FormControllerSubscriber::POST_TO_ORIGINAL_URL => FormControllerSubscriber::DRUPAL_AJAX_POST]); - $form_ajax_handler = $this->getMock('Drupal\Core\Form\FormAjaxResponseHandlerInterface'); - $form_ajax_handler->expects($this->never()) - ->method('handle'); + $form_ajax_response_handler = $this->getMock('Drupal\Core\Form\FormAjaxResponseHandlerInterface'); + $form_ajax_response_handler->expects($this->never()) + ->method('buildResponse'); $controller_resolver = $this->getMock('Drupal\Core\Controller\ControllerResolverInterface'); $controller_resolver->expects($this->once()) ->method('getArguments') ->willReturn([]); - $subscriber = new FormControllerSubscriber($form_ajax_handler, $controller_resolver); + $subscriber = new FormControllerSubscriber($form_ajax_response_handler, $controller_resolver); $http_kernel = $this->getMock('Symfony\Component\HttpKernel\HttpKernelInterface');