public function WebAssert::pageTextContains in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/behat/mink/src/WebAssert.php \Behat\Mink\WebAssert::pageTextContains()
Checks that current page contains text.
Parameters
string $text:
Throws
File
- vendor/
behat/ mink/ src/ WebAssert.php, line 255
Class
- WebAssert
- Mink web assertions tool.
Namespace
Behat\MinkCode
public function pageTextContains($text) {
$actual = $this->session
->getPage()
->getText();
$actual = preg_replace('/\\s+/u', ' ', $actual);
$regex = '/' . preg_quote($text, '/') . '/ui';
$message = sprintf('The text "%s" was not found anywhere in the text of the current page.', $text);
$this
->assertResponseText((bool) preg_match($regex, $actual), $message);
}