FIX: Invalid Exception throw results in CI failures

This commit is contained in:
madmatt 2014-04-15 23:56:03 +12:00
parent 7b85ffdcde
commit 1a1d5bdead
1 changed files with 16 additions and 4 deletions

View File

@ -605,13 +605,25 @@ JS;
if(trim($negate)) {
if (preg_match($regex, $actual)) {
$message = sprintf('The text "%s" was found in the text of the "%s" region.', $text, $region);
throw new \Exception($message, $this->getSession());
$message = sprintf(
'The text "%s" was found in the text of the "%s" region on the page %s.',
$text,
$region,
$this->getSession()->getCurrentUrl()
);
throw new \Exception($message);
}
} else {
if (!preg_match($regex, $actual)) {
$message = sprintf('The text "%s" was not found anywhere in the text of the "%s" region.', $text, $region);
throw new \Exception($message, $this->getSession());
$message = sprintf(
'The text "%s" was not found anywhere in the text of the "%s" region on the page %s.',
$text,
$region,
$this->getSession()->getCurrentUrl()
);
throw new \Exception($message);
}
}