Merge branch '4.4' into 5.2

* 4.4:
  Fix tests
  Fix minor typos
  [WebProfilerBundle] Fix the values of some CSS properties
  [Yaml] Fixed an exception message
  Fix ctype_digit deprecation
  Add a Special Case for Translating Choices in en_US_POSIX
This commit is contained in:
Nicolas Grekas 2021-07-13 12:03:28 +02:00
commit 0cc054ce1d
11 changed files with 34 additions and 19 deletions

View File

@ -139,7 +139,7 @@ jobs:
if: "${{ matrix.php == '8.0' && ! matrix.mode }}"
run: |
sed -i 's/"\*\*\/Tests\/"//' composer.json
composer install --optimize-autoloader
composer install -q --optimize-autoloader
SYMFONY_PATCH_TYPE_DECLARATIONS=force=1 php .github/patch-types.php
SYMFONY_PATCH_TYPE_DECLARATIONS=force=1 php .github/patch-types.php # ensure the script is idempotent
echo PHPUNIT="$PHPUNIT,legacy" >> $GITHUB_ENV

View File

@ -209,7 +209,7 @@ abstract class AbstractDescriptorTest extends TestCase
}
/** @dataProvider getClassDescriptionTestData */
public function testGetClassDecription($object, $expectedDescription)
public function testGetClassDescription($object, $expectedDescription)
{
$this->assertEquals($expectedDescription, $this->getDescriptor()->getClassDescription($object));
}

View File

@ -1,5 +1,5 @@
.container {
max-width: auto;
max-width: none;
margin: 0;
padding: 0;
}
@ -28,5 +28,5 @@
}
.exception-message-wrapper .container {
min-height: auto;
min-height: unset;
}

View File

@ -1033,14 +1033,14 @@ And, as in uffish thought he stood, The Jabberwock, with eyes of flame, Came whi
$bar->setRedrawFrequency(4); // disable step based redraws
$bar->start();
$bar->setProgress(1); // No treshold hit, no redraw
$bar->setProgress(1); // No threshold hit, no redraw
$bar->maxSecondsBetweenRedraws(2);
sleep(1);
$bar->setProgress(2); // Still no redraw because it takes 2 seconds for a redraw
sleep(1);
$bar->setProgress(3); // 1+1 = 2 -> redraw finally
$bar->setProgress(4); // step based redraw freq hit, redraw even without sleep
$bar->setProgress(5); // No treshold hit, no redraw
$bar->setProgress(5); // No threshold hit, no redraw
$bar->maxSecondsBetweenRedraws(3);
sleep(2);
$bar->setProgress(6); // No redraw even though 2 seconds passed. Throttling has priority
@ -1071,7 +1071,7 @@ And, as in uffish thought he stood, The Jabberwock, with eyes of flame, Came whi
$bar->setProgress(3); // 1 second passed but we changed threshold, should not draw
sleep(1);
$bar->setProgress(4); // 1+1 seconds = 2 seconds passed which conforms threshold, draw
$bar->setProgress(5); // No treshold hit, no redraw
$bar->setProgress(5); // No threshold hit, no redraw
rewind($output->getStream());
$this->assertEquals(

View File

@ -599,7 +599,7 @@ class ConnectionTest extends TestCase
$connection->publish('body', ['Foo' => 'X'], 0, new AmqpStamp(null, \AMQP_NOPARAM, ['headers' => ['Bar' => 'Y']]));
}
public function testAmqpStampDelireryModeIsUsed()
public function testAmqpStampDeliveryModeIsUsed()
{
$factory = new TestAmqpFactory(
$this->createMock(\AMQPConnection::class),

View File

@ -177,12 +177,12 @@ class SendFailedMessageForRetryListenerTest extends TestCase
$senderLocator = $this->createMock(ContainerInterface::class);
$senderLocator->expects($this->once())->method('has')->willReturn(true);
$senderLocator->expects($this->once())->method('get')->willReturn($sender);
$retryStategy = $this->createMock(RetryStrategyInterface::class);
$retryStategy->expects($this->once())->method('isRetryable')->willReturn(true);
$retryStategy->expects($this->once())->method('getWaitingTime')->willReturn(1000);
$retryStrategy = $this->createMock(RetryStrategyInterface::class);
$retryStrategy->expects($this->once())->method('isRetryable')->willReturn(true);
$retryStrategy->expects($this->once())->method('getWaitingTime')->willReturn(1000);
$retryStrategyLocator = $this->createMock(ContainerInterface::class);
$retryStrategyLocator->expects($this->once())->method('has')->willReturn(true);
$retryStrategyLocator->expects($this->once())->method('get')->willReturn($retryStategy);
$retryStrategyLocator->expects($this->once())->method('get')->willReturn($retryStrategy);
$listener = new SendFailedMessageForRetryListener($senderLocator, $retryStrategyLocator);

View File

@ -1988,7 +1988,7 @@ class RecursiveValidatorTest extends TestCase
$this->assertSame($constraint, $violations[0]->getConstraint());
}
public function testCollectionConstraitViolationHasCorrectContext()
public function testCollectionConstraintViolationHasCorrectContext()
{
$data = [
'foo' => 'fooValue',

View File

@ -161,8 +161,8 @@ class Inline
return 'true';
case false === $value:
return 'false';
case ctype_digit($value):
return \is_string($value) ? "'$value'" : (int) $value;
case \is_int($value):
return $value;
case is_numeric($value) && false === strpos($value, "\f") && false === strpos($value, "\n") && false === strpos($value, "\r") && false === strpos($value, "\t") && false === strpos($value, "\v"):
$locale = setlocale(\LC_NUMERIC, 0);
if (false !== $locale) {
@ -729,7 +729,7 @@ class Inline
$nextOffset += strspn($value, ' ', $nextOffset);
if ('' === $tag && (!isset($value[$nextOffset]) || \in_array($value[$nextOffset], [']', '}', ','], true))) {
throw new ParseException(sprintf('Using the unquoted scalar value "!" is not supported. You must quote it.', $value), self::$parsedLineNumber + 1, $value, self::$parsedFilename);
throw new ParseException('Using the unquoted scalar value "!" is not supported. You must quote it.', self::$parsedLineNumber + 1, $value, self::$parsedFilename);
}
// Is followed by a scalar and is a built-in tag

View File

@ -42,7 +42,10 @@ class ParentTestService
{
}
public function setContainer(ContainerInterface $container): ContainerInterface
/**
* @return ContainerInterface
*/
public function setContainer(ContainerInterface $container)
{
return $container;
}

View File

@ -83,6 +83,17 @@ class TranslatorTest extends TestCase
$this->assertEquals($expected, $translator->trans($id, ['%count%' => $number]));
}
/**
* @dataProvider getTransChoiceTests
*/
public function testTransChoiceWithEnUsPosix($expected, $id, $number)
{
$translator = $this->getTranslator();
$translator->setLocale('en_US_POSIX');
$this->assertEquals($expected, $translator->trans($id, ['%count%' => $number]));
}
public function testGetSetLocale()
{
$translator = $this->getTranslator();
@ -311,7 +322,7 @@ class TranslatorTest extends TestCase
{
return [
['1', ['ay', 'bo', 'cgg', 'dz', 'id', 'ja', 'jbo', 'ka', 'kk', 'km', 'ko', 'ky']],
['2', ['nl', 'fr', 'en', 'de', 'de_GE', 'hy', 'hy_AM']],
['2', ['nl', 'fr', 'en', 'de', 'de_GE', 'hy', 'hy_AM', 'en_US_POSIX']],
['3', ['be', 'bs', 'cs', 'hr']],
['4', ['cy', 'mt', 'sl']],
['6', ['ar']],

View File

@ -140,7 +140,7 @@ EOF;
{
$number = abs($number);
switch ('pt_BR' !== $locale && \strlen($locale) > 3 ? substr($locale, 0, strrpos($locale, '_')) : $locale) {
switch ('pt_BR' !== $locale && 'en_US_POSIX' !== $locale && \strlen($locale) > 3 ? substr($locale, 0, strrpos($locale, '_')) : $locale) {
case 'af':
case 'bn':
case 'bg':
@ -149,6 +149,7 @@ EOF;
case 'de':
case 'el':
case 'en':
case 'en_US_POSIX':
case 'eo':
case 'es':
case 'et':