function 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']);
}Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.
