- Updates Sending Queue Worker and Mailer task to allow dependency

injection via constructor
- Updates unit tests to use dependency injection instead of modifying
  object's internals
This commit is contained in:
Vlad
2016-09-19 21:00:47 -04:00
parent 379dfb5f6e
commit d5107be65e
4 changed files with 32 additions and 24 deletions

View File

@ -17,9 +17,9 @@ class SendingQueue {
public $newsletter_task;
public $timer;
function __construct($timer = false) {
$this->mailer_task = new MailerTask();
$this->newsletter_task = new NewsletterTask();
function __construct($timer = false, $mailer_task = false, $newsletter_task = false) {
$this->mailer_task = ($mailer_task) ? $mailer_task : new MailerTask();
$this->newsletter_task = ($newsletter_task) ? $newsletter_task : new NewsletterTask();
$this->timer = ($timer) ? $timer : microtime(true);
// abort if execution or sending limit are reached
CronHelper::enforceExecutionLimit($this->timer);