Improve test coverage.

This commit is contained in:
James Cole
2019-08-03 10:50:43 +02:00
parent b8b59b13a7
commit 75c2529d3e
23 changed files with 367 additions and 539 deletions

View File

@@ -431,31 +431,6 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface
return $savePerMonth;
}
/**
* @param PiggyBankEvent $event
*
* @return int|null
*/
public function getTransactionWithEvent(PiggyBankEvent $event): ?int
{
$journal = $event->transactionJournal;
if (null === $journal) {
return null;
}
if ((float)$event->amount < 0) {
$transaction = $journal->transactions()->where('amount', '<', 0)->first();
return $transaction->id ?? null;
}
if ((float)$event->amount > 0) {
$transaction = $journal->transactions()->where('amount', '>', 0)->first();
return $transaction->id ?? null;
}
return null;
}
/**
* Get for piggy account what is left to put in piggies.
*