On Fri, May 15, 2015 at 11:41 AM, Dan Ackroyd <dan...@basereality.com> wrote:
> On 15 May 2015 at 17:12, Xinchen Hui <larue...@gmail.com> wrote: > >> How would that work when people want to write unit/integration tests > >> to test the behaviour of a module when an EngineException is thrown? > >> > >> If you can't create a certain type of exception, it would mean that > >> some code is basically untestable...which seems bad. > > You can not creat it directly, but you can trigger the engine to throw > one > > > > I don't think having to do something like: > > eval("<?php echo bar(};"); > > to test ParseExceptions is a good plan. > > Can you say what the actual problem is that would be solved by not > allowing them to be initialized from userland? It seems an artificial > limitation that just makes it harder to test programs. > > Why do you want to test parse exceptions? Lint your code before you run it and you won't have any. Additionally, your code doesn't run until after parsing is finished, so its not something that it makes sense to "test" since your code won't ever execute then... maybe I'm missing something obvious, but I've never wanted to test the parser, just my code written for it. > cheers > Dan > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > >