Merge branch '5.1' into 5.x

* 5.1:
  [Contracts] add branch-aliases for dev-main
  [Cache] Make Redis initializers static
  [Messenger] Fixed typos in Connection
  [CI] Fixed build on AppVeyor
  Fix tests typo
  [Lock] Reset Key lifetime time before we acquire it
  [CI] Silence errors when remove file/dir on test tearDown()
  Fix tests
  Remove content-type check on toArray methods
This commit is contained in:
Nicolas Grekas 2020-10-14 19:08:19 +02:00
commit ffbb9883bd
43 changed files with 211 additions and 128 deletions

View File

@ -142,7 +142,7 @@ class LintCommandTest extends TestCase
{
foreach ($this->files as $file) {
if (file_exists($file)) {
unlink($file);
@unlink($file);
}
}
}

View File

@ -121,9 +121,9 @@ EOF;
{
foreach ($this->files as $file) {
if (file_exists($file)) {
unlink($file);
@unlink($file);
}
}
rmdir(sys_get_temp_dir().'/xliff-lint-test');
@rmdir(sys_get_temp_dir().'/xliff-lint-test');
}
}

View File

@ -168,9 +168,9 @@ EOF;
{
foreach ($this->files as $file) {
if (file_exists($file)) {
unlink($file);
@unlink($file);
}
}
rmdir(sys_get_temp_dir().'/yml-lint-test');
@rmdir(sys_get_temp_dir().'/yml-lint-test');
}
}

View File

