mirror of
https://github.com/silverstripe/silverstripe-behat-extension
synced 2024-10-22 15:05:32 +00:00
Merge pull request #33 from madmatt/pulls/fix-exceptions
FIX: Invalid Exception throw results in CI failures
This commit is contained in:
commit
ce302e74ad
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user