You are here

public function WebAssert::pageTextNotContains in Zircon Profile 8

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

Checks that current page does not contains text.

Parameters

string $text:

Throws

ResponseTextException

File

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

Class

WebAssert
Mink web assertions tool.

Namespace

Behat\Mink

Code

public function pageTextNotContains($text) {
  $actual = $this->session
    ->getPage()
    ->getText();
  $actual = preg_replace('/\\s+/u', ' ', $actual);
  $regex = '/' . preg_quote($text, '/') . '/ui';
  $message = sprintf('The text "%s" appears in the text of this page, but it should not.', $text);
  $this
    ->assertResponseText(!preg_match($regex, $actual), $message);
}