function MediaLibraryAddFormTest::testFormStateValidation

Same name in other branches
  1. 9 core/modules/media_library/tests/src/Kernel/MediaLibraryAddFormTest.php \Drupal\Tests\media_library\Kernel\MediaLibraryAddFormTest::testFormStateValidation()
  2. 8.9.x core/modules/media_library/tests/src/Kernel/MediaLibraryAddFormTest.php \Drupal\Tests\media_library\Kernel\MediaLibraryAddFormTest::testFormStateValidation()
  3. 11.x core/modules/media_library/tests/src/Kernel/MediaLibraryAddFormTest.php \Drupal\Tests\media_library\Kernel\MediaLibraryAddFormTest::testFormStateValidation()

Tests the validation of the library state in the media library add form.

File

core/modules/media_library/tests/src/Kernel/MediaLibraryAddFormTest.php, line 124

Class

MediaLibraryAddFormTest
Tests the media library add form.

Namespace

Drupal\Tests\media_library\Kernel

Code

public function testFormStateValidation() : void {
    $form_state = new FormState();
    $this->expectException(\InvalidArgumentException::class);
    $this->expectExceptionMessage('The media library state is not present in the form state.');
    \Drupal::formBuilder()->buildForm(FileUploadForm::class, $form_state);
}

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