function FormErrorHandlerTest::setUp

Same name in this branch
  1. 11.x core/modules/inline_form_errors/tests/src/Unit/FormErrorHandlerTest.php \Drupal\Tests\inline_form_errors\Unit\FormErrorHandlerTest::setUp()
Same name and namespace in other branches
  1. 9 core/modules/inline_form_errors/tests/src/Unit/FormErrorHandlerTest.php \Drupal\Tests\inline_form_errors\Unit\FormErrorHandlerTest::setUp()
  2. 9 core/tests/Drupal/Tests/Core/Form/FormErrorHandlerTest.php \Drupal\Tests\Core\Form\FormErrorHandlerTest::setUp()
  3. 8.9.x core/modules/inline_form_errors/tests/src/Unit/FormErrorHandlerTest.php \Drupal\Tests\inline_form_errors\Unit\FormErrorHandlerTest::setUp()
  4. 8.9.x core/tests/Drupal/Tests/Core/Form/FormErrorHandlerTest.php \Drupal\Tests\Core\Form\FormErrorHandlerTest::setUp()
  5. 10 core/modules/inline_form_errors/tests/src/Unit/FormErrorHandlerTest.php \Drupal\Tests\inline_form_errors\Unit\FormErrorHandlerTest::setUp()
  6. 10 core/tests/Drupal/Tests/Core/Form/FormErrorHandlerTest.php \Drupal\Tests\Core\Form\FormErrorHandlerTest::setUp()

Overrides UnitTestCase::setUp

File

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

Class

FormErrorHandlerTest
@coversDefaultClass <a href="/api/drupal/core%21lib%21Drupal%21Core%21Form%21FormErrorHandler.php/class/FormErrorHandler/11.x" title="Handles form errors." class="local">\Drupal\Core\Form\FormErrorHandler</a> @group Form

Namespace

Drupal\Tests\Core\Form

Code

protected function setUp() : void {
    parent::setUp();
    $this->messenger = $this->createMock(MessengerInterface::class);
    $this->formErrorHandler = $this->getMockBuilder('Drupal\\Core\\Form\\FormErrorHandler')
        ->onlyMethods([
        'messenger',
    ])
        ->getMock();
    $this->formErrorHandler
        ->expects($this->atLeastOnce())
        ->method('messenger')
        ->willReturn($this->messenger);
}

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