@ -175,7 +175,7 @@ trait RedisTrait
$connect = $params['persistent'] || $params['persistent_id'] ? 'pconnect' : 'connect';
$redis = new $class();
$initializer = function ($redis) use ($connect, $params, $dsn, $auth, $hosts) {
$initializer = static function ($redis) use ($connect, $params, $dsn, $auth, $hosts) {
try {
@$redis->{$connect}($hosts[0]['host'] ?? $hosts[0]['path'], $hosts[0]['port'] ?? null, $params['timeout'], (string) $params['persistent_id'], $params['retry_interval']);
@ -227,7 +227,7 @@ trait RedisTrait
$redis->setOption(\Redis::OPT_TCP_KEEPALIVE, $params['tcp_keepalive']);
}
} elseif (is_a($class, \RedisCluster::class, true)) {
$initializer = function () use ($class, $params, $dsn, $hosts) {
$initializer = static function () use ($class, $params, $dsn, $hosts) {
foreach ($hosts as $i => $host) {
$hosts[$i] = 'tcp' === $host['scheme'] ? $host['host'].':'.$host['port'] : $host['path'];
}

View File

@ -30,7 +30,7 @@ class ConfigCacheTest extends TestCase
foreach ($files as $file) {
if (file_exists($file)) {
unlink($file);
@unlink($file);
}
}
}

View File

@ -30,7 +30,7 @@ class FileExistenceResourceTest extends TestCase
protected function tearDown(): void
{
if (file_exists($this->file)) {
unlink($this->file);
@unlink($this->file);
}
}

View File

@ -30,11 +30,9 @@ class FileResourceTest extends TestCase
protected function tearDown(): void
{
if (!file_exists($this->file)) {
return;
if (file_exists($this->file)) {
@unlink($this->file);
}
unlink($this->file);
}
public function testGetResource()

View File

@ -31,7 +31,7 @@ class ResourceCheckerConfigCacheTest extends TestCase
foreach ($files as $file) {
if (file_exists($file)) {
unlink($file);
@unlink($file);
}
}
}

View File

@ -88,12 +88,6 @@ trait CommonResponseTrait
return $this->jsonData;
}
$contentType = $this->headers['content-type'][0] ?? 'application/json';
if (!preg_match('/\bjson\b/i', $contentType)) {
throw new JsonException(sprintf('Response content-type is "%s" while a JSON-compatible one was expected for "%s".', $contentType, $this->getInfo('url')));
}
try {
$content = json_decode($content, true, 512, \JSON_BIGINT_AS_STRING | (\PHP_VERSION_ID >= 70300 ? \JSON_THROW_ON_ERROR : 0));
} catch (\JsonException $e) {

View File

@ -54,12 +54,6 @@ class MockResponseTest extends TestCase
'message' => 'Response body is empty.',
];
yield [
'content' => '{}',
'responseHeaders' => ['content-type' => 'plain/text'],
'message' => 'Response content-type is "plain/text" while a JSON-compatible one was expected for "https://example.com/file.json".',
];
yield [
'content' => 'not json',
'responseHeaders' => [],

View File

@ -168,9 +168,9 @@ class FileBagTest extends TestCase
protected function tearDown(): void
{
foreach (glob(sys_get_temp_dir().'/form_test/*') as $file) {
unlink($file);
@unlink($file);
}
rmdir(sys_get_temp_dir().'/form_test');
@rmdir(sys_get_temp_dir().'/form_test');
}
}

View File

@ -43,7 +43,7 @@ class MockFileSessionStorageTest extends TestCase
{
array_map('unlink', glob($this->sessionDir.'/*'));
if (is_dir($this->sessionDir)) {
rmdir($this->sessionDir);
@rmdir($this->sessionDir);
}
$this->sessionDir = null;
$this->storage = null;

View File

@ -47,7 +47,7 @@ class NativeSessionStorageTest extends TestCase
session_write_close();
array_map('unlink', glob($this->savePath.'/*'));
if (is_dir($this->savePath)) {
rmdir($this->savePath);
@rmdir($this->savePath);
}
$this->savePath = null;

View File

@ -43,7 +43,7 @@ class PhpBridgeSessionStorageTest extends TestCase
session_write_close();
array_map('unlink', glob($this->savePath.'/*'));
if (is_dir($this->savePath)) {
rmdir($this->savePath);
@rmdir($this->savePath);
}
$this->savePath = null;

View File

@ -66,6 +66,7 @@ final class Lock implements SharedLockInterface, LoggerAwareInterface
*/
public function acquire(bool $blocking = false): bool
{
$this->key->resetLifetime();
try {
if ($blocking) {
if (!$this->store instanceof BlockingStoreInterface) {

View File

@ -460,7 +460,7 @@ class LockTest extends TestCase
return isset($this->keys[spl_object_hash($key)]);
}
public function putOffExpiration(Key $key, float $ttl)
public function putOffExpiration(Key $key, $ttl)
{
$key->reduceLifetime($ttl);
$this->checkNotExpired($key);
@ -476,6 +476,52 @@ class LockTest extends TestCase
$lock->release();
}
/**
* @group time-sensitive
*/
public function testAcquireTwiceWithExpiration()
{
$key = new Key(uniqid(__METHOD__, true));
$store = new class() implements PersistingStoreInterface {
use ExpiringStoreTrait;
private $keys = [];
private $initialTtl = 30;
public function save(Key $key)
{
$key->reduceLifetime($this->initialTtl);
$this->keys[spl_object_hash($key)] = $key;
$this->checkNotExpired($key);
return true;
}
public function delete(Key $key)
{
unset($this->keys[spl_object_hash($key)]);
}
public function exists(Key $key)
{
return isset($this->keys[spl_object_hash($key)]);
}
public function putOffExpiration(Key $key, $ttl)
{
$key->reduceLifetime($ttl);
$this->checkNotExpired($key);
}
};
$ttl = 1;
$lock = new Lock($key, $store, $ttl);
$this->assertTrue($lock->acquire());
$lock->release();
sleep($ttl + 1);
$this->assertTrue($lock->acquire());
$lock->release();
}
public function testAcquireReadBlockingWithBlockingSharedLockStoreInterface()
{
$key = new Key(uniqid(__METHOD__, true));

View File

@ -1,34 +1,37 @@
{
"name": "symfony/mailjet-mailer",
"type": "symfony-bridge",
"description": "Symfony Mailjet Mailer Bridge",
"keywords": [],
"homepage": "https://symfony.com",
"license": "MIT",
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
"name": "symfony/mailjet-mailer",
"type": "symfony-bridge",
"description": "Symfony Mailjet Mailer Bridge",
"keywords": [],
"homepage": "https://symfony.com",
"license": "MIT",
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"require": {
"php": "^7.2.5",
"symfony/mailer": "^4.4|^5.0"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
"require-dev": {
"symfony/http-client": "^4.4|^5.0"
},
"autoload": {
"psr-4": {
"Symfony\\Component\\Mailer\\Bridge\\Mailjet\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"minimum-stability": "dev",
"extra": {
"branch-version": "5.2"
}
],
"require": {
"php": "^7.2.5",
"symfony/mailer": "^4.4|^5.0"
},
"require-dev": {
"symfony/http-client": "^4.4|^5.0"
},
"autoload": {
"psr-4": {
"Symfony\\Component\\Mailer\\Bridge\\Mailjet\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"minimum-stability": "dev"
}

View File

@ -28,5 +28,8 @@
"/Tests/"
]
},
"minimum-stability": "dev"
"minimum-stability": "dev",
"extra": {
"branch-version": "5.2"
}
}

View File

@ -124,8 +124,8 @@ class Connection
* * host: Hostname of the AMQP service
* * port: Port of the AMQP service
* * vhost: Virtual Host to use with the AMQP service
* * user: Username to use to connect the the AMQP service
* * password: Password to use the connect to the AMQP service
* * user: Username to use to connect the AMQP service
* * password: Password to use to connect to the AMQP service
* * read_timeout: Timeout in for income activity. Note: 0 or greater seconds. May be fractional.
* * write_timeout: Timeout in for outcome activity. Note: 0 or greater seconds. May be fractional.
* * connect_timeout: Connection timeout. Note: 0 or greater seconds. May be fractional.
@ -157,8 +157,8 @@ class Connection
* which means heartbeats checked only during blocking calls.
*
* TLS support (see https://www.rabbitmq.com/ssl.html for details):
* * cacert: Path to the CA cert file in PEM format..
* * cert: Path to the client certificate in PEM foramt.
* * cacert: Path to the CA cert file in PEM format.
* * cert: Path to the client certificate in PEM format.
* * key: Path to the client key in PEM format.
* * verify: Enable or disable peer verification. If peer verification is enabled then the common name in the
* server certificate must match the server name. Peer verification is enabled by default.

View File

@ -26,5 +26,8 @@
"/Tests/"
]
},
"minimum-stability": "dev"
"minimum-stability": "dev",
"extra": {
"branch-version": "5.2"
}
}

View File

@ -50,7 +50,7 @@ class DoctrineIntegrationTest extends TestCase
{
$this->driverConnection->close();
if (file_exists($this->sqliteFile)) {
unlink($this->sqliteFile);
@unlink($this->sqliteFile);
}
}

View File

@ -30,7 +30,7 @@ class StopWorkerOnRestartSignalListenerTest extends TestCase
{
$cachePool = $this->createMock(CacheItemPoolInterface::class);
$cacheItem = $this->createMock(CacheItemInterface::class);
$cacheItem->expects($this->once())->method('isHIt')->willReturn(true);
$cacheItem->expects($this->once())->method('isHit')->willReturn(true);
$cacheItem->expects($this->once())->method('get')->willReturn(null === $lastRestartTimeOffset ? null : time() + $lastRestartTimeOffset);
$cachePool->expects($this->once())->method('getItem')->willReturn($cacheItem);
@ -54,7 +54,7 @@ class StopWorkerOnRestartSignalListenerTest extends TestCase
{
$cachePool = $this->createMock(CacheItemPoolInterface::class);
$cacheItem = $this->createMock(CacheItemInterface::class);
$cacheItem->expects($this->once())->method('isHIt')->willReturn(false);
$cacheItem->expects($this->once())->method('isHit')->willReturn(false);
$cacheItem->expects($this->never())->method('get');
$cachePool->expects($this->once())->method('getItem')->willReturn($cacheItem);

View File

@ -26,5 +26,8 @@
"/Tests/"
]
},
"minimum-stability": "dev"
"minimum-stability": "dev",
"extra": {
"branch-version": "5.2"
}
}

View File

@ -26,5 +26,8 @@
"/Tests/"
]
},
"minimum-stability": "dev"
"minimum-stability": "dev",
"extra": {
"branch-version": "5.2"
}
}

View File

@ -30,5 +30,8 @@
"/Tests/"
]
},
"minimum-stability": "dev"
"minimum-stability": "dev",
"extra": {
"branch-version": "5.2"
}
}

View File

@ -1,30 +1,33 @@
{
"name": "symfony/linked-in-notifier",
"type": "symfony-bridge",
"description": "Symfony LinkedIn Notifier Bridge",
"keywords": ["linkedin", "notifier"],
"homepage": "https://symfony.com",
"license": "MIT",
"authors": [
{
"name": "Smaïne Milianni",
"email": "smaine.milianni@gmail.com"
"name": "symfony/linked-in-notifier",
"type": "symfony-bridge",
"description": "Symfony LinkedIn Notifier Bridge",
"keywords": ["linkedin", "notifier"],
"homepage": "https://symfony.com",
"license": "MIT",
"authors": [
{
"name": "Smaïne Milianni",
"email": "smaine.milianni@gmail.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"require": {
"php": ">=7.2.5",
"symfony/http-client": "^4.3|^5.0",
"symfony/notifier": "^5.2"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
"autoload": {
"psr-4": { "Symfony\\Component\\Notifier\\Bridge\\LinkedIn\\": "" },
"exclude-from-classmap": [
"/Tests/"
]
},
"minimum-stability": "dev",
"extra": {
"branch-version": "5.2"
}
],
"require": {
"php": ">=7.2.5",
"symfony/http-client": "^4.3|^5.0",
"symfony/notifier": "^5.2"
},
"autoload": {
"psr-4": { "Symfony\\Component\\Notifier\\Bridge\\LinkedIn\\": "" },
"exclude-from-classmap": [
"/Tests/"
]
},
"minimum-stability": "dev"
}

View File

@ -27,5 +27,8 @@
"/Tests/"
]
},
"minimum-stability": "dev"
"minimum-stability": "dev",
"extra": {
"branch-version": "5.2"
}
}

