protected function checkForExceptions()
{
$exceptionElements = $this->getXpath()->findXpath("//div[@class='text-exception']/h1");
$exceptionStackTraceItems = $this->getXpath()->findXpath("//ol[@id='traces-0']/li");
if (count($exceptionElements) > 0) {
$exceptionElement = $exceptionElements[0];
$exceptionLines = [$exceptionElement->getText(), ''];
foreach ($exceptionStackTraceItems as $stackTraceItem) {
$html = $stackTraceItem->getHtml();
$html = substr($html, 0, strpos($html, '<a href', 1));
$html = htmlspecialchars_decode(strip_tags($html));
$html = preg_replace('/\\s+/', ' ', $html);
$html = str_replace(' (', '(', $html);
$html = str_replace(' ->', '->', $html);
$exceptionLines[] = trim($html);
}
$message = 'An exception occured during rendering:' . implode("\n", $exceptionLines);
Assertion::assertTrue(false, $message);
}
}