Skip to content

Commit

Permalink
Be compatible with PHPUnit installed with composer.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
markstory committed Mar 23, 2013
1 parent 61cc9b3 commit 386be52
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/Cake/TestSuite/CakeTestSuiteDispatcher.php
Expand Up @@ -137,15 +137,18 @@ protected function _checkPHPUnit() {
* @return boolean true if found, false otherwise
*/
public function loadTestFramework() {
if (class_exists('PHPUnit_Framework_TestCase')) {
return true;
}
foreach (App::path('vendors') as $vendor) {
$vendor = rtrim($vendor, DS);
if (is_dir($vendor . DS . 'PHPUnit')) {
ini_set('include_path', $vendor . PATH_SEPARATOR . ini_get('include_path'));
break;
}
}

return (include ('PHPUnit' . DS . 'Autoload.php')) !== false;
include 'PHPUnit' . DS . 'Autoload.php';
return class_exists('PHPUnit_Framework_TestCase');
}

/**
Expand Down

0 comments on commit 386be52

Please sign in to comment.