You are here

public function WebAssert::pageTextMatches in Zircon Profile 8

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

Checks that current page text matches regex.

Parameters

string $regex:

Throws

ResponseTextException

File

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

Class

WebAssert
Mink web assertions tool.

Namespace

Behat\Mink

Code

public function pageTextMatches($regex) {
  $actual = $this->session
    ->getPage()
    ->getText();
  $message = sprintf('The pattern %s was not found anywhere in the text of the current page.', $regex);
  $this
    ->assertResponseText((bool) preg_match($regex, $actual), $message);
}