public function testSend()
 {
     Email::configTransport('default', ['className' => 'Debug']);
     Email::config('default', ['from' => '*****@*****.**', 'transport' => 'default']);
     Configure::write('App.encoding', 'UTF-8');
     $notification = new Notification();
     $notification->to('*****@*****.**', 'email');
     $emailTransport = new EmailTransport();
     $this->assertInternalType('array', $emailTransport->send($notification));
 }
 /**
  * Sends notification.
  *
  * @param string $action The name of the notifier action to trigger.
  * @param array $args Arguments to pass to the triggered notifier action.
  * @return array
  * @throws \CvoTechnologies\Notifier\Exception\MissingActionException
  * @throws \BadMethodCallException
  */
 public function send($action, $args = [])
 {
     if (!method_exists($this, $action)) {
         throw new MissingActionException(['notifier' => $this->getName() . 'Notifier', 'action' => $action]);
     }
     if (!$this->_notification->viewBuilder()->template()) {
         $this->_notification->viewBuilder()->template($action);
     }
     call_user_func_array([$this, $action], $args);
     $result = $this->_notification->send();
     $this->reset();
     return $result;
 }
<?php

use Cake\Core\Configure;
use CvoTechnologies\Notifier\Notification;
Notification::configTransport(Configure::consume('NotificationTransport'));
Notification::config(Configure::consume('Notification'));
 /**
  * Test that using an invalid profile fails.
  *
  * @expectedException \InvalidArgumentException
  * @expectedExceptionMessage Unknown notification configuration "derp".
  */
 public function testProfileInvalid()
 {
     $email = new Notification();
     $email->profile('derp');
 }
 /**
  * Send notification
  *
  * @param \CvoTechnologies\Notifier\Notification $notification Notification instance.
  * @return array
  */
 public function send(Notification $notification)
 {
     $email = new Email();
     $email->profile($this->config('profile'));
     $email->to($notification->to(null, static::TYPE));
     $email->subject($notification->title());
     $email->viewBuilder()->templatePath($notification->viewBuilder()->templatePath());
     $email->viewBuilder()->template($notification->viewBuilder()->template());
     $email->viewBuilder()->plugin($notification->viewBuilder()->plugin());
     $email->viewBuilder()->theme($notification->viewBuilder()->theme());
     $email->viewBuilder()->layout($notification->viewBuilder()->layout());
     $email->viewBuilder()->autoLayout($notification->viewBuilder()->autoLayout());
     $email->viewBuilder()->layoutPath($notification->viewBuilder()->layoutPath());
     $email->viewBuilder()->name($notification->viewBuilder()->name());
     $email->viewBuilder()->className($notification->viewBuilder()->className());
     $email->viewBuilder()->options($notification->viewBuilder()->options());
     $email->viewBuilder()->helpers($notification->viewBuilder()->helpers());
     $email->viewVars($notification->viewVars());
     return $email->send();
 }