Refactor rule processor so it's testable.

This commit is contained in:
James Cole
2018-08-24 17:57:34 +02:00
parent 850a0ae17e
commit 835a421909
10 changed files with 202 additions and 122 deletions

View File

@@ -157,7 +157,9 @@ class CreateRecurringTransactions implements ShouldQueue
$this->rules[$userId]->each(
function (Rule $rule) use ($journal) {
Log::debug(sprintf('Going to apply rule #%d to journal %d.', $rule->id, $journal->id));
$processor = Processor::make($rule);
/** @var Processor $processor */
$processor = app(Processor::class);
$processor->make($rule);
/** @noinspection ExceptionsAnnotatingAndHandlingInspection */
$processor->handleTransactionJournal($journal);
if ($rule->stop_processing) {