Skip to content

Instantly share code, notes, and snippets.

View danielpotthast's full-sized avatar

Daniel Potthast danielpotthast

View GitHub Profile
swiftmailer:
transport: gmail
username: me@gmail.com
password: myGmailPassword
swiftmailer:
delivery_address: me@example.com
swiftmailer:
disable_delivery: true
$newsletterManager = $this->get('newsletter_manager');
$newsletterManager->send($recipients, $message);
<?php
class Newsletter
{
private $mailer;
public function __construct()
{
$this->mailer = new Mailer('news@demo.de','Demo News','Reply-To: reply@demo.de');
}
<?php
namespace Demo;
class NewsletterManager
{
private $mailer;
public function setMailer(MailerInterface $mailer)
{
<?php
namespace Tests\Demo;
use Demo\MailerInterface;
use Demo\Message;
use Demo\NewsletterManager;
class NewsletterManagerTest extends \PHPUnit_Framework_TestCase
{
parameters:
mailer.transport: sendmail
services:
mailer: sendmail
class: Mailer
arguments: ['%mailer.transport%']
newsletter_manager:
class: NewsletterManager
calls:
- [setMailer‚ ['@mailer']]
<?php
class Newsletter
{
private $mailer;
public function __construct()
{
$this->mailer = new Mailer('news@demo.de','Demo News','Reply-To: reply@demo.de');
}