Skip to content

Instantly share code, notes, and snippets.

Avatar

Daniel Potthast danielpotthast

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