Am using PHPUnit for unit testing my functions when ever any warning comes in code the test script will not be executed for that functions, can anyone tell me how to ignore the warnings and proceed with testing
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
As Juhana commented you should first of all fix your code where the warning(s) appear. It’s a sign that the code is not working properly / strictly.
See Testing PHP Errors which has more information how to test for your warnings (and how to ignore warnings in sub-routines you call in tests).
To disable the default behaviour, you can tell PHPUnit to do so in your tests, e.g. within the
setUpof your test or the test itself by setting a static variable in the global namespace:Another option to change the default behaviour is to configure the testrunner with an XML file with the following settings:
These three options are not available as command-line switches.
See as well the related question: test the return value of a method that triggers an error with PHPUnit.