You are here

public function MediaLibraryAddFormTest::testFormStateValidation in Drupal 8

Same name and namespace in other branches
  1. 9 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 122

Class

MediaLibraryAddFormTest
Tests the media library add form.

Namespace

Drupal\Tests\media_library\Kernel

Code

public function testFormStateValidation() {
  $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);
}