PHP: Test for PHPUnit

I needed to short-circuit a logging routine because every time I ran PHPUnit it would put a bunch of bogus entries in my logs. Here is a simple test to see if we're inside of a PHPUnit test.

function in_unit_test() {
    $ret = class_exists('PHPUnit_Framework_TestCase');

    return $ret;
Leave A Reply
All content licensed under the Creative Commons License