public assertPageContainsTextsInOrder ( Behat\Gherkin\Node\TableNode $table ) | ||
$table | Behat\Gherkin\Node\TableNode |
public function assertPageContainsTextsInOrder(TableNode $table)
{
$texts = array();
foreach ($table->getRows() as $row) {
$texts[] = $row[0];
}
$pattern = "/" . implode(".*", $texts) . "/s";
$actual = $this->getSession()->getPage()->getText();
try {
assertRegExp($pattern, $actual);
} catch (AssertException $e) {
$message = sprintf('The texts "%s" was not found in order anywhere on the current page', implode('", "', $texts));
throw new ExpectationException($message, $this->getSession(), $e);
}
}