mirror of
https://github.com/composer/composer
synced 2025-05-09 08:32:56 +00:00
Remove PHPUnit direct require again
This commit is contained in:
parent
bf72afec44
commit
59603a357a
6 changed files with 45 additions and 1069 deletions
|
@ -52,6 +52,7 @@ parameters:
|
|||
- '~Dynamic call to static method PHPUnit\\Framework\\TestCase::(once|at|exactly|will|exactly|returnValue|returnCallback|any|atLeastOnce|throwException|onConsecutiveCalls|never|returnValueMap)\(\)~'
|
||||
|
||||
bootstrapFiles:
|
||||
- ./locate-phpunit-autoloader.php
|
||||
- ../tests/bootstrap.php
|
||||
|
||||
paths:
|
||||
|
|
22
phpstan/locate-phpunit-autoloader.php
Normal file
22
phpstan/locate-phpunit-autoloader.php
Normal file
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
|
||||
$bestDirFound = null;
|
||||
$dirs = glob(__DIR__.'/../vendor/bin/.phpunit/phpunit-*');
|
||||
natsort($dirs);
|
||||
|
||||
foreach (array_reverse($dirs) as $dir) {
|
||||
$bestDirFound = $dir;
|
||||
if (PHP_VERSION_ID >= 80000 && false !== strpos($dir, 'phpunit-9')) {
|
||||
break;
|
||||
}
|
||||
if (PHP_VERSION_ID < 80000 && false !== strpos($dir, 'phpunit-8')) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (null === $bestDirFound) {
|
||||
echo 'Run "composer test" to initialize PHPUnit sources before running PHPStan'.PHP_EOL;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
include $bestDirFound.'/vendor/autoload.php';
|
Loading…
Add table
Add a link
Reference in a new issue