function ManagedFileTest::submitManagedFileForm

Submits the test form, using the given #file_value_callbacks callback.

Parameters

string $file_value_callback: The name of the method on this class to use as the callback.

Return value

\Drupal\Core\Form\FormStateInterface The form state after submission.

2 calls to ManagedFileTest::submitManagedFileForm()
ManagedFileTest::testManagedFileElement in core/modules/file/tests/src/Kernel/ManagedFileTest.php
Tests that managed file elements can be programmatically submitted.
ManagedFileTest::testManagedFileElementUntrustedCallbacks in core/modules/file/tests/src/Kernel/ManagedFileTest.php
Tests that deprecations are triggered if untrusted callbacks are used.

File

core/modules/file/tests/src/Kernel/ManagedFileTest.php, line 78

Class

ManagedFileTest
Managed file element test.

Namespace

Drupal\Tests\file\Kernel

Code

protected function submitManagedFileForm(string $file_value_callback = 'managedFileValueCallbackTrusted') : FormStateInterface {
  $form_state = new FormState();
  $form_state->setValues([
    'managed_file' => NULL,
  ]);
  \Drupal::formBuilder()->submitForm($this, $form_state, $file_value_callback);
  return $form_state;
}

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