123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141 |
- <?php
- class Mail_mock extends Mail {
-
- public $sentMessages = array();
-
- protected $_preSendCallback;
-
- protected $_postSendCallback;
-
- public function __construct($params)
- {
- if (isset($params['preSendCallback']) &&
- is_callable($params['preSendCallback'])) {
- $this->_preSendCallback = $params['preSendCallback'];
- }
- if (isset($params['postSendCallback']) &&
- is_callable($params['postSendCallback'])) {
- $this->_postSendCallback = $params['postSendCallback'];
- }
- }
-
- public function send($recipients, $headers, $body)
- {
- if ($this->_preSendCallback) {
- call_user_func_array($this->_preSendCallback,
- array(&$this, $recipients, $headers, $body));
- }
- $entry = array('recipients' => $recipients, 'headers' => $headers, 'body' => $body);
- $this->sentMessages[] = $entry;
- if ($this->_postSendCallback) {
- call_user_func_array($this->_postSendCallback,
- array(&$this, $recipients, $headers, $body));
- }
- return true;
- }
- }
|