You are here

protected function MediaLibraryTestBase::selectMediaItem in Drupal 8

Same name and namespace 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()

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);
  }
}