Skip to content

Instantly share code, notes, and snippets.

@styks1987
Last active December 28, 2015 21:10
Show Gist options
  • Save styks1987/32fac749e73aeaca6a91 to your computer and use it in GitHub Desktop.
Save styks1987/32fac749e73aeaca6a91 to your computer and use it in GitHub Desktop.
<?php
// In my test function
$this->Mailer->expects($this->once())
->method('onRegistration');
$this->Mailer->expects($this->once())
->method('welcome');
// ******************************
// The Mailer Functions
public function onRegistration(Event $event, Entity $entity, $options = [])
{
$var = '';
if ($entity->isNew()) {
$this->send('welcome', [$entity]);
$this->send('registration_alert', [$entity]);
}
}
public function welcome($user)
{
$this
->to('[email protected]')
->subject(sprintf('Welcome %s', $user->first_name));
$this->set('user', $user);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment