use Scheb\TwoFactorBundle\Model\Email\TwoFactorInterface;
use Scheb\TwoFactorBundle\Mailer\AuthCodeMailerInterface;
-use Symfony\Component\Translation\DataCollectorTranslator;
+use Symfony\Component\Translation\TranslatorInterface;
/**
* Custom mailer for TwoFactorBundle email.
/**
* Translator for email content.
*
- * @var DataCollectorTranslator
+ * @var TranslatorInterface
*/
private $translator;
/**
* Initialize the auth code mailer with the SwiftMailer object.
*
- * @param \Swift_Mailer $mailer
- * @param DataCollectorTranslator $translator
- * @param string $senderEmail
- * @param string $senderName
- * @param string $supportUrl
+ * @param \Swift_Mailer $mailer
+ * @param TranslatorInterface $translator
+ * @param string $senderEmail
+ * @param string $senderName
+ * @param string $supportUrl
*/
- public function __construct(\Swift_Mailer $mailer, DataCollectorTranslator $translator, $senderEmail, $senderName, $supportUrl)
+ public function __construct(\Swift_Mailer $mailer, TranslatorInterface $translator, $senderEmail, $senderName, $supportUrl)
{
$this->mailer = $mailer;
$this->translator = $translator;
use Wallabag\UserBundle\Mailer\AuthCodeMailer;
use Symfony\Component\Translation\Translator;
use Symfony\Component\Translation\Loader\ArrayLoader;
-use Symfony\Component\Translation\DataCollectorTranslator;
/**
* @see https://www.pmg.com/blog/integration-testing-swift-mailer/
{
protected $mailer;
protected $spool;
- protected $dataCollector;
+ protected $translator;
protected function setUp()
{
);
$this->mailer = new \Swift_Mailer($transport);
- $translator = new Translator('en');
- $translator->addLoader('array', new ArrayLoader());
- $translator->addResource('array', array(
+ $this->translator = new Translator('en');
+ $this->translator->addLoader('array', new ArrayLoader());
+ $this->translator->addResource('array', array(
'auth_code.mailer.subject' => 'auth_code subject',
'auth_code.mailer.body' => 'Hi %user%, here is the code: %code% and the support: %support%',
), 'en', 'wallabag_user');
-
- $this->dataCollector = new DataCollectorTranslator($translator);
}
public function testSendEmail()
$authCodeMailer = new AuthCodeMailer(
$this->mailer,
- $this->dataCollector,
+ $this->translator,
'nobody@test.io',
'wallabag test',
'http://0.0.0.0'