You are here

protected function MediaLibraryTestBase::selectMediaItem in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/media_library/tests/src/FunctionalJavascript/MediaLibraryTestBase.php \Drupal\Tests\media_library\FunctionalJavascript\MediaLibraryTestBase::selectMediaItem()
  2. 9 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.

File

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

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