You are here

public function EntityBrowserContext::select in Lightning Media 8.3

Same name and namespace in other branches
  1. 8 tests/contexts/EntityBrowserContext.behat.inc \Acquia\LightningExtension\Context\EntityBrowserContext::select()
  2. 8.2 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.

1 call to EntityBrowserContext::select()
EntityBrowserContext::selectItems in tests/contexts/EntityBrowserContext.behat.inc
Selects several items from an entity browser.

File

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

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