public function BambooTwigTestBase::assertElementEmpty in Bamboo Twig 8.4
Same name and namespace in other branches
- 8.5 tests/src/Functional/BambooTwigTestBase.php \Drupal\Tests\bamboo_twig\Functional\BambooTwigTestBase::assertElementEmpty()
- 8.3 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 296
Class
- BambooTwigTestBase
- Has some additional helper methods to make test code more readable.
Namespace
Drupal\Tests\bamboo_twig\FunctionalCode
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);
}