Merge branch '4.3' into 4.4

* 4.3:
  added missing test
  [Mailer] Allow register mailer configuration in xml format
  fixed CS
  [FrameworkBundle] Fix descriptor of routes described as callable array
  [Debug][DebugClassLoader] Include found files instead of requiring them
  [HttpKernel] fix tests
  Adding missing event_dispatcher wiring for messenger.middleware.send_message
This commit is contained in:
Fabien Potencier 2019-07-16 08:12:37 +02:00
commit 52e9fb91ff
8 changed files with 40 additions and 4 deletions

View File

@ -540,7 +540,7 @@ class TextDescriptor extends Descriptor
try {
if (\is_array($controller)) {
$r = new \ReflectionMethod($controller);
$r = new \ReflectionMethod($controller[0], $controller[1]);
} elseif ($controller instanceof \Closure) {
$r = new \ReflectionFunction($controller);
} elseif (method_exists($controller, '__invoke')) {

View File

@ -15,6 +15,7 @@
<service id="messenger.middleware.send_message" class="Symfony\Component\Messenger\Middleware\SendMessageMiddleware">
<tag name="monolog.logger" channel="messenger" />
<argument type="service" id="messenger.senders_locator" />
<argument type="service" id="event_dispatcher" />
<call method="setLogger">
<argument type="service" id="logger" on-invalid="ignore" />
</call>

View File

@ -33,6 +33,7 @@
<xsd:element name="lock" type="lock" minOccurs="0" maxOccurs="1" />
<xsd:element name="messenger" type="messenger" minOccurs="0" maxOccurs="1" />
<xsd:element name="http-client" type="http_client" minOccurs="0" maxOccurs="1" />
<xsd:element name="mailer" type="mailer" minOccurs="0" maxOccurs="1" />
</xsd:choice>
<xsd:attribute name="http-method-override" type="xsd:boolean" />
@ -552,4 +553,8 @@
<xsd:complexType name="http_header" mixed="true">
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
<xsd:complexType name="mailer">
<xsd:attribute name="dsn" type="xsd:string" />
</xsd:complexType>
</xsd:schema>

View File

@ -0,0 +1,7 @@
<?php
$container->loadFromExtension('framework', [
'mailer' => [
'dsn' => 'smtp://example.com',
],
]);

View File

@ -0,0 +1,12 @@
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:framework="http://symfony.com/schema/dic/symfony"
xsi:schemaLocation="http://symfony.com/schema/dic/services https://symfony.com/schema/dic/services/services-1.0.xsd
http://symfony.com/schema/dic/symfony https://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
<framework:config>
<framework:mailer dsn="smtp://example.com" />
</framework:config>
</container>

View File

@ -0,0 +1,3 @@
framework:
mailer:
dsn: 'smtp://example.com'

View File

@ -57,7 +57,6 @@ use Symfony\Component\Translation\TranslatorInterface;
use Symfony\Component\Validator\DependencyInjection\AddConstraintValidatorsPass;
use Symfony\Component\Validator\Mapping\Loader\PropertyInfoLoader;
use Symfony\Component\Validator\Util\LegacyTranslatorProxy;
use Symfony\Component\Validator\Validation;
use Symfony\Component\Workflow;
abstract class FrameworkExtensionTest extends TestCase
@ -1582,6 +1581,15 @@ abstract class FrameworkExtensionTest extends TestCase
], $defaultOptions['peer_fingerprint']);
}
public function testMailer(): void
{
$container = $this->createContainerFromFile('mailer');
$this->assertTrue($container->hasAlias('mailer'));
$this->assertTrue($container->hasDefinition('mailer.default_transport'));
$this->assertSame('smtp://example.com', $container->getDefinition('mailer.default_transport')->getArgument(0));
}
protected function createContainer(array $data = [])
{
return new ContainerBuilder(new ParameterBag(array_merge([

View File

@ -153,11 +153,11 @@ class DebugClassLoader
if (!$file = $this->classLoader[0]->findFile($class) ?: false) {
// no-op
} elseif (\function_exists('opcache_is_script_cached') && @opcache_is_script_cached($file)) {
require $file;
include $file;
return;
} else {
require $file;
include $file;
}
} else {
($this->classLoader)($class);