You are here

public function EntityBrowserContext::select in Lightning Media 8.2

Same name and namespace in other branches
  1. 8 tests/contexts/EntityBrowserContext.behat.inc \Acquia\LightningExtension\Context\EntityBrowserContext::select()
  2. 8.3 tests/contexts/EntityBrowserContext.behat.inc \Acquia\LightningExtension\Context\EntityBrowserContext::select()

Selects an item in an entity browser view.

@When I select item :n @When I select item :n from the entity browser @When I select item :n from the :browser_id entity browser

Parameters

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

string $browser_id: (optional) The entity browser ID.

Throws

\Behat\Mink\Exception\ExpectationException if the entity browser contains fewer than $n items.

File

tests/contexts/EntityBrowserContext.behat.inc, line 83

Class

EntityBrowserContext
Contains step definitions for interacting with entity browser instances.

Namespace

Acquia\LightningExtension\Context

Code

public function select($n, $browser_id = NULL) {
  $items = $this
    ->getItems($browser_id);
  if ($n > count($items)) {
    throw new ExpectationException("Expected at least {$n} item(s) in the {$browser_id} entity browser.", $this
      ->getSession()
      ->getDriver());
  }
  else {
    $items[--$n]
      ->click();
  }
}