function MediaLibraryTestBase::selectMediaItem

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

Selects an item in the media library modal.

Parameters

int $index: The zero-based index of the item to select.

string $expected_selected_count: (optional) The expected text of the selection counter.

5 calls to MediaLibraryTestBase::selectMediaItem()
EntityReferenceWidgetTest::testAddAfterReordering in core/modules/media_library/tests/src/FunctionalJavascript/EntityReferenceWidgetTest.php
Tests that order is correct after re-order and adding another item.
EntityReferenceWidgetTest::testRequiredMediaField in core/modules/media_library/tests/src/FunctionalJavascript/EntityReferenceWidgetTest.php
Tests saving a required media library field.
EntityReferenceWidgetTest::testWidget in core/modules/media_library/tests/src/FunctionalJavascript/EntityReferenceWidgetTest.php
Tests that the Media library's widget works as expected.
FieldUiIntegrationTest::testFieldUiIntegration in core/modules/media_library/tests/src/FunctionalJavascript/FieldUiIntegrationTest.php
Tests field UI integration for media library widget.
WidgetAnonymousTest::testWidgetAnonymous in core/modules/media_library/tests/src/FunctionalJavascript/WidgetAnonymousTest.php
Tests that the widget works as expected for anonymous users.

File

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

Class

MediaLibraryTestBase
Base class for functional tests of Media Library functionality.

Namespace

Drupal\Tests\media_library\FunctionalJavascript

Code

protected function selectMediaItem($index, $expected_selected_count = NULL) {
    $checkboxes = $this->getCheckboxes();
    $this->assertGreaterThan($index, count($checkboxes));
    $checkboxes[$index]->check();
    if ($expected_selected_count) {
        $this->assertSelectedMediaCount($expected_selected_count);
    }
}

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