You are here

public function WebAssert::responseNotContains in Zircon Profile 8

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

Checks that page HTML (response content) does not contains text.

Parameters

string $text:

Throws

ExpectationException

File

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

Class

WebAssert
Mink web assertions tool.

Namespace

Behat\Mink

Code

public function responseNotContains($text) {
  $actual = $this->session
    ->getPage()
    ->getContent();
  $regex = '/' . preg_quote($text, '/') . '/ui';
  $message = sprintf('The string "%s" appears in the HTML response of this page, but it should not.', $text);
  $this
    ->assert(!preg_match($regex, $actual), $message);
}