You are here

public function EntityBrowserContext::assertCount in Lightning Media 8.3

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

Asserts that a certain number of items are visible in the entity browser.

@Then I should see :n item(s) in the entity browser

Parameters

int $n: The number of items that should be visible.

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

Throws

\Behat\Mink\Exception\ExpectationException If the actual number of items in the entity browser does not match the expected number.

File

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

Class

EntityBrowserContext
Contains step definitions for interacting with entity browser instances.

Namespace

Acquia\LightningExtension\Context

Code

public function assertCount($n, $browser_id = NULL) {
  $count = count($this
    ->getItems($browser_id));
  if ($count !== (int) $n) {
    throw new ExpectationException("Expected {$n} items in the {$browser_id} entity browser, but there were {$count}.", $this
      ->getSession()
      ->getDriver());
  }
}