$this->requestStack =
new RequestStack();
$this->requestStack->
push($this->request
);
$this->logger =
$this->
createMock('Drupal\Core\Logger\LoggerChannelInterface'
);
$form_error_handler =
$this->
createMock('Drupal\Core\Form\FormErrorHandlerInterface'
);
$this->formValidator =
new FormValidator($this->requestStack,
$this->
getStringTranslationStub(),
$this->csrfToken,
$this->logger,
$form_error_handler);
$this->formSubmitter =
$this->
getMockBuilder('Drupal\Core\Form\FormSubmitter'
) ->
setConstructorArgs([$this->requestStack,
$this->urlGenerator
]) ->
onlyMethods(['batchGet'
]) ->
getMock();
$this->root =
dirname(substr(__DIR__, 0, -
strlen(__NAMESPACE__
)), 2
);
$this->formBuilder =
new FormBuilder($this->formValidator,
$this->formSubmitter,
$this->formCache,
$this->moduleHandler,
$this->eventDispatcher,
$this->requestStack,
$this->classResolver,
$this->elementInfo,
$this->themeManager,
$this->csrfToken
);
} /**
* {@inheritdoc}
*/
protected function tearDown(): void
{ Html::
resetSeenIds();
(new FormState())->
clearErrors();
} /**
* Provides a mocked form object.
*
* @param string $form_id
* The form ID to be used.
* @param mixed $expected_form
* (optional) If provided, the expected form response for buildForm() to
* return. Defaults to NULL.
* @param int $count
* (optional) The number of times the form is expected to be built. Defaults
* to 1.
*
* @return \PHPUnit\Framework\MockObject\MockObject|\Drupal\Core\Form\FormInterface
* The mocked form object.
*/