You are here

public function WebAssert::responseMatches in Zircon Profile 8

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

Checks that page HTML (response content) matches regex.

Parameters

string $regex:

Throws

ExpectationException

File

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

Class

WebAssert
Mink web assertions tool.

Namespace

Behat\Mink

Code

public function responseMatches($regex) {
  $actual = $this->session
    ->getPage()
    ->getContent();
  $message = sprintf('The pattern %s was not found anywhere in the HTML response of the page.', $regex);
  $this
    ->assert((bool) preg_match($regex, $actual), $message);
}