function FormErrorHandlerTest::setUpMockMessenger

Initializes the messenger as a mock object.

1 call to FormErrorHandlerTest::setUpMockMessenger()
FormErrorHandlerTest::testDisplayErrorMessages in core/tests/Drupal/Tests/Core/Form/FormErrorHandlerTest.php
Tests display error messages.

File

core/tests/Drupal/Tests/Core/Form/FormErrorHandlerTest.php, line 49

Class

FormErrorHandlerTest
Tests Drupal\Core\Form\FormErrorHandler.

Namespace

Drupal\Tests\Core\Form

Code

protected function setUpMockMessenger() : void {
  $this->messenger = $this->createMock(MessengerInterface::class);
  $container = new ContainerBuilder();
  $container->set('messenger', $this->messenger);
  \Drupal::setContainer($container);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.