-
Notifications
You must be signed in to change notification settings - Fork 7
getStateFragment blindly fetches from the key/value store #18
Comments
I think I was relying on how the user has configured its php to handle this case ^^. I can understand that this may very well be not enough, especially in the context of testing: when the goal is high quality code and explicit fast failure. My position would be to raise an exception ( It would be a strong enforcement to write consistent tests, without relying on underlying if/else or try/catch or even by prefixing with an What do you think? |
Completely agree. For new unit tests, would you expect contributors to keep using PHPUnit or would you be open to using PhpSpec as well? |
@walterdolce As unit tests are written in PHPUnit, you should keep using it. |
Sounds good to me. PR raised. |
Fixed by #21. Thanks @walterdolce and @vincentchalamon for your help :) |
Hi, I noticed the
getStateFragment
method inScenarioState
blindly fetches what gets requested from it without checking whether the key actually exists.I am aware the class could be extended to match the desired behaviour (raise an exception if the key is requested and does not exist? return
null
? etc), I was just wondering whether providing a "basic"ScenarioState
implementation has been intentional or not.-- Should the key fetching behaviour be configurable by users? I.e. to have something like
raise_exception_when_state_is_missing: true
in the config.-- Should it return
null
?-- Should it error, given some state has been requested but it's not there?
Let's discuss :)
Thanks!
The text was updated successfully, but these errors were encountered: