Skip to content

Commit 3dd6c67

Browse files
committedJan 31, 2020
Merge branch '4.4' into 5.0
* 4.4: [Validator] fix access to uninitialized property when getting value [HttpClient] Fix regex bearer [Translator] Default value for 'sort' option in translation:update should be 'asc' [HttpKernel] Fix stale-if-error behavior, add tests [Intl] Provide more locale translations [Mailer] Fix STARTTLS support for Postmark and Mandrill [Messenger] Check for all serialization exceptions during message dec… [Messenger] Fix bug when using single route with XML config Fix exception message in Doctrine Messenger [DI] CheckTypeDeclarationsPass now checks if value is type of parameter type [SecurityBundle] fix security.authentication.provider.ldap_bind arguments Improved error message when no supported user provider is found Mysqli doesn't support the named parameters used by PdoAdapter Added debug argument to decide if debug page should be shown or not Mysqli doesn't support the named parameters used by PdoStore Properly handle phpunit arguments for configuration file [Mailer] add tests for http transports
2 parents 2e4d31d + afc96da commit 3dd6c67

File tree

7 files changed

+57
-1
lines changed

7 files changed

+57
-1
lines changed
 

Diff for: ‎Command/TranslationUpdateCommand.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ protected function configure()
8383
new InputOption('clean', null, InputOption::VALUE_NONE, 'Should clean not found messages'),
8484
new InputOption('domain', null, InputOption::VALUE_OPTIONAL, 'Specify the domain to update'),
8585
new InputOption('xliff-version', null, InputOption::VALUE_OPTIONAL, 'Override the default xliff version', '1.2'),
86-
new InputOption('sort', null, InputOption::VALUE_OPTIONAL, 'Return list of messages sorted alphabetically'),
86+
new InputOption('sort', null, InputOption::VALUE_OPTIONAL, 'Return list of messages sorted alphabetically', 'asc'),
8787
])
8888
->setDescription('Updates the translation file')
8989
->setHelp(<<<'EOF'

Diff for: ‎DependencyInjection/Configuration.php

+4
Original file line numberDiff line numberDiff line change
@@ -1056,6 +1056,10 @@ private function addMessengerSection(ArrayNodeDefinition $rootNode)
10561056
if (!\is_array($config)) {
10571057
return [];
10581058
}
1059+
// If XML config with only one routing attribute
1060+
if (2 === \count($config) && isset($config['message-class']) && isset($config['sender'])) {
1061+
$config = [0 => $config];
1062+
}
10591063

10601064
$newConfig = [];
10611065
foreach ($config as $k => $v) {

Diff for: ‎Tests/Command/TranslationUpdateCommandTest.php

+8
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,14 @@ public function testDumpReverseSortedMessagesAndClean()
4848
$this->assertRegExp('/3 messages were successfully extracted/', $tester->getDisplay());
4949
}
5050

51+
public function testDumpSortWithoutValueAndClean()
52+
{
53+
$tester = $this->createCommandTester(['messages' => ['foo' => 'foo', 'test' => 'test', 'bar' => 'bar']]);
54+
$tester->execute(['command' => 'translation:update', 'locale' => 'en', 'bundle' => 'foo', '--dump-messages' => true, '--clean' => true, '--sort']);
55+
$this->assertRegExp("/\*bar\*foo\*test/", preg_replace('/\s+/', '', $tester->getDisplay()));
56+
$this->assertRegExp('/3 messages were successfully extracted/', $tester->getDisplay());
57+
}
58+
5159
public function testDumpWrongSortAndClean()
5260
{
5361
$tester = $this->createCommandTester(['messages' => ['foo' => 'foo', 'test' => 'test', 'bar' => 'bar']]);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
3+
$container->loadFromExtension('framework', [
4+
'messenger' => [
5+
'routing' => [
6+
'Symfony\Bundle\FrameworkBundle\Tests\Fixtures\Messenger\DummyMessage' => ['amqp'],
7+
],
8+
'transports' => [
9+
'amqp' => 'amqp://localhost/%2f/messages',
10+
],
11+
],
12+
]);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<container xmlns="http://symfony.com/schema/dic/services"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xmlns:framework="http://symfony.com/schema/dic/symfony"
5+
xsi:schemaLocation="http://symfony.com/schema/dic/services https://symfony.com/schema/dic/services/services-1.0.xsd
6+
http://symfony.com/schema/dic/symfony https://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
7+
8+
<framework:config>
9+
<framework:messenger>
10+
<framework:routing message-class="Symfony\Bundle\FrameworkBundle\Tests\Fixtures\Messenger\DummyMessage">
11+
<framework:sender service="amqp" />
12+
</framework:routing>
13+
<framework:transport name="amqp" dsn="amqp://localhost/%2f/messages" />
14+
</framework:messenger>
15+
</framework:config>
16+
</container>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
framework:
2+
messenger:
3+
routing:
4+
'Symfony\Bundle\FrameworkBundle\Tests\Fixtures\Messenger\DummyMessage': [amqp]
5+
6+
transports:
7+
amqp: 'amqp://localhost/%2f/messages'

Diff for: ‎Tests/DependencyInjection/FrameworkExtensionTest.php

+9
Original file line numberDiff line numberDiff line change
@@ -642,6 +642,15 @@ public function testMessengerRouting()
642642
$this->assertEquals(new Reference('messenger.transport.audit'), $sendersLocator->getArgument(0)['messenger.transport.audit']->getValues()[0]);
643643
}
644644

645+
public function testMessengerRoutingSingle()
646+
{
647+
$container = $this->createContainerFromFile('messenger_routing_single');
648+
$senderLocatorDefinition = $container->getDefinition('messenger.senders_locator');
649+
650+
$sendersMapping = $senderLocatorDefinition->getArgument(0);
651+
$this->assertEquals(['amqp'], $sendersMapping[DummyMessage::class]);
652+
}
653+
645654
public function testMessengerTransportConfiguration()
646655
{
647656
$container = $this->createContainerFromFile('messenger_transport');

0 commit comments

Comments
 (0)
Please sign in to comment.