mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Fix fatal error when checking for PHPUnit.
Doubly including PHPUnit/Autoload.php causes fatal errors. Having access to one of the PHPUnit classes means phpunit exists as well. Fixes #2890
This commit is contained in:
parent
c6258fa68c
commit
7107cd6631
1 changed files with 6 additions and 4 deletions
|
@ -680,12 +680,14 @@ class Shell extends Object {
|
||||||
* @return boolean Success
|
* @return boolean Success
|
||||||
*/
|
*/
|
||||||
protected function _checkUnitTest() {
|
protected function _checkUnitTest() {
|
||||||
if (App::import('Vendor', 'phpunit', array('file' => 'PHPUnit' . DS . 'Autoload.php'))) {
|
if (class_exists('PHPUnit_Framework_TestCase')) {
|
||||||
return true;
|
return true;
|
||||||
}
|
} elseif (@include 'PHPUnit' . DS . 'Autoload.php') {
|
||||||
if (@include 'PHPUnit' . DS . 'Autoload.php') {
|
return true;
|
||||||
|
} elseif (App::import('Vendor', 'phpunit', array('file' => 'PHPUnit' . DS . 'Autoload.php'))) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$prompt = __d('cake_console', 'PHPUnit is not installed. Do you want to bake unit test files anyway?');
|
$prompt = __d('cake_console', 'PHPUnit is not installed. Do you want to bake unit test files anyway?');
|
||||||
$unitTest = $this->in($prompt, array('y', 'n'), 'y');
|
$unitTest = $this->in($prompt, array('y', 'n'), 'y');
|
||||||
$result = strtolower($unitTest) == 'y' || strtolower($unitTest) == 'yes';
|
$result = strtolower($unitTest) == 'y' || strtolower($unitTest) == 'yes';
|
||||||
|
|
Loading…
Reference in a new issue