Be compatible with PHPUnit installed with composer.

Doing a class_exists() check is a simple way to check for PHPUnit being
installed via an autoloader. It also keeps things compatible with
a Vendor dir installation.

Fixes #3721