diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php index 93d5de007ef9b..4b727083aefcd 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php @@ -389,7 +389,7 @@ public function load(array $configs, ContainerBuilder $container) if ($this->readConfigEnabled('mailer', $container, $config['mailer'])) { $this->registerMailerConfiguration($config['mailer'], $container, $loader); - if (!class_exists(MailerTestCommand::class)) { + if (!class_exists(MailerTestCommand::class) || !$this->hasConsole()) { $container->removeDefinition('console.command.mailer_test'); } }