View File

@ -27,5 +27,8 @@
"/Tests/"
]
},
"minimum-stability": "dev"
"minimum-stability": "dev",
"extra": {
"branch-version": "5.2"
}
}

View File

@ -28,5 +28,8 @@
"/Tests/"
]
},
"minimum-stability": "dev"
"minimum-stability": "dev",
"extra": {
"branch-version": "5.2"
}
}

View File

@ -26,5 +26,8 @@
"/Tests/"
]
},
"minimum-stability": "dev"
"minimum-stability": "dev",
"extra": {
"branch-version": "5.2"
}
}

View File

@ -29,5 +29,8 @@
"/Tests/"
]
},
"minimum-stability": "dev"
"minimum-stability": "dev",
"extra": {
"branch-version": "5.2"
}
}

View File

@ -36,7 +36,7 @@ class RouterTest extends TestCase
{
if (is_dir($this->cacheDir)) {
array_map('unlink', glob($this->cacheDir.\DIRECTORY_SEPARATOR.'*'));
rmdir($this->cacheDir);
@rmdir($this->cacheDir);
}
$this->loader = null;

View File

@ -32,5 +32,8 @@
"/Tests/"
]
},
"minimum-stability": "dev"
"minimum-stability": "dev",
"extra": {
"branch-version": "5.2"
}
}

View File

@ -179,10 +179,10 @@ XLIFF;
{
foreach ($this->files as $file) {
if (file_exists($file)) {
unlink($file);
@unlink($file);
}
}
rmdir(sys_get_temp_dir().'/translation-xliff-lint-test');
@rmdir(sys_get_temp_dir().'/translation-xliff-lint-test');
}
public function provideStrictFilenames()

View File

@ -45,7 +45,7 @@ abstract class FileValidatorTest extends ConstraintValidatorTestCase
}
if (file_exists($this->path)) {
unlink($this->path);
@unlink($this->path);
}
$this->path = null;

View File

@ -129,11 +129,11 @@ YAML;
{
foreach ($this->files as $file) {
if (file_exists($file)) {
unlink($file);
@unlink($file);
}
}
rmdir(sys_get_temp_dir().'/framework-yml-lint-test');
@rmdir(sys_get_temp_dir().'/framework-yml-lint-test');
}
}

View File

@ -27,12 +27,13 @@
},
"minimum-stability": "dev",
"extra": {
"branch-version": "2.3",
"branch-alias": {
"dev-main": "2.3-dev"
},
"thanks": {
"name": "symfony/contracts",
"url": "https://github.com/symfony/contracts"
}
},
"extra": {
"branch-version": "2.3"
}
}

View File

@ -25,6 +25,9 @@
"minimum-stability": "dev",
"extra": {
"branch-version": "2.3",
"branch-alias": {
"dev-main": "2.3-dev"
},
"thanks": {
"name": "symfony/contracts",
"url": "https://github.com/symfony/contracts"

View File

@ -27,12 +27,13 @@
},
"minimum-stability": "dev",
"extra": {
"branch-version": "2.3",
"branch-alias": {
"dev-main": "2.3-dev"
},
"thanks": {
"name": "symfony/contracts",
"url": "https://github.com/symfony/contracts"
}
},
"extra": {
"branch-version": "2.3"
}
}

View File

@ -26,12 +26,13 @@
},
"minimum-stability": "dev",
"extra": {
"branch-version": "2.3",
"branch-alias": {
"dev-main": "2.3-dev"
},
"thanks": {
"name": "symfony/contracts",
"url": "https://github.com/symfony/contracts"
}
},
"extra": {
"branch-version": "2.3"
}
}

View File

@ -27,12 +27,13 @@
},
"minimum-stability": "dev",
"extra": {
"branch-version": "2.3",
"branch-alias": {
"dev-main": "2.3-dev"
},
"thanks": {
"name": "symfony/contracts",
"url": "https://github.com/symfony/contracts"
}
},
"extra": {
"branch-version": "2.3"
}
}

View File

@ -26,12 +26,13 @@
},
"minimum-stability": "dev",
"extra": {
"branch-version": "2.3",
"branch-alias": {
"dev-main": "2.3-dev"
},
"thanks": {
"name": "symfony/contracts",
"url": "https://github.com/symfony/contracts"
}
},
"extra": {
"branch-version": "2.3"
}
}

View File

@ -48,6 +48,9 @@
},
"minimum-stability": "dev",
"extra": {
"branch-version": "2.3"
"branch-version": "2.3",
"branch-alias": {
"dev-main": "2.3-dev"
}
}
}