You are here

public function BambooTwigTestBase::assertElementCount in Bamboo Twig 8.5

Same name and namespace in other branches
  1. 8 tests/src/Functional/BambooTwigTestBase.php \Drupal\Tests\bamboo_twig\Functional\BambooTwigTestBase::assertElementCount()
  2. 8.2 tests/src/Functional/BambooTwigTestBase.php \Drupal\Tests\bamboo_twig\Functional\BambooTwigTestBase::assertElementCount()
  3. 8.3 tests/src/Functional/BambooTwigTestBase.php \Drupal\Tests\bamboo_twig\Functional\BambooTwigTestBase::assertElementCount()
  4. 8.4 tests/src/Functional/BambooTwigTestBase.php \Drupal\Tests\bamboo_twig\Functional\BambooTwigTestBase::assertElementCount()

Asserts that the element with the given CSS selector is present.

Parameters

string $css_selector: The CSS selector identifying the element to check.

int $count: Expected count.

string $locator: Container that must have $css_selector.

Throws

Behat\Mink\Exception\ExpectationException When the condition is not fulfilled.

See also

\Behat\Mink\WebAssert::elementsCount

1 call to BambooTwigTestBase::assertElementCount()
BambooTwigRenderTest::testMenu in tests/src/Functional/BambooTwigRenderTest.php
@covers Drupal\bamboo_twig_loader\TwigExtension\Render::renderMenu

File

tests/src/Functional/BambooTwigTestBase.php, line 368

Class

BambooTwigTestBase
Has some additional helper methods to make test code more readable.

Namespace

Drupal\Tests\bamboo_twig\Functional

Code

public function assertElementCount($css_selector, $count, $locator = NULL) {
  $container = $locator ? $this
    ->getSession()
    ->getPage()
    ->find('css', $locator) : NULL;
  $this
    ->assertSession()
    ->elementsCount('css', $css_selector, $count, $container);
}