Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
throw exceptions for notices #178
From phpunit we now:
But with codeception notices are not converted to exceptions as we can see here:
Notices == 8 and the error handler here only throws exceptions for errors higher than notices.
To be sure to have good code you should change the default error handler to throw exceptions for notices as well.
What the hell?
@artyfarty So you dont like proper written code? Sorry but that statement is stupid. Everyone should care about php warnings and errors - every minor error can break your code as much as exceptions. Please revert that pull request, or make the desired error level asap configurable.
@omares yet not everybody care. For example, some library developers. There are many reasons why app can overflow with ignored warnings, when the source of those warnings is out of developers control. The reason can be simply legacy code.
When I'm integrating codeception into some old app i'm certainly not interesting in it saying "you app sucks, because 9001 warnings, we are not talking".
What's worse is that new warnings are introduced with new versions of PHP. For example, recently E_STRICT warnings, which were ignored previously, suddenly became 'on' by default. I see no problem in child class changing parent method's signature, PHPStorm sees no problem with it, interpreter sees no problem with it, yet codeception has problems with it.
Why something that's defined as non-fatal in php should be fatal for test execution? I see it as a poorly-written error handler, not as a feature.
Codeception is a tool. Testing tool shouldn't enforce somebody's ideology about coding standarts on developer.
I merged the Pull request but I didn't get a chance to test it. I'm doing complete reviews before releases, because I can't judge the code before seeing it in action.
The good part of this commit was: fixing issues with Yii module, the bad part of it: we shouldn't hide potential problems.
I must admit I agree with both sides here.
And for default behavior... yes, we should promote best practices, i.e. convert notices to exceptions.
Is it possible to configure this on and off? for instance, we have a passing test suite so long as they aren't thrown. We are working through our