Merge branch '5.0' into 5.1
* 5.0: [String] Added a help message when translation-contracts is not installed Add: ExcludeList usage for PHPUnit 9.4 [Cache] Fix compat wth DBAL v3 [String] throw when Alpine is used and translit fails
This commit is contained in:
commit
f07b187e6e
@ -18,6 +18,7 @@ use PHPUnit\Framework\TestCase;
|
||||
use PHPUnit\Framework\TestSuite;
|
||||
use PHPUnit\Runner\BaseTestRunner;
|
||||
use PHPUnit\Util\Blacklist;
|
||||
use PHPUnit\Util\ExcludeList;
|
||||
use PHPUnit\Util\Test;
|
||||
use Symfony\Bridge\PhpUnit\ClockMock;
|
||||
use Symfony\Bridge\PhpUnit\DnsMock;
|
||||
@ -50,7 +51,10 @@ class SymfonyTestsListenerTrait
|
||||
*/
|
||||
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();
|
||||
Blacklist::addDirectory(\dirname((new \ReflectionClass(__CLASS__))->getFileName(), 2));
|
||||
} else {
|
||||
|
@ -193,7 +193,7 @@ if (!file_exists("$PHPUNIT_DIR/$PHPUNIT_VERSION_DIR/phpunit") || $configurationH
|
||||
'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.*\"");
|
||||
} 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.*\"");
|
||||
@ -251,16 +251,20 @@ if (!file_exists("$PHPUNIT_DIR/$PHPUNIT_VERSION_DIR/phpunit") || $configurationH
|
||||
define('PHPUNIT_COMPOSER_INSTALL', __DIR__.'/vendor/autoload.php');
|
||||
require PHPUNIT_COMPOSER_INSTALL;
|
||||
|
||||
if (!class_exists('SymfonyBlacklistPhpunit', false)) {
|
||||
class SymfonyBlacklistPhpunit {}
|
||||
if (!class_exists('SymfonyExcludeListPhpunit', false)) {
|
||||
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();
|
||||
PHPUnit\Util\Blacklist::addDirectory(\dirname((new \ReflectionClass('SymfonyBlacklistPhpunit'))->getFileName()));
|
||||
PHPUnit\Util\Blacklist::addDirectory(\dirname((new \ReflectionClass('SymfonyBlacklistSimplePhpunit'))->getFileName()));
|
||||
PHPUnit\Util\Blacklist::addDirectory(\dirname((new \ReflectionClass('SymfonyExcludeListPhpunit'))->getFileName()));
|
||||
PHPUnit\Util\Blacklist::addDirectory(\dirname((new \ReflectionClass('SymfonyExcludeListSimplePhpunit'))->getFileName()));
|
||||
} else {
|
||||
PHPUnit\Util\Blacklist::$blacklistedClassNames['SymfonyBlacklistPhpunit'] = 1;
|
||||
PHPUnit\Util\Blacklist::$blacklistedClassNames['SymfonyBlacklistSimplePhpunit'] = 1;
|
||||
PHPUnit\Util\Blacklist::$blacklistedClassNames['SymfonyExcludeListPhpunit'] = 1;
|
||||
PHPUnit\Util\Blacklist::$blacklistedClassNames['SymfonyExcludeListSimplePhpunit'] = 1;
|
||||
}
|
||||
|
||||
Symfony\Bridge\PhpUnit\TextUI\Command::main();
|
||||
@ -372,8 +376,8 @@ if ($components) {
|
||||
}
|
||||
}
|
||||
} elseif (!isset($argv[1]) || 'install' !== $argv[1] || file_exists('install')) {
|
||||
if (!class_exists('SymfonyBlacklistSimplePhpunit', false)) {
|
||||
class SymfonyBlacklistSimplePhpunit
|
||||
if (!class_exists('SymfonyExcludeListSimplePhpunit', false)) {
|
||||
class SymfonyExcludeListSimplePhpunit
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@ -445,16 +445,21 @@ class PdoAdapter extends AbstractAdapter implements PruneableInterface
|
||||
$this->driver = 'mysql';
|
||||
break;
|
||||
case $driver instanceof \Doctrine\DBAL\Driver\PDOSqlite\Driver:
|
||||
case $driver instanceof \Doctrine\DBAL\Driver\PDO\SQLite\Driver:
|
||||
$this->driver = 'sqlite';
|
||||
break;
|
||||
case $driver instanceof \Doctrine\DBAL\Driver\PDOPgSql\Driver:
|
||||
case $driver instanceof \Doctrine\DBAL\Driver\PDO\PgSQL\Driver:
|
||||
$this->driver = 'pgsql';
|
||||
break;
|
||||
case $driver instanceof \Doctrine\DBAL\Driver\OCI8\Driver:
|
||||
case $driver instanceof \Doctrine\DBAL\Driver\PDOOracle\Driver:
|
||||
case $driver instanceof \Doctrine\DBAL\Driver\PDO\OCI\Driver:
|
||||
$this->driver = 'oci';
|
||||
break;
|
||||
case $driver instanceof \Doctrine\DBAL\Driver\SQLSrv\Driver:
|
||||
case $driver instanceof \Doctrine\DBAL\Driver\PDOSqlsrv\Driver:
|
||||
case $driver instanceof \Doctrine\DBAL\Driver\PDO\SQLSrv\Driver:
|
||||
$this->driver = 'sqlsrv';
|
||||
break;
|
||||
default:
|
||||
|
@ -328,16 +328,21 @@ class PdoStore implements PersistingStoreInterface
|
||||
$this->driver = 'mysql';
|
||||
break;
|
||||
case $driver instanceof \Doctrine\DBAL\Driver\PDOSqlite\Driver:
|
||||
case $driver instanceof \Doctrine\DBAL\Driver\PDO\SQLite\Driver:
|
||||
$this->driver = 'sqlite';
|
||||
break;
|
||||
case $driver instanceof \Doctrine\DBAL\Driver\PDOPgSql\Driver:
|
||||
case $driver instanceof \Doctrine\DBAL\Driver\PDO\PgSQL\Driver:
|
||||
$this->driver = 'pgsql';
|
||||
break;
|
||||
case $driver instanceof \Doctrine\DBAL\Driver\OCI8\Driver:
|
||||
case $driver instanceof \Doctrine\DBAL\Driver\PDOOracle\Driver:
|
||||
case $driver instanceof \Doctrine\DBAL\Driver\PDO\OCI\Driver:
|
||||
$this->driver = 'oci';
|
||||
break;
|
||||
case $driver instanceof \Doctrine\DBAL\Driver\SQLSrv\Driver:
|
||||
case $driver instanceof \Doctrine\DBAL\Driver\PDOSqlsrv\Driver:
|
||||
case $driver instanceof \Doctrine\DBAL\Driver\PDO\SQLSrv\Driver:
|
||||
$this->driver = 'sqlsrv';
|
||||
break;
|
||||
default:
|
||||
|
@ -140,8 +140,10 @@ abstract class AbstractUnicodeString extends AbstractString
|
||||
} elseif (ICONV_IMPL === 'glibc') {
|
||||
$s = iconv('UTF-8', 'ASCII//TRANSLIT', $s);
|
||||
} else {
|
||||
$s = preg_replace_callback('/[^\x00-\x7F]/u', static function ($c) {
|
||||
$c = iconv('UTF-8', 'ASCII//IGNORE//TRANSLIT', $c[0]);
|
||||
$s = @preg_replace_callback('/[^\x00-\x7F]/u', static function ($c) {
|
||||
if ('' === $c = (string) iconv('UTF-8', 'ASCII//IGNORE//TRANSLIT', $c[0])) {
|
||||
throw new \LogicException(sprintf('"%s" requires a translit-able iconv implementation, try installing "gnu-libiconv" if you\'re using Alpine Linux.', static::class));
|
||||
}
|
||||
|
||||
return 1 < \strlen($c) ? ltrim($c, '\'`"^~') : (\strlen($c) ? $c : '?');
|
||||
}, $s);
|
||||
|
@ -15,6 +15,10 @@ use Symfony\Component\String\AbstractUnicodeString;
|
||||
use Symfony\Component\String\UnicodeString;
|
||||
use Symfony\Contracts\Translation\LocaleAwareInterface;
|
||||
|
||||
if (!interface_exists(LocaleAwareInterface::class)) {
|
||||
throw new \LogicException('You cannot use the "Symfony\Component\String\Slugger\AsciiSlugger" as the "symfony/translation-contracts" package is not installed. Try running "composer require symfony/translation-contracts".');
|
||||
}
|
||||
|
||||
/**
|
||||
* @author Titouan Galopin <galopintitouan@gmail.com>
|
||||
*/
|
||||
|
Reference in New Issue
Block a user