Improving PHPUnit path detection when it is installed via pear

This commit is contained in:
José Lorenzo Rodríguez 2010-05-04 16:30:06 -04:30
parent 9afbeaa217
commit 10434c35b6
2 changed files with 17 additions and 10 deletions

View file

@ -92,7 +92,7 @@ class CakeTestSuiteDispatcher {
* @return void
*/
function dispatch() {
$this->_checkSimpleTest();
$this->_checkPHPUnit();
$this->_parseParams();
if ($this->params['group']) {
@ -110,20 +110,27 @@ class CakeTestSuiteDispatcher {
}
/**
* Checks that simpleTest is installed. Will exit if it doesn't
* Checks that PHPUnit is installed. Will exit if it doesn't
*
* @return void
*/
function _checkSimpleTest() {
function _checkPHPUnit() {
$found = $path = null;
foreach (App::path('vendors') as $vendor) {
if (is_dir($vendor . 'PHPUnit')) {
$path = $vendor;
}
if (@include 'PHPUnit' . DS . 'Framework.php') {
$found = true;
}
if ($path && ini_set('include_path', $path . PATH_SEPARATOR . ini_get('include_path'))) {
$found = include 'PHPUnit' . DS . 'Framework.php';
if (!$found) {
foreach (App::path('vendors') as $vendor) {
if (is_dir($vendor . 'PHPUnit')) {
$path = $vendor;
}
}
if ($path && ini_set('include_path', $path . PATH_SEPARATOR . ini_get('include_path'))) {
$found = include 'PHPUnit' . DS . 'Framework.php';
}
}
if (!$found) {

View file

@ -128,7 +128,7 @@ class TestManager extends PHPUnit_Runner_BaseTestRunner {
$result = new PHPUnit_Framework_TestResult;
$result->addListener($reporter);
$reporter->paintHeader($testSuite->getName());
$reporter->paintHeader();
$run = $testSuite->run($result);
$reporter->paintResult($result);
return $run;