mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
Merge pull request #3489 from rchavik/2.5-composer
Updated the test suite dispatcher to allow use of PHPUnit from Composer
This commit is contained in:
commit
73f725e7ff
1 changed files with 12 additions and 2 deletions
|
@ -136,9 +136,19 @@ class CakeTestSuiteDispatcher {
|
||||||
if (class_exists('PHPUnit_Framework_TestCase')) {
|
if (class_exists('PHPUnit_Framework_TestCase')) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
foreach (App::path('vendors') as $vendor) {
|
$phpunitPath = 'phpunit' . DS . 'phpunit';
|
||||||
|
if (defined('PHP_WINDOWS_VERSION_MAJOR')) {
|
||||||
|
$composerGlobalDir[] = env('APPDATA') . DS . 'Composer' . DS . 'vendor' . DS;
|
||||||
|
} else {
|
||||||
|
$composerGlobalDir[] = env('HOME') . DS . '.composer' . DS . 'vendor' . DS;
|
||||||
|
}
|
||||||
|
$vendors = array_merge(App::path('vendors'), $composerGlobalDir);
|
||||||
|
foreach ($vendors as $vendor) {
|
||||||
$vendor = rtrim($vendor, DS);
|
$vendor = rtrim($vendor, DS);
|
||||||
if (is_dir($vendor . DS . 'PHPUnit')) {
|
if (is_dir($vendor . DS . $phpunitPath)) {
|
||||||
|
ini_set('include_path', $vendor . DS . $phpunitPath . PATH_SEPARATOR . ini_get('include_path'));
|
||||||
|
break;
|
||||||
|
} elseif (is_dir($vendor . DS . 'PHPUnit')) {
|
||||||
ini_set('include_path', $vendor . PATH_SEPARATOR . ini_get('include_path'));
|
ini_set('include_path', $vendor . PATH_SEPARATOR . ini_get('include_path'));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue