How to Determine if PHPUnit Tests are Running?

An alternative approach is to set a constant in the PHP section of your phpunit.xml.*: <php> <const name=”PHPUNIT_YOURAPPLICATION_TESTSUITE” value=”true”/> </php> In your PHP application, you might then use the following check: if (defined(‘PHPUNIT_YOURAPPLICATION_TESTSUITE’) && PHPUNIT_YOURAPPLICATION_TESTSUITE) { echo ‘TestSuite running!’; } First, we check that the constant is defined, secondly, we check the value of the … Read more

Phpunit error in PhpStorm

I had the same issue with Ubuntu 16.10, phpStorm 2017.2 and Laravel 5.5 Fixed it by uninstalling phpunit from my Ubuntu-system with sudo apt-get remove phpunit sudo apt-get install –autoremove or for mac: brew uninstall phpunit brew install phpunit My PhpStorm configuration (File -> Settings -> Languages & Frameworks -> PHP -> Test Frameworks): Works … Read more