Merge branch '5.2' into 5.x

* 5.2:
  [Messenger][SQS] Document missing option
  Specify that we run CI on Ubuntu-20.04
  zero parts can be omitted in date interval input
This commit is contained in:
Alexander M. Turek 2021-03-02 13:23:03 +01:00
commit a8a0650161
5 changed files with 12 additions and 3 deletions

View File

@ -15,7 +15,7 @@ defaults:
jobs:
tests:
name: Tests (intl-data)
runs-on: ubuntu-latest
runs-on: Ubuntu-20.04
steps:
- name: Checkout

View File

@ -11,7 +11,7 @@ defaults:
jobs:
integration:
name: Integration
runs-on: ubuntu-latest
runs-on: Ubuntu-20.04
strategy:
matrix:

View File

@ -96,6 +96,7 @@ class Connection
* * wait_time: long polling duration in seconds (Default: 20)
* * poll_timeout: amount of seconds the transport should wait for new message
* * visibility_timeout: amount of seconds the message won't be visible
* * sslmode: Can be "disable" to use http for a custom endpoint
* * auto_setup: Whether the queue should be created automatically during send / get (Default: true)
* * debug: Log all HTTP requests and responses as LoggerInterface::DEBUG (Default: false)
*/

View File

@ -96,7 +96,7 @@ class DateIntervalNormalizer implements NormalizerInterface, DenormalizerInterfa
$dateIntervalFormat = substr($dateIntervalFormat, 2);
break;
}
$valuePattern = '/^'.$signPattern.preg_replace('/%([yYmMdDhHiIsSwW])(\w)/', '(?P<$1>\d+)$2', $dateIntervalFormat).'$/';
$valuePattern = '/^'.$signPattern.preg_replace('/%([yYmMdDhHiIsSwW])(\w)/', '(?:(?P<$1>\d+)$2)?', preg_replace('/(T.*)$/', '($1)?', $dateIntervalFormat)).'$/';
if (!preg_match($valuePattern, $data)) {
throw new UnexpectedValueException(sprintf('Value "%s" contains intervals not accepted by format "%s".', $data, $dateIntervalFormat));
}

View File

@ -104,6 +104,14 @@ class DateIntervalNormalizerTest extends TestCase
$this->assertDateIntervalEquals($this->getInterval($output), $normalizer->denormalize($input, \DateInterval::class));
}
public function testDenormalizeIntervalsWithOmittedPartsBeingZero()
{
$normalizer = new DateIntervalNormalizer();
$this->assertDateIntervalEquals($this->getInterval('P3Y2M4DT0H0M0S'), $normalizer->denormalize('P3Y2M4D', \DateInterval::class));
$this->assertDateIntervalEquals($this->getInterval('P0Y0M0DT12H34M0S'), $normalizer->denormalize('PT12H34M', \DateInterval::class));
}
public function testDenormalizeExpectsString()
{
$this->expectException(InvalidArgumentException::class);