/**
  * A basic test example.
  *
  * @return void
  */
 public function test_read_configuration_for_reminder_days()
 {
     // emulate config set
     $expected = [3, 7, 15];
     $expectedStr = implode(',', $expected);
     \Config::set('custom.remindOnDays', $expectedStr);
     // get config values
     $reminderCalculator = new LicenceReminderCalculator();
     $remindOnDays = $reminderCalculator->getReminderDays();
     // assert
     //
     // Expected to remind for Licence expiration
     // 3, 7, 15 days before expiration day.
     $this->assertEquals($expected, $remindOnDays);
 }
 public function addSendReminderEmail(Company $company, LicenceReminderCalculator $reminderCalculator)
 {
     if (!isset($company->licence_expire_at)) {
         throw new \Exception("Licence Expiration Date must be set first!");
     }
     // get config values in days
     $remindOnDays = $reminderCalculator->getReminderDays();
     // dates when to send reminders
     $runAts = $reminderCalculator->getReminderDates($company->licence_expire_at, $remindOnDays);
     // save reminders in queue
     $action = ActionCommandSendReminderEmailCommand::class;
     $schedules = [];
     foreach ($runAts as $runAt) {
         $schedules[$runAt] = $this->add($runAt, $action, $company, []);
     }
     return $schedules;
 }