private MockObject&MailerInterface
$mailer;
protected function setUp(): void
{ $this->mailer =
$this->
createMock(MailerInterface::
class);
} public function testHandle() { $handler =
new MailerHandler($this->mailer,
(new Email())->
subject('Alert: %level_name% %message%'
));
$handler->
setFormatter(new LineFormatter());
$this->mailer
->
expects($this->
once()) ->
method('send'
) ->
with($this->
callback(fn (Email
$email) => 'Alert: WARNING message' ===
$email->
getSubject() && null ===
$email->
getHtmlBody())) ;
$handler->
handle($this->
getRecord(Logger::WARNING, 'message'
));
} public function testHandleBatch() { $handler =
new MailerHandler($this->mailer,
(new Email())->
subject('Alert: %level_name% %message%'
));