| @@ 78-93 (lines=16) @@ | ||
| 75 | { |
|
| 76 | $exceptionElements = $this->getXpath()->findXpath("//div[@class='text-exception']/h1"); |
|
| 77 | $exceptionStackTraceItems = $this->getXpath()->findXpath("//ol[@id='traces-0']/li"); |
|
| 78 | if (count($exceptionElements) > 0) { |
|
| 79 | $exceptionElement = $exceptionElements[0]; |
|
| 80 | $exceptionLines = [$exceptionElement->getText(), '']; |
|
| 81 | ||
| 82 | foreach ($exceptionStackTraceItems as $stackTraceItem) { |
|
| 83 | $html = $stackTraceItem->getHtml(); |
|
| 84 | $html = substr($html, 0, strpos($html, '<a href', 1)); |
|
| 85 | $html = htmlspecialchars_decode(strip_tags($html)); |
|
| 86 | $html = preg_replace('/\s+/', ' ', $html); |
|
| 87 | $html = str_replace(' (', '(', $html); |
|
| 88 | $html = str_replace(' ->', '->', $html); |
|
| 89 | $exceptionLines[] = trim($html); |
|
| 90 | } |
|
| 91 | $message = 'An exception occured during rendering:' . implode("\n", $exceptionLines); |
|
| 92 | Assertion::assertTrue(false, $message); |
|
| 93 | } |
|
| 94 | } |
|
| 95 | ||
| 96 | /** |
|
| @@ 151-166 (lines=16) @@ | ||
| 148 | $page = $this->getSession()->getPage(); |
|
| 149 | $exceptionElements = $page->findAll('xpath', "//div[@class='text-exception']/h1"); |
|
| 150 | $exceptionStackTraceItems = $page->findAll('xpath', "//ol[@id='traces-0']/li"); |
|
| 151 | if (count($exceptionElements) > 0) { |
|
| 152 | $exceptionElement = $exceptionElements[0]; |
|
| 153 | $exceptionLines = [$exceptionElement->getText(), '']; |
|
| 154 | ||
| 155 | foreach ($exceptionStackTraceItems as $stackTraceItem) { |
|
| 156 | $html = $stackTraceItem->getHtml(); |
|
| 157 | $html = substr($html, 0, strpos($html, '<a href', 1)); |
|
| 158 | $html = htmlspecialchars_decode(strip_tags($html)); |
|
| 159 | $html = preg_replace('/\s+/', ' ', $html); |
|
| 160 | $html = str_replace(' (', '(', $html); |
|
| 161 | $html = str_replace(' ->', '->', $html); |
|
| 162 | $exceptionLines[] = trim($html); |
|
| 163 | } |
|
| 164 | $message = 'An exception occurred during rendering:' . implode("\n", $exceptionLines); |
|
| 165 | PHPUnit_Framework_Assert::assertTrue(false, $message); |
|
| 166 | } |
|
| 167 | } |
|
| 168 | $this->assertSession()->statusCodeEquals(200); |
|
| 169 | } |
|