function FormBuilderTest::testExceededFileSize
Same name in other branches
- 8.9.x core/tests/Drupal/Tests/Core/Form/FormBuilderTest.php \Drupal\Tests\Core\Form\FormBuilderTest::testExceededFileSize()
- 10 core/tests/Drupal/Tests/Core/Form/FormBuilderTest.php \Drupal\Tests\Core\Form\FormBuilderTest::testExceededFileSize()
- 11.x core/tests/Drupal/Tests/Core/Form/FormBuilderTest.php \Drupal\Tests\Core\Form\FormBuilderTest::testExceededFileSize()
@covers ::buildForm
File
-
core/
tests/ Drupal/ Tests/ Core/ Form/ FormBuilderTest.php, line 579
Class
- FormBuilderTest
- @coversDefaultClass \Drupal\Core\Form\FormBuilder @group Form
Namespace
Drupal\Tests\Core\FormCode
public function testExceededFileSize() {
$request = new Request([
FormBuilderInterface::AJAX_FORM_REQUEST => TRUE,
]);
$request_stack = new RequestStack();
$request_stack->push($request);
$this->formBuilder = $this->getMockBuilder('\\Drupal\\Core\\Form\\FormBuilder')
->setConstructorArgs([
$this->formValidator,
$this->formSubmitter,
$this->formCache,
$this->moduleHandler,
$this->eventDispatcher,
$request_stack,
$this->classResolver,
$this->elementInfo,
$this->themeManager,
$this->csrfToken,
])
->onlyMethods([
'getFileUploadMaxSize',
])
->getMock();
$this->formBuilder
->expects($this->once())
->method('getFileUploadMaxSize')
->willReturn(33554432);
$form_arg = $this->getMockForm('test_form_id');
$form_state = new FormState();
$this->expectException(BrokenPostRequestException::class);
$this->formBuilder
->buildForm($form_arg, $form_state);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.