Is there a way to have Behat NOT fail on PHP Notice errors?

前端 未结 2 1685
野的像风
野的像风 2021-01-01 03:40

I understand that it is a best practice to have all variables defined and to check for array indexes before evaluating. However, I\'m trying to run some tests on new functio

相关标签:
2条回答
  • 2021-01-01 04:14

    EDIT: This will work for v2.x of Behat. For v > 3.x see Alexander Haas answer below.

    Finally found it! By digging in the code, I found that Behat has a way to change the error reporting level. Just do

    define('BEHAT_ERROR_REPORTING', E_ERROR | E_WARNING | E_PARSE);
    

    in the FeatureContext.php file. It does the trick!

    Afterwards, I googled the constant and found this in the changelog:

    • Added BEHAT_ERROR_REPORTING constant to change error_repoting level
    0 讨论(0)
  • 2021-01-01 04:20

    For Behat 3 see my question and answer: How to run Behat tests when there are errors of level E_USER_DEPRECATED

    BEHAT_ERROR_REPORTING is dropped in favor of a configuration value.

    0 讨论(0)
提交回复
热议问题