Is there a good way to test against an error? #935
roni-estein
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
it feels like an odd question, yet I don't often reach for
__callStatic($name,$arguments),however I do have a use for it which adds a subtle change to the code using that class. Once I do, when putting it under test I want to assert all the expected functions are covered, but I've also deliberately passed on the error case for example if you call Example::foo($bar) and there is no foo($bar) it should error as per normal php. Should that be tested? If I throw an exception, it becomes a different error than the standard error: Undefined Method error. Any thoughts or wise words are appreciated.Beta Was this translation helpful? Give feedback.
All reactions