8000 bug #37729 [FrameworkBundle] fail properly when the required service … · symfony/symfony@d81eb08 · GitHub
[go: up one dir, main page]

Skip to content

Commit d81eb08

Browse files
committed
bug #37729 [FrameworkBundle] fail properly when the required service is not defined (xabbuh)
This PR was merged into the 4.4 branch. Discussion ---------- [FrameworkBundle] fail properly when the required service is not defined | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | | License | MIT | Doc PR | Before: ``` Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: You have requested a non-existent service "mailer.logger_message_listener". ``` After: ``` A client must have Mailer enabled to make email assertions. Did you forget to require symfony/mailer? ``` Commits ------- a16ebc1 fail properly when the required service is not defined
2 parents 909158b + a16ebc1 commit d81eb08

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Symfony/Bundle/FrameworkBundle/Test/MailerAssertionsTrait.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,10 @@ private static function getMessageMailerEvents(): MessageEvents
122122
static::fail('Unable to make email assertions. Did you forget to make an HTTP request?');
123123
}
124124

125-
if (!$logger = self::$container->get('mailer.logger_message_listener')) {
125+
if (!self::$container->has('mailer.logger_message_listener')) {
126126
static::fail('A client must have Mailer enabled to make email assertions. Did you forget to require symfony/mailer?');
127127
}
128128

129-
return $logger->getEvents();
129+
return self::$container->get('mailer.logger_message_listener')->getEvents();
130130
}
131131
}

0 commit comments

Comments
 (0)
0