1 year ago
#75135
galmok
phpUnit test code that sets up error handler
I have some php code in a class that uses inheritance and requires and during that loading process, the error handler is setup. This interferes with my phpUnit test as it captures the exceptions/errors that phpUnit needs to run my tests. This is a large project and I can't just go change stuff. I can add stuff, though.
I cannot change the existing error handler code and as such I am looking for a way to make phpUnit be able to prevent the error handlers being called. I thought about overriding the call to set_error_handler, but this as expected gives the "cannot redeclare" error.
Currently I manually edit setup portion of the error handler by commenting the set_error_handler function call, but it would be nice if I could make this automatic without changing the source code (only changing the test code).
Is my problem clearly enough described?
Is what I need possible without adding runtime modules or changing the source code, i.e. just change the unittest php file?
Using php 5.5.
php
error-handling
0 Answers
Your Answer