mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-15 00:27:30 +00:00
Improve test coverage.
This commit is contained in:
@@ -467,4 +467,14 @@ class ImportJobRepository implements ImportJobRepositoryInterface
|
||||
|
||||
return $size > $this->maxUploadSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ImportJob $job
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function countByTag(ImportJob $job): int
|
||||
{
|
||||
return $job->tag->transactionJournals->count();
|
||||
}
|
||||
}
|
||||
|
@@ -62,6 +62,13 @@ interface ImportJobRepositoryInterface
|
||||
*/
|
||||
public function countTransactions(ImportJob $job): int;
|
||||
|
||||
/**
|
||||
* @param ImportJob $job
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function countByTag(ImportJob $job): int;
|
||||
|
||||
/**
|
||||
* @param string $importProvider
|
||||
*
|
||||
|
@@ -28,6 +28,7 @@ use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Factory\RecurrenceFactory;
|
||||
use FireflyIII\Helpers\Collector\GroupCollectorInterface;
|
||||
use FireflyIII\Models\Note;
|
||||
use FireflyIII\Models\PiggyBank;
|
||||
use FireflyIII\Models\Preference;
|
||||
use FireflyIII\Models\Recurrence;
|
||||
use FireflyIII\Models\RecurrenceMeta;
|
||||
@@ -208,6 +209,24 @@ class RecurringRepository implements RecurringRepositoryInterface
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Recurrence $recurrence
|
||||
* @return PiggyBank|null
|
||||
*/
|
||||
public function getPiggyBank(Recurrence $recurrence): ?PiggyBank
|
||||
{
|
||||
$meta = $recurrence->recurrenceMeta;
|
||||
/** @var RecurrenceMeta $metaEntry */
|
||||
foreach ($meta as $metaEntry) {
|
||||
if ('piggy_bank_id' === $metaEntry->name) {
|
||||
$piggyId = (int)$metaEntry->value;
|
||||
return $this->user->piggyBanks()->where('id', $piggyId)->first(['piggy_banks.*']);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate events in the date range.
|
||||
*
|
||||
|
@@ -25,6 +25,7 @@ namespace FireflyIII\Repositories\Recurring;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Models\PiggyBank;
|
||||
use FireflyIII\Models\Recurrence;
|
||||
use FireflyIII\Models\RecurrenceRepetition;
|
||||
use FireflyIII\Models\RecurrenceTransaction;
|
||||
@@ -114,12 +115,16 @@ interface RecurringRepositoryInterface
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @throws FireflyException
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getOccurrencesInRange(RecurrenceRepetition $repetition, Carbon $start, Carbon $end): array;
|
||||
|
||||
/**
|
||||
* @param Recurrence $recurrence
|
||||
* @return PiggyBank|null
|
||||
*/
|
||||
public function getPiggyBank(Recurrence $recurrence): ?PiggyBank;
|
||||
|
||||
/**
|
||||
* Get the tags from the recurring transaction.
|
||||
*
|
||||
|
@@ -288,8 +288,6 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface
|
||||
* @param array $data
|
||||
*
|
||||
* @return TransactionGroup
|
||||
*
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function store(array $data): TransactionGroup
|
||||
{
|
||||
|
@@ -112,7 +112,6 @@ interface TransactionGroupRepositoryInterface
|
||||
* @param array $data
|
||||
*
|
||||
* @return TransactionGroup
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function store(array $data): TransactionGroup;
|
||||
|
||||
|
Reference in New Issue
Block a user