Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6905571
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T08:11:59+00:00 2026-05-27T08:11:59+00:00

Am using PHPUnit for unit testing my functions when ever any warning comes in

  • 0

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T08:12:00+00:00Added an answer on May 27, 2026 at 8:12 am

    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.

    By default, PHPUnit converts PHP errors, warnings, and notices that are triggered during the execution of a test to an exception.

    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 setUp of your test or the test itself by setting a static variable in the global namespace:

    # Warning:
    PHPUnit_Framework_Error_Warning::$enabled = FALSE;
    
    # notice, strict:
    PHPUnit_Framework_Error_Notice::$enabled = FALSE;
    

    Another option to change the default behaviour is to configure the testrunner with an XML file with the following settings:

    <phpunit convertErrorsToExceptions="false"
             convertNoticesToExceptions="false"
             convertWarningsToExceptions="false">
    </phpunit>
    

    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.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey everyone, I've been using PHPUnit to to do unit testing on a Symfony/Doctrine
I'm trying to write a unit test for a controller using Zend and PHPUnit
I'm using PHPUnit (3.6.7) to test and provide code coverage reports on my application,
I am currently performing unit tests on my code (using PHPUnit and Jenkins) but
I'm currently using Zend Framework in conjunction with PHPUnit to conduct unit testing on
I am trying to unit test my Zend Framework application using PHPUnit 3.6.4. I
When I'm unit-testing my php code with PHPUnit, I'm trying to figure out the
When i am trying to make unit testing the each file using PHPUnit tool
i am using simpletest as my php unit test framework. i put all my
I'm testing a Zend Framework application using PHPUnit and Jenkins. I need to override

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.