You are here

public function ThunderMediaTestTrait::createGallery in Thunder 8.3

Same name and namespace in other branches
  1. 8.5 tests/src/FunctionalJavascript/ThunderMediaTestTrait.php \Drupal\Tests\thunder\FunctionalJavascript\ThunderMediaTestTrait::createGallery()
  2. 8.2 tests/src/FunctionalJavascript/ThunderMediaTestTrait.php \Drupal\Tests\thunder\FunctionalJavascript\ThunderMediaTestTrait::createGallery()
  3. 8.4 tests/src/FunctionalJavascript/ThunderMediaTestTrait.php \Drupal\Tests\thunder\FunctionalJavascript\ThunderMediaTestTrait::createGallery()
  4. 6.2.x tests/src/FunctionalJavascript/ThunderMediaTestTrait.php \Drupal\Tests\thunder\FunctionalJavascript\ThunderMediaTestTrait::createGallery()
  5. 6.0.x tests/src/FunctionalJavascript/ThunderMediaTestTrait.php \Drupal\Tests\thunder\FunctionalJavascript\ThunderMediaTestTrait::createGallery()
  6. 6.1.x tests/src/FunctionalJavascript/ThunderMediaTestTrait.php \Drupal\Tests\thunder\FunctionalJavascript\ThunderMediaTestTrait::createGallery()

Create gallery with selected medias.

Parameters

string $name: Name of gallery.

string $fieldName: Field name.

array $medias: List of media identifiers.

File

tests/src/FunctionalJavascript/ThunderMediaTestTrait.php, line 78

Class

ThunderMediaTestTrait
Trait for handling of Media related test actions.

Namespace

Drupal\Tests\thunder\FunctionalJavascript

Code

public function createGallery($name, $fieldName, array $medias) {
  $page = $this
    ->getSession()
    ->getPage();
  $selector = "input[data-drupal-selector='edit-" . str_replace('_', '-', $fieldName) . "-0-inline-entity-form-name-0-value']";
  $this
    ->assertSession()
    ->elementExists('css', $selector);
  $nameField = $page
    ->find('css', $selector);
  $nameField
    ->setValue($name);
  $this
    ->selectMedia("{$fieldName}_0_inline_entity_form_field_media_images", 'multiple_image_browser', $medias);
}