Add: ExcludeList usage for PHPUnit 9.4
This commit is contained in:
parent
6c9a25cccc
commit
f59915d905
@ -17,6 +17,7 @@ use PHPUnit\Framework\TestCase;
|
|||||||
use PHPUnit\Framework\TestSuite;
|
use PHPUnit\Framework\TestSuite;
|
||||||
use PHPUnit\Runner\BaseTestRunner;
|
use PHPUnit\Runner\BaseTestRunner;
|
||||||
use PHPUnit\Util\Blacklist;
|
use PHPUnit\Util\Blacklist;
|
||||||
|
use PHPUnit\Util\ExcludeList;
|
||||||
use PHPUnit\Util\Test;
|
use PHPUnit\Util\Test;
|
||||||
use Symfony\Bridge\PhpUnit\ClockMock;
|
use Symfony\Bridge\PhpUnit\ClockMock;
|
||||||
use Symfony\Bridge\PhpUnit\DnsMock;
|
use Symfony\Bridge\PhpUnit\DnsMock;
|
||||||
@ -48,7 +49,10 @@ class SymfonyTestsListenerTrait
|
|||||||
*/
|
*/
|
||||||
public function __construct(array $mockedNamespaces = [])
|
public function __construct(array $mockedNamespaces = [])
|
||||||
{
|
{
|
||||||
if (method_exists(Blacklist::class, 'addDirectory')) {
|
if (class_exists(ExcludeList::class)) {
|
||||||
|
(new ExcludeList())->getExcludedDirectories();
|
||||||
|
ExcludeList::addDirectory(\dirname((new \ReflectionClass(__CLASS__))->getFileName(), 2));
|
||||||
|
} elseif (method_exists(Blacklist::class, 'addDirectory')) {
|
||||||
(new BlackList())->getBlacklistedDirectories();
|
(new BlackList())->getBlacklistedDirectories();
|
||||||
Blacklist::addDirectory(\dirname((new \ReflectionClass(__CLASS__))->getFileName(), 2));
|
Blacklist::addDirectory(\dirname((new \ReflectionClass(__CLASS__))->getFileName(), 2));
|
||||||
} else {
|
} else {
|
||||||
|
@ -193,7 +193,7 @@ if (!file_exists("$PHPUNIT_DIR/$PHPUNIT_VERSION_DIR/phpunit") || $configurationH
|
|||||||
'requires' => ['php' => '*'],
|
'requires' => ['php' => '*'],
|
||||||
];
|
];
|
||||||
|
|
||||||
if (1 === \count($info['versions'])) {
|
if (1 === count($info['versions'])) {
|
||||||
$passthruOrFail("$COMPOSER create-project --ignore-platform-reqs --no-install --prefer-dist --no-scripts --no-plugins --no-progress -s dev phpunit/phpunit $PHPUNIT_VERSION_DIR \"$PHPUNIT_VERSION.*\"");
|
$passthruOrFail("$COMPOSER create-project --ignore-platform-reqs --no-install --prefer-dist --no-scripts --no-plugins --no-progress -s dev phpunit/phpunit $PHPUNIT_VERSION_DIR \"$PHPUNIT_VERSION.*\"");
|
||||||
} else {
|
} else {
|
||||||
$passthruOrFail("$COMPOSER create-project --ignore-platform-reqs --no-install --prefer-dist --no-scripts --no-plugins --no-progress phpunit/phpunit $PHPUNIT_VERSION_DIR \"$PHPUNIT_VERSION.*\"");
|
$passthruOrFail("$COMPOSER create-project --ignore-platform-reqs --no-install --prefer-dist --no-scripts --no-plugins --no-progress phpunit/phpunit $PHPUNIT_VERSION_DIR \"$PHPUNIT_VERSION.*\"");
|
||||||
@ -251,16 +251,20 @@ if (!file_exists("$PHPUNIT_DIR/$PHPUNIT_VERSION_DIR/phpunit") || $configurationH
|
|||||||
define('PHPUNIT_COMPOSER_INSTALL', __DIR__.'/vendor/autoload.php');
|
define('PHPUNIT_COMPOSER_INSTALL', __DIR__.'/vendor/autoload.php');
|
||||||
require PHPUNIT_COMPOSER_INSTALL;
|
require PHPUNIT_COMPOSER_INSTALL;
|
||||||
|
|
||||||
if (!class_exists('SymfonyBlacklistPhpunit', false)) {
|
if (!class_exists('SymfonyExcludeListPhpunit', false)) {
|
||||||
class SymfonyBlacklistPhpunit {}
|
class SymfonyExcludeListPhpunit {}
|
||||||
}
|
}
|
||||||
if (method_exists('PHPUnit\Util\Blacklist', 'addDirectory')) {
|
if (method_exists('PHPUnit\Util\ExcludeList', 'addDirectory')) {
|
||||||
|
(new PHPUnit\Util\Excludelist())->getExcludedDirectories();
|
||||||
|
PHPUnit\Util\ExcludeList::addDirectory(\dirname((new \ReflectionClass('SymfonyExcludeListPhpunit'))->getFileName()));
|
||||||
|
PHPUnit\Util\ExcludeList::addDirectory(\dirname((new \ReflectionClass('SymfonyExcludeListSimplePhpunit'))->getFileName()));
|
||||||
|
} elseif (method_exists('PHPUnit\Util\Blacklist', 'addDirectory')) {
|
||||||
(new PHPUnit\Util\BlackList())->getBlacklistedDirectories();
|
(new PHPUnit\Util\BlackList())->getBlacklistedDirectories();
|
||||||
PHPUnit\Util\Blacklist::addDirectory(\dirname((new \ReflectionClass('SymfonyBlacklistPhpunit'))->getFileName()));
|
PHPUnit\Util\Blacklist::addDirectory(\dirname((new \ReflectionClass('SymfonyExcludeListPhpunit'))->getFileName()));
|
||||||
PHPUnit\Util\Blacklist::addDirectory(\dirname((new \ReflectionClass('SymfonyBlacklistSimplePhpunit'))->getFileName()));
|
PHPUnit\Util\Blacklist::addDirectory(\dirname((new \ReflectionClass('SymfonyExcludeListSimplePhpunit'))->getFileName()));
|
||||||
} else {
|
} else {
|
||||||
PHPUnit\Util\Blacklist::$blacklistedClassNames['SymfonyBlacklistPhpunit'] = 1;
|
PHPUnit\Util\Blacklist::$blacklistedClassNames['SymfonyExcludeListPhpunit'] = 1;
|
||||||
PHPUnit\Util\Blacklist::$blacklistedClassNames['SymfonyBlacklistSimplePhpunit'] = 1;
|
PHPUnit\Util\Blacklist::$blacklistedClassNames['SymfonyExcludeListSimplePhpunit'] = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
Symfony\Bridge\PhpUnit\TextUI\Command::main();
|
Symfony\Bridge\PhpUnit\TextUI\Command::main();
|
||||||
@ -372,8 +376,8 @@ if ($components) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} elseif (!isset($argv[1]) || 'install' !== $argv[1] || file_exists('install')) {
|
} elseif (!isset($argv[1]) || 'install' !== $argv[1] || file_exists('install')) {
|
||||||
if (!class_exists('SymfonyBlacklistSimplePhpunit', false)) {
|
if (!class_exists('SymfonyExcludeListSimplePhpunit', false)) {
|
||||||
class SymfonyBlacklistSimplePhpunit
|
class SymfonyExcludeListSimplePhpunit
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user