Skip to content

Commit e1db1d9

Browse files
Merge branch '4.3' into 4.4
* 4.3: Add missed use class for Symfony\Bundle\FrameworkBundle\Test\WebTestCase::$client [HttpClient] Minor fix in an error message Fix parameter documentation for Inflector::pluralize() method Use a more appropriate group when deprecating mode bumped Symfony version to 4.3.1 updated VERSION for 4.3.0 updated CHANGELOG for 4.3.0 [FrameworkBundle] fix test fixture using deprecated controller and add missing deprecation [FrameworkBundle] Add a validation on the messenger section
2 parents 5e1d3dd + a0e9fad commit e1db1d9

File tree

6 files changed

+40
-6
lines changed

6 files changed

+40
-6
lines changed

DependencyInjection/Configuration.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1110,6 +1110,10 @@ private function addMessengerSection(ArrayNodeDefinition $rootNode)
11101110
->{!class_exists(FullStack::class) && interface_exists(MessageBusInterface::class) ? 'canBeDisabled' : 'canBeEnabled'}()
11111111
->fixXmlConfig('transport')
11121112
->fixXmlConfig('bus', 'buses')
1113+
->validate()
1114+
->ifTrue(function ($v) { return isset($v['buses']) && \count($v['buses']) > 1 && null === $v['default_bus']; })
1115+
->thenInvalid('You must specify the "default_bus" if you define more than one bus.')
1116+
->end()
11131117
->children()
11141118
->arrayNode('routing')
11151119
->useAttributeAsKey('message_class')

EventListener/ResolveControllerNameSubscriber.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ public function onKernelRequest(GetResponseEvent $event)
3737
$controller = $event->getRequest()->attributes->get('_controller');
3838
if (\is_string($controller) && false === strpos($controller, '::') && 2 === substr_count($controller, ':')) {
3939
// controller in the a:b:c notation then
40-
$event->getRequest()->attributes->set('_controller', $this->parser->parse($controller, false));
40+
$event->getRequest()->attributes->set('_controller', $parsedNotation = $this->parser->parse($controller, false));
41+
42+
@trigger_error(sprintf('Referencing controllers with %s is deprecated since Symfony 4.1, use "%s" instead.', $controller, $parsedNotation), E_USER_DEPRECATED);
4143
}
4244
}
4345

Test/WebTestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ abstract class WebTestCase extends KernelTestCase
2323
{
2424
use WebTestAssertionsTrait;
2525

26-
/** @var Client|null */
26+
/** @var KernelBrowser|null */
2727
protected static $client;
2828

2929
protected function doTearDown(): void

Tests/DependencyInjection/ConfigurationTest.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,31 @@ public function provideInvalidAssetConfigurationTests()
188188
yield [$createPackageConfig($config), 'You cannot use both "version" and "json_manifest_path" at the same time under "assets" packages.'];
189189
}
190190

191+
public function testItShowANiceMessageIfTwoMessengerBusesAreConfiguredButNoDefaultBus()
192+
{
193+
$expectedMessage = 'You must specify the "default_bus" if you define more than one bus.';
194+
if (method_exists($this, 'expectException')) {
195+
$this->expectException(InvalidConfigurationException::class);
196+
$this->expectExceptionMessage($expectedMessage);
197+
} else {
198+
$this->setExpectedException(InvalidConfigurationException::class, $expectedMessage);
199+
}
200+
$processor = new Processor();
201+
$configuration = new Configuration(true);
202+
203+
$processor->processConfiguration($configuration, [
204+
'framework' => [
205+
'messenger' => [
206+
'default_bus' => null,
207+
'buses' => [
208+
'first_bus' => [],
209+
'second_bus' => [],
210+
],
211+
],
212+
],
213+
]);
214+
}
215+
191216
protected static function getBundleDefaultConfig()
192217
{
193218
return [

Tests/EventListener/ResolveControllerNameSubscriberTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020

2121
class ResolveControllerNameSubscriberTest extends TestCase
2222
{
23+
/**
24+
* @group legacy
25+
*/
2326
public function testReplacesControllerAttribute()
2427
{
2528
$parser = $this->getMockBuilder(ControllerNameParser::class)->disableOriginalConstructor()->getMock();
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
{{ render(controller('TestBundle:Fragment:inlined', {'options': {'bar': bar, 'eleven': 11}})) }}
1+
{{ render(controller('Symfony\\Bundle\\FrameworkBundle\\Tests\\Functional\\Bundle\\TestBundle\\Controller\\FragmentController::inlinedAction', {'options': {'bar': bar, 'eleven': 11}})) }}
22
--
3-
{{ render(controller('TestBundle:Fragment:customformat', {'_format': 'html'})) }}
3+
{{ render(controller('Symfony\\Bundle\\FrameworkBundle\\Tests\\Functional\\Bundle\\TestBundle\\Controller\\FragmentController::customformatAction', {'_format': 'html'})) }}
44
--
5-
{{ render(controller('TestBundle:Fragment:customlocale', {'_locale': 'es'})) }}
5+
{{ render(controller('Symfony\\Bundle\\FrameworkBundle\\Tests\\Functional\\Bundle\\TestBundle\\Controller\\FragmentController::customlocaleAction', {'_locale': 'es'})) }}
66
--
7-
{{ app.request.setLocale('fr') }}{{ render(controller('TestBundle:Fragment:forwardlocale')) -}}
7+
{{ app.request.setLocale('fr') }}{{ render(controller('Symfony\\Bundle\\FrameworkBundle\\Tests\\Functional\\Bundle\\TestBundle\\Controller\\FragmentController::forwardlocaleAction')) -}}

0 commit comments

Comments
 (0)