You are here

public function BambooTwigTestBase::assertElementEmpty in Bamboo Twig 8.5

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

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

Parameters

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

Throws

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

File

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

Class

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

Namespace

Drupal\Tests\bamboo_twig\Functional

Code

public function assertElementEmpty($css_selector) {
  $element = $this
    ->assertSession()
    ->elementExists('css', $css_selector);
  $actual = trim($element
    ->getHtml());
  $message = sprintf('The element "%s" was not empty, but it should not be.', $css_selector);
  $this
    ->assert(empty($actual), $message);
}