Cleanup expected and unexpected bugs in the factories.

This commit is contained in:
James Cole
2019-06-16 13:15:32 +02:00
parent 4a1e56671b
commit 23d7abd55f
16 changed files with 173 additions and 160 deletions

View File

@@ -39,6 +39,7 @@ class PiggyBankEventFactory
{
/**
* Constructor.
* @codeCoverageIgnore
*/
public function __construct()
{
@@ -58,10 +59,11 @@ class PiggyBankEventFactory
{
Log::debug(sprintf('Now in PiggyBankEventCreate for a %s', $journal->transactionType->type));
if (null === $piggyBank) {
Log::debug('Piggy bank is null');
return null;
}
if (!(TransactionType::TRANSFER === $journal->transactionType->type)) {
if (TransactionType::TRANSFER !== $journal->transactionType->type) {
Log::info(sprintf('Will not connect %s #%d to a piggy bank.', $journal->transactionType->type, $journal->id));
return null;
@@ -77,7 +79,7 @@ class PiggyBankEventFactory
return null;
}
Log::debug('Found repetition');
$amount = $piggyRepos->getExactAmount($piggyBank, $repetition, $journal);
if (0 === bccomp($amount, '0')) {
Log::debug('Amount is zero, will not create event.');