Fix final tests

This commit is contained in:
James Cole
2018-09-01 20:45:05 +02:00
parent 1e4f4907e3
commit 02370fb65d
2 changed files with 79 additions and 25 deletions

View File

@@ -48,35 +48,18 @@ class TransactionMatcher
private $range = 200;
/** @var Rule The rule to apply */
private $rule;
/** @var bool */
private $strict;
/** @var array Types that can be matched using this matcher */
private $transactionTypes = [TransactionType::DEPOSIT, TransactionType::WITHDRAWAL, TransactionType::TRANSFER];
/** @var array List of triggers to match */
private $triggers = [];
/** @var bool */
private $strict;
public function __construct()
{
$this->strict = false;
}
/**
* @return bool
*/
public function isStrict(): bool
{
return $this->strict;
}
/**
* @param bool $strict
*/
public function setStrict(bool $strict): void
{
$this->strict = $strict;
}
/**
* This method will search the user's transaction journal (with an upper limit of $range) for
* transaction journals matching the given rule. This is accomplished by trying to fire these
@@ -92,8 +75,10 @@ class TransactionMatcher
}
// Variables used within the loop
$processor = Processor::make($this->rule, false);
$result = $this->runProcessor($processor);
/** @var Processor $processor */
$processor = app(Processor::class);
$processor->make($this->rule, false);
$result = $this->runProcessor($processor);
// If the list of matchingTransactions is larger than the maximum number of results
// (e.g. if a large percentage of the transactions match), truncate the list
@@ -202,6 +187,22 @@ class TransactionMatcher
return $this;
}
/**
* @return bool
*/
public function isStrict(): bool
{
return $this->strict;
}
/**
* @param bool $strict
*/
public function setStrict(bool $strict): void
{
$this->strict = $strict;
}
/**
* Set rule
*