We're using PHPUnit to run both unit tests and functional tests that query some URLs via HTTP and check the output against some XPaths.
Now sometimes, PHP errors appear in the HTML output of the pages (display_errors is on, since it's a dev system) and I'd like to have detailed phpunit error messages with the error from the html page.
Handling the error is no problem, I know how to do this. The problem is extracting the error message - and when xdebug is enabled, the stack trace - from the HTML output.
Is there a library I can use which does that already?
Questions
it would probably be better if you wrote a test for that page itself, instead of something that retrieves the page?
Unfortunately, not all legacy code is easily testable. So doing some HTTP queries and checking the HTML is sometimes the only (or easiest) option.
Is not easier to set a custom error handler which logs all errors that occur while unit testing?
The tests are partly run on remote servers where I don't have direct access to from my unit tests.
Except of course I log them in some public accessible file and fetch them via http, too - but then I need to figure out which test the error belongs to, and have problems when several people run the tests at the same time.