Merge branch '4.4' into 5.0

* 4.4:
  [PhpUnitBridge] fix bad test
  [4.4] CS fixes
  [3.4] CS fixes
  Disable phpunit verbosity
  Queue name is a required parameter
  [FrameworkBundle] display actual target for error in AssetsInstallCommand
  Remove patches for Doctrine bugs and deprecations
  [Mime] fix bad method call on "EmailAddressContains"
  [DI][EventDispatcher] added contract for implementation
This commit is contained in:
Nicolas Grekas 2020-05-08 14:34:39 +02:00
commit 0b34b39cc8
17 changed files with 42 additions and 43 deletions

View File

@ -82,9 +82,8 @@ jobs:
echo "::endgroup::"
- name: Run tests
run: ./phpunit --verbose --group integration
run: ./phpunit --group integration
env:
SYMFONY_DEPRECATIONS_HELPER: 'max[indirect]=7'
REDIS_HOST: localhost
REDIS_CLUSTER_HOSTS: 'localhost:7000 localhost:7001 localhost:7002 localhost:7003 localhost:7004 localhost:7005'
MESSENGER_REDIS_DSN: redis://127.0.0.1:7006/messages
@ -96,6 +95,6 @@ jobs:
run: |
[ -d .phpunit ] && mv .phpunit .phpunit.bak
wget -q https://github.com/symfony/binary-utils/releases/download/v0.1/vulcain_0.1.3_Linux_x86_64.tar.gz -O - | tar xz && mv vulcain /usr/local/bin
docker run --rm -e COMPOSER_ROOT_VERSION -e SYMFONY_VERSION -v $(pwd):/app -v $(which composer):/usr/local/bin/composer -v /usr/local/bin/vulcain:/usr/local/bin/vulcain -w /app php:7.4-alpine ./phpunit --verbose src/Symfony/Component/HttpClient/Tests/CurlHttpClientTest.php --filter testHttp2Push
docker run --rm -e COMPOSER_ROOT_VERSION -e SYMFONY_VERSION -v $(pwd):/app -v $(which composer):/usr/local/bin/composer -v /usr/local/bin/vulcain:/usr/local/bin/vulcain -w /app php:7.4-alpine ./phpunit src/Symfony/Component/HttpClient/Tests/CurlHttpClientTest.php --filter testHttp2Push
sudo rm -rf .phpunit
[ -d .phpunit.bak ] && mv .phpunit.bak .phpunit

View File

@ -104,7 +104,7 @@
"doctrine/cache": "~1.6",
"doctrine/collections": "~1.0",
"doctrine/data-fixtures": "1.0.*",
"doctrine/dbal": "~2.4,<=2.10.2",
"doctrine/dbal": "~2.4",
"doctrine/orm": "~2.4,>=2.4.5",
"doctrine/reflection": "~1.0",
"doctrine/doctrine-bundle": "^2.0",

10
phpunit
View File

@ -21,14 +21,4 @@ if (!getenv('SYMFONY_PATCH_TYPE_DECLARATIONS')) {
putenv('SYMFONY_PATCH_TYPE_DECLARATIONS=deprecations=1');
}
putenv('SYMFONY_PHPUNIT_DIR='.__DIR__.'/.phpunit');
if (!getenv('SYMFONY_DEPRECATIONS_HELPER')) {
foreach ($_SERVER['argv'] as $v) {
if (false !== strpos($v, 'Bridge/Doctrine')) {
putenv('SYMFONY_DEPRECATIONS_HELPER=max[indirect]=7');
break;
}
}
}
require __DIR__.'/vendor/symfony/phpunit-bridge/bin/simple-phpunit';

View File

@ -25,7 +25,7 @@ class DoctrineTransactionMiddlewareTest extends MiddlewareTestCase
private $entityManager;
private $middleware;
public function setUp(): void
protected function setUp(): void
{
$this->connection = $this->createMock(Connection::class);

View File

@ -42,7 +42,7 @@
"doctrine/cache": "~1.6",
"doctrine/collections": "~1.0",
"doctrine/data-fixtures": "1.0.*",
"doctrine/dbal": "~2.4,<=2.10.2",
"doctrine/dbal": "~2.4",
"doctrine/orm": "^2.6.3",
"doctrine/reflection": "~1.0"
},

View File

@ -22,6 +22,7 @@ class DeprecationTest extends TestCase
use SetUpTearDownTrait;
private static $vendorDir;
private static $prefixDirsPsr4;
private static function getVendorDir()
{
@ -151,22 +152,6 @@ class DeprecationTest extends TestCase
public function providerGetTypeDetectsSelf()
{
foreach (get_declared_classes() as $class) {
if ('C' === $class[0] && 0 === strpos($class, 'ComposerAutoloaderInit')) {
$r = new \ReflectionClass($class);
$v = \dirname(\dirname($r->getFileName()));
if (file_exists($v.'/composer/installed.json')) {
$loader = require $v.'/autoload.php';
$reflection = new \ReflectionClass($loader);
$prop = $reflection->getProperty('prefixDirsPsr4');
$prop->setAccessible(true);
$currentValue = $prop->getValue($loader);
$currentValue['Symfony\\Bridge\\PhpUnit\\'] = [realpath(__DIR__.'/../..')];
$prop->setValue($loader, $currentValue);
}
}
}
return [
'not_from_vendors_file' => [Deprecation::TYPE_SELF, '', 'MyClass1', __FILE__],
'nonexistent_file' => [Deprecation::TYPE_UNDETERMINED, '', 'MyClass1', 'dummy_vendor_path'],
@ -276,8 +261,32 @@ class DeprecationTest extends TestCase
rmdir($dir);
}
private static function doSetupBeforeClass()
{
foreach (get_declared_classes() as $class) {
if ('C' === $class[0] && 0 === strpos($class, 'ComposerAutoloaderInit')) {
$r = new \ReflectionClass($class);
$v = \dirname(\dirname($r->getFileName()));
if (file_exists($v.'/composer/installed.json')) {
$loader = require $v.'/autoload.php';
$reflection = new \ReflectionClass($loader);
$prop = $reflection->getProperty('prefixDirsPsr4');
$prop->setAccessible(true);
$currentValue = $prop->getValue($loader);
self::$prefixDirsPsr4[] = [$prop, $loader, $currentValue];
$currentValue['Symfony\\Bridge\\PhpUnit\\'] = [realpath(__DIR__.'/../..')];
$prop->setValue($loader, $currentValue);
}
}
}
}
private static function doTearDownAfterClass()
{
foreach (self::$prefixDirsPsr4 as [$prop, $loader, $prefixDirsPsr4]) {
$prop->setValue($loader, $prefixDirsPsr4);
}
self::removeDir(self::getVendorDir().'/myfakevendor');
}
}

View File

@ -105,7 +105,7 @@ EOT
$targetArg = $kernel->getProjectDir().'/'.$targetArg;
if (!is_dir($targetArg)) {
throw new InvalidArgumentException(sprintf('The target directory "%s" does not exist.', $input->getArgument('target')));
throw new InvalidArgumentException(sprintf('The target directory "%s" does not exist.', $targetArg));
}
}

View File

@ -149,7 +149,7 @@ class ExprBuilderTest extends TestCase
/**
* @dataProvider castToArrayValues
*/
public function testcastToArrayExpression($configValue, $expectedValue)
public function testCastToArrayExpression($configValue, $expectedValue)
{
$test = $this->getTestBuilder()
->castToArray()

View File

@ -60,7 +60,7 @@ class TerminalTest extends TestCase
$this->assertSame(60, $terminal->getHeight());
}
public function test_zero_values()
public function testZeroValues()
{
putenv('COLUMNS=0');
putenv('LINES=0');

View File

@ -40,6 +40,9 @@ interface EventSubscriberInterface
* * ['eventName' => ['methodName', $priority]]
* * ['eventName' => [['methodName1', $priority], ['methodName2']]]
*
* The code must not depend on runtime state as it will only be called at compile time.
* All logic depending on runtime state must be put into the individual methods handling the events.
*
* @return array The event names to listen to
*/
public static function getSubscribedEvents();

View File

@ -48,7 +48,7 @@ class SemaphoreStoreTest extends AbstractStoreTest
private function getOpenedSemaphores()
{
if ('Darwin' === PHP_OS) {
$lines = explode(PHP_EOL, trim(`ipcs -s`));
$lines = explode(PHP_EOL, trim(shell_exec('ipcs -s')));
if (-1 === $start = array_search('Semaphores:', $lines)) {
throw new \Exception('Failed to extract list of opened semaphores. Expected a Semaphore list, got '.implode(PHP_EOL, $lines));
}
@ -56,7 +56,7 @@ class SemaphoreStoreTest extends AbstractStoreTest
return \count(\array_slice($lines, ++$start));
}
$lines = explode(PHP_EOL, trim(`LC_ALL=C ipcs -su`));
$lines = explode(PHP_EOL, trim(shell_exec('LC_ALL=C ipcs -su')));
if ('------ Semaphore Status --------' !== $lines[0]) {
throw new \Exception('Failed to extract list of opened semaphores. Expected a Semaphore status, got '.implode(PHP_EOL, $lines));
}

View File

@ -12,7 +12,6 @@
namespace Symfony\Component\Mailer\Bridge\Mailchimp\Transport;
use Psr\Log\LoggerInterface;
use Symfony\Component\Mailer\Envelope;
use Symfony\Component\Mailer\Exception\HttpTransportException;
use Symfony\Component\Mailer\SentMessage;
use Symfony\Component\Mailer\Transport\AbstractHttpTransport;

View File

@ -326,7 +326,7 @@ class Connection
// If we get a 404 for the queue, it means we need to set up the exchange & queue.
$this->setupExchangeAndQueues();
return $this->get();
return $this->get($queueName);
}
throw $e;

View File

@ -48,7 +48,7 @@ final class EmailAddressContains extends Constraint
$header = $message->getHeaders()->get($this->headerName);
if ($header instanceof MailboxHeader) {
return $this->expectedValue === $header->Address()->getAddress();
return $this->expectedValue === $header->getAddress()->getAddress();
} elseif ($header instanceof MailboxListHeader) {
foreach ($header->getAddresses() as $address) {
if ($this->expectedValue === $address->getAddress()) {

View File

@ -26,7 +26,6 @@ class UsernamePasswordToken extends AbstractToken
/**
* @param string|\Stringable|UserInterface $user The username (like a nickname, email address, etc.) or a UserInterface instance
* @param mixed $credentials
* @param string $providerKey
* @param string[] $roles
*
* @throws \InvalidArgumentException

View File

@ -60,7 +60,7 @@ class AccessDecisionManager implements AccessDecisionManagerInterface
*/
public function decide(TokenInterface $token, array $attributes, $object = null/*, bool $allowMultipleAttributes = false*/)
{
$allowMultipleAttributes = 3 < func_num_args() && func_get_arg(3);
$allowMultipleAttributes = 3 < \func_num_args() && func_get_arg(3);
// Special case for AccessListener, do not remove the right side of the condition before 6.0
if (\count($attributes) > 1 && !$allowMultipleAttributes) {

View File

@ -600,7 +600,7 @@ return function (root, x) {
*/
return;
}
e.preventDefault();
search.className = search.className.replace(/\bsf-dump-search-hidden\b/, '');
searchInput.focus();