You are here

public function WebAssert::elementNotContains in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/behat/mink/src/WebAssert.php \Behat\Mink\WebAssert::elementNotContains()

Checks that specific element does not contains HTML.

Parameters

string $selectorType element selector type (css, xpath):

string|array $selector element selector:

string $html expected text:

Throws

ElementHtmlException

File

vendor/behat/mink/src/WebAssert.php, line 529

Class

WebAssert
Mink web assertions tool.

Namespace

Behat\Mink

Code

public function elementNotContains($selectorType, $selector, $html) {
  $element = $this
    ->elementExists($selectorType, $selector);
  $actual = $element
    ->getHtml();
  $regex = '/' . preg_quote($html, '/') . '/ui';
  $message = sprintf('The string "%s" appears in the HTML of the %s, but it should not.', $html, $this
    ->getMatchingElementRepresentation($selectorType, $selector));
  $this
    ->assertElement(!preg_match($regex, $actual), $message, $element);
}