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. 10 core/modules/media_library/tests/src/FunctionalJavascript/MediaLibraryTestBase.php \Drupal\Tests\media_library\FunctionalJavascript\MediaLibraryTestBase::selectMediaItem()
  3. 11.x 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.

2 calls to MediaLibraryTestBase::selectMediaItem()
EntityReferenceWidgetTest::testWidget in core/modules/media_library/tests/src/FunctionalJavascript/EntityReferenceWidgetTest.php
Tests that the Media library's widget works as expected.
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 394

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.