How to Determine if PHPUnit Tests are Running?

前端 未结 5 1208
别跟我提以往
别跟我提以往 2020-12-30 20:03

I currently have a problem that I have to work around in legacy code to get our interaction with a PHP Extension to work properly (Singleton Testing Question).

As su

5条回答
  •  余生分开走
    2020-12-30 20:45

    An alternative approach is to set a constant in the PHP section of your phpunit.xml.*:

    
       
    
    

    In your PHP application, you might then use the following check:

    if (defined('PHPUNIT_YOURAPPLICATION_TESTSUITE') && PHPUNIT_YOURAPPLICATION_TESTSUITE)
    { 
        echo 'TestSuite running!';
    }
    

提交回复
热议问题