Skip to content
Permalink
Browse files

Improving PHPUnit path detection when it is installed via pear

  • Loading branch information...
lorenzo committed May 4, 2010
1 parent 9afbeaa commit 10434c35b65373fcc376406dec303e1358ab745c
Showing with 17 additions and 10 deletions.
  1. +16 −9 cake/tests/lib/cake_test_suite_dispatcher.php
  2. +1 −1 cake/tests/lib/test_manager.php
@@ -92,7 +92,7 @@ function __construct() {
* @return void
*/
function dispatch() {
$this->_checkSimpleTest();
$this->_checkPHPUnit();
$this->_parseParams();
if ($this->params['group']) {
@@ -110,20 +110,27 @@ function dispatch() {
}
/**
* 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) {
@@ -128,7 +128,7 @@ public function runTestCase($testCaseFile, PHPUnit_Framework_TestListener &$repo
$result = new PHPUnit_Framework_TestResult;
$result->addListener($reporter);
$reporter->paintHeader($testSuite->getName());
$reporter->paintHeader();
$run = $testSuite->run($result);
$reporter->paintResult($result);
return $run;

0 comments on commit 10434c3

Please sign in to comment.
You can’t perform that action at this time.