public function MediaLibraryAddFormTest::testDifferentAddForm in Drupal 8
Same name and namespace in other branches
- 9 core/modules/media_library/tests/src/Kernel/MediaLibraryAddFormTest.php \Drupal\Tests\media_library\Kernel\MediaLibraryAddFormTest::testDifferentAddForm()
Tests overwriting of the add form.
File
- core/
modules/ media_library/ tests/ src/ Kernel/ MediaLibraryAddFormTest.php, line 144
Class
- MediaLibraryAddFormTest
- Tests the media library add form.
Namespace
Drupal\Tests\media_library\KernelCode
public function testDifferentAddForm() {
$this
->enableModules([
'media_library_form_overwrite_test',
]);
$entity_type_manager = \Drupal::entityTypeManager();
$image = $entity_type_manager
->getStorage('media_type')
->load('image');
$image_source_definition = $image
->getSource()
->getPluginDefinition();
// Assert the overwritten form class is set to the media source.
$this
->assertSame(TestAddForm::class, $image_source_definition['forms']['media_library_add']);
}