function MediaLibraryAddFormTest::testSelectedTypeValidation
Same name in other branches
- 9 core/modules/media_library/tests/src/Kernel/MediaLibraryAddFormTest.php \Drupal\Tests\media_library\Kernel\MediaLibraryAddFormTest::testSelectedTypeValidation()
- 8.9.x core/modules/media_library/tests/src/Kernel/MediaLibraryAddFormTest.php \Drupal\Tests\media_library\Kernel\MediaLibraryAddFormTest::testSelectedTypeValidation()
- 11.x core/modules/media_library/tests/src/Kernel/MediaLibraryAddFormTest.php \Drupal\Tests\media_library\Kernel\MediaLibraryAddFormTest::testSelectedTypeValidation()
Tests the validation of the selected type in the media library add form.
File
-
core/
modules/ media_library/ tests/ src/ Kernel/ MediaLibraryAddFormTest.php, line 134
Class
- MediaLibraryAddFormTest
- Tests the media library add form.
Namespace
Drupal\Tests\media_library\KernelCode
public function testSelectedTypeValidation() : void {
$state = MediaLibraryState::create('test', [
'image',
'remote_video',
'header_image',
], 'header_image', -1);
$form_state = new FormState();
$form_state->set('media_library_state', $state);
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage("The 'header_image' media type does not exist.");
\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.