function MediaLibraryTestBase::addMediaFileToField

Same name in other branches
  1. 9 core/modules/media_library/tests/src/FunctionalJavascript/MediaLibraryTestBase.php \Drupal\Tests\media_library\FunctionalJavascript\MediaLibraryTestBase::addMediaFileToField()
  2. 8.9.x core/modules/media_library/tests/src/FunctionalJavascript/MediaLibraryTestBase.php \Drupal\Tests\media_library\FunctionalJavascript\MediaLibraryTestBase::addMediaFileToField()
  3. 10 core/modules/media_library/tests/src/FunctionalJavascript/MediaLibraryTestBase.php \Drupal\Tests\media_library\FunctionalJavascript\MediaLibraryTestBase::addMediaFileToField()

Waits for a file field to exist before uploading.

3 calls to MediaLibraryTestBase::addMediaFileToField()
ClaroModalDisplayTest::testModalAddAnother in core/tests/Drupal/FunctionalJavascriptTests/Theme/ClaroModalDisplayTest.php
Tests the position f "add another" button in dialogs.
WidgetUploadTest::testWidgetUpload in core/modules/media_library/tests/src/FunctionalJavascript/WidgetUploadTest.php
Tests that uploads in the 'media_library_widget' works as expected.
WidgetUploadTest::testWidgetUploadAdvancedUi in core/modules/media_library/tests/src/FunctionalJavascript/WidgetUploadTest.php
Tests that uploads in the widget's advanced UI works as expected.

File

core/modules/media_library/tests/src/FunctionalJavascript/MediaLibraryTestBase.php, line 221

Class

MediaLibraryTestBase
Base class for functional tests of Media Library functionality.

Namespace

Drupal\Tests\media_library\FunctionalJavascript

Code

public function addMediaFileToField($locator, $path) {
    $page = $this->getSession()
        ->getPage();
    $this->waitForFieldExists($locator);
    $page->attachFileToField($locator, $path);
}

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