mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Improving PHPUnit path detection when it is installed via pear
This commit is contained in:
parent
9afbeaa217
commit
10434c35b6
2 changed files with 17 additions and 10 deletions
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue