diff --git a/admin/tool/phpunit/cli/util.php b/admin/tool/phpunit/cli/util.php index 6bda8483c5e..8d60ff3c952 100644 --- a/admin/tool/phpunit/cli/util.php +++ b/admin/tool/phpunit/cli/util.php @@ -50,12 +50,10 @@ list($options, $unrecognized) = cli_get_params( ) ); -if (file_exists(__DIR__.'/../../../../vendor/phpunit/phpunit/composer.json')) { - // Composer packages present. - require_once(__DIR__.'/../../../../vendor/autoload.php'); - -} else { - // Note: installation via PEAR is not supported any more. +// Basic check to see if phpunit is installed. +if (!file_exists(__DIR__.'/../../../../vendor/phpunit/phpunit/composer.json') || + !file_exists(__DIR__.'/../../../../vendor/bin/phpunit') || + !file_exists(__DIR__.'/../../../../vendor/autoload.php')) { phpunit_bootstrap_error(PHPUNIT_EXITCODE_PHPUNITMISSING); } @@ -74,12 +72,13 @@ if ($options['run']) { } } $_SERVER['argv'] = array_values($_SERVER['argv']); - PHPUnit\TextUI\Command::main(); + require(__DIR__ . '/../../../../vendor/bin/phpunit'); exit(0); } define('PHPUNIT_UTIL', true); +require(__DIR__.'/../../../../vendor/autoload.php'); require(__DIR__ . '/../../../../lib/phpunit/bootstrap.php'); // from now on this is a regular moodle CLI_SCRIPT