Behat: More verbose error message in HTML field assertion

This commit is contained in:
Ingo Schommer 2013-09-14 18:28:02 +02:00
parent fde6b65769
commit 8de227554e

View File

@ -101,10 +101,11 @@ class CmsFormsContext extends BehatContext
$regex = '/'.preg_quote($html, '/').'/ui'; $regex = '/'.preg_quote($html, '/').'/ui';
if (!preg_match($regex, $actual)) { if (!preg_match($regex, $actual)) {
$message = sprintf( $message = sprintf(
'The string "%s" was not found in the HTML of the element matching %s "%s".', 'The string "%s" was not found in the HTML of the element matching %s "%s". Actual content: "%s"',
$html, $html,
'named', 'named',
$locator $locator,
$actual
); );
throw new ElementHtmlException($message, $this->getSession(), $element); throw new ElementHtmlException($message, $this->getSession(), $element);
} }