Prevent unit tests from fatally failing if database is not available. #1454
Prevent unit tests from fatally failing if database is not available. #1454
Conversation
Take a look at the following line: I think this line should mark the test as incomplete if This is only a guess. Sorry if I am wrong. |
I don't follow how that change will prevent getConnection from being executed - please explain. |
It doesn't look like |
I hope this is along the lines of what you were thinking, @stefanneculai. |
I was suggesting that the fix to this issue would be just to change |
According to the PHP documentation empty(null) == true - http://php.net/manual/en/function.empty.php. The problem is that marking the unit test as skipped doesn't immediately terminate the current test. |
I know that but on some versions of PHP empty(null) returns false. :-) Also, marking a test as skipped terminates the current test immediately (I have just tried that). |
Well, I tried making the change you suggested on 491 just to be sure, and it didn't work. If you have or anyone else have a simpler solution that solves the problem, I'm all ears... but I haven't found one yet. |
This looks good enough. Thanks. |
Prevent unit tests from fatally failing if database is not available.
Without these changes, all unit test crash when phpunit attempts to call a method on a null object.