],
$stream->
getCommands() );
} public function testSetAuthenticators() { $stream =
new DummyStream();
$transport =
new EsmtpTransport(stream:
$stream);
$transport->
setUsername('testuser'
);
$transport->
setPassword('p4ssw0rd'
);
$transport->
setAuthenticators([new XOAuth2Authenticator()]);
$message =
new Email();
$message->
from('sender@example.org'
);
$message->
addTo('recipient@example.org'
);
$message->
text('.'
);
try { $transport->
send($message);
$this->
fail('Symfony\Component\Mailer\Exception\TransportException to be thrown'
);
} catch (TransportException
$e) { $this->
assertStringStartsWith('Failed to authenticate on SMTP server with username "testuser" using the following authenticators: "XOAUTH2".',
$e->
getMessage());
}