1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
<?php
/**
* Provides flexibilty for using either simple-phpunit or phpunit
*/
$vendorBin = __DIR__.'/../vendor/bin';
// See if we using simple-phpunit
$path = realpath($vendorBin.'/simple-phpunit');
if ($path !== false) {
// simple-phpunit will update the .phpunit symlink/junction
$phpunit = escapeshellarg(PHP_BINARY).' '.escapeshellarg($path);
passthru($phpunit.' install');
$autoloader = $vendorBin.'/.phpunit/phpunit/vendor/autoload.php';
if (!file_exists($autoloader)) {
echo 'Cannot run PHPStan: simple-phpunit did not install PHPUnit as expected'.PHP_EOL;
exit(1);
}
include $autoloader;
return;
}
if (realpath($vendorBin.'/phpunit') === false) {
echo 'Cannot run PHPStan: PHPUnit has not been installed'.PHP_EOL;
exit(1);
}
|