mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Expand test coverage.
This commit is contained in:
@@ -51,6 +51,7 @@ class UpdatedJournalEventHandler
|
||||
|
||||
/**
|
||||
* This method will check all the rules when a journal is updated.
|
||||
* TODO move to factory.
|
||||
*
|
||||
* @param UpdatedTransactionJournal $updatedJournalEvent
|
||||
*
|
||||
@@ -81,6 +82,7 @@ class UpdatedJournalEventHandler
|
||||
|
||||
/**
|
||||
* This method calls a special bill scanner that will check if the updated journal is part of a bill.
|
||||
* TODO move to factory.
|
||||
*
|
||||
* @param UpdatedTransactionJournal $updatedJournalEvent
|
||||
*
|
||||
|
@@ -276,11 +276,13 @@ class MetaPieChart implements MetaPieChartInterface
|
||||
$collector->setBudgets($this->budgets);
|
||||
$collector->setCategories($this->categories);
|
||||
|
||||
// @codeCoverageIgnoreStart
|
||||
if ($this->tags->count() > 0) {
|
||||
$collector->setTags($this->tags);
|
||||
$collector->withCategoryInformation();
|
||||
$collector->withBudgetInformation();
|
||||
}
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
||||
return $collector->getJournals();
|
||||
}
|
||||
@@ -297,7 +299,7 @@ class MetaPieChart implements MetaPieChartInterface
|
||||
{
|
||||
if (0 === count($fields) && $this->tags->count() > 0) {
|
||||
// do a special group on tags:
|
||||
return $this->groupByTag($set);
|
||||
return $this->groupByTag($set); // @codeCoverageIgnore
|
||||
}
|
||||
|
||||
$grouped = [];
|
||||
@@ -341,6 +343,8 @@ class MetaPieChart implements MetaPieChartInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @param Collection $set
|
||||
*
|
||||
* @return array
|
||||
|
@@ -297,7 +297,7 @@ class AccountController extends Controller
|
||||
$end = app('navigation')->endOfPeriod($start, $range);
|
||||
}
|
||||
if ($end < $start) {
|
||||
throw new FireflyException('End is after start!');
|
||||
throw new FireflyException('End is after start!'); // @codeCoverageIgnore
|
||||
}
|
||||
|
||||
$subTitleIcon = config('firefly.subIconsByIdentifier.' . $account->accountType->type);
|
||||
@@ -417,7 +417,7 @@ class AccountController extends Controller
|
||||
$start = $this->repository->oldestJournalDate($account);
|
||||
$end = $date ?? new Carbon;
|
||||
if ($end < $start) {
|
||||
list($start, $end) = [$end, $start];
|
||||
list($start, $end) = [$end, $start]; // @codeCoverageIgnore
|
||||
}
|
||||
|
||||
// properties for cache
|
||||
|
@@ -328,28 +328,4 @@ class BillController extends Controller
|
||||
|
||||
return redirect($this->getPreviousUri('bills.edit.uri'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the latest date in the set, or start when set is empty.
|
||||
*
|
||||
* @param Collection $dates
|
||||
* @param Carbon $default
|
||||
*
|
||||
* @return Carbon
|
||||
*/
|
||||
private function lastPaidDate(Collection $dates, Carbon $default): Carbon
|
||||
{
|
||||
if (0 === $dates->count()) {
|
||||
return $default; // @codeCoverageIgnore
|
||||
}
|
||||
$latest = $dates->first();
|
||||
/** @var Carbon $date */
|
||||
foreach ($dates as $date) {
|
||||
if ($date->gte($latest)) {
|
||||
$latest = $date;
|
||||
}
|
||||
}
|
||||
|
||||
return $latest;
|
||||
}
|
||||
}
|
||||
|
@@ -316,7 +316,7 @@ class AccountController extends Controller
|
||||
$step = '1D';
|
||||
$months = $start->diffInMonths($end);
|
||||
if ($months > 3) {
|
||||
$step = '1W';
|
||||
$step = '1W'; // @codeCoverageIgnore
|
||||
}
|
||||
if ($months > 24) {
|
||||
$step = '1M'; // @codeCoverageIgnore
|
||||
@@ -340,9 +340,10 @@ class AccountController extends Controller
|
||||
$current->addDay();
|
||||
}
|
||||
break;
|
||||
// @codeCoverageIgnoreStart
|
||||
case '1W':
|
||||
case '1M': // @codeCoverageIgnore
|
||||
case '1Y': // @codeCoverageIgnore
|
||||
case '1M':
|
||||
case '1Y':
|
||||
while ($end >= $current) {
|
||||
$balance = floatval(app('steam')->balance($account, $current));
|
||||
$label = app('navigation')->periodShow($current, $step);
|
||||
@@ -350,6 +351,7 @@ class AccountController extends Controller
|
||||
$current = app('navigation')->addPeriod($current, $step, 1);
|
||||
}
|
||||
break;
|
||||
// @codeCoverageIgnoreEnd
|
||||
}
|
||||
$data = $this->generator->singleSet($account->name, $chartData);
|
||||
$cache->store($data);
|
||||
|
@@ -95,7 +95,7 @@ class SplitController extends Controller
|
||||
public function edit(Request $request, TransactionJournal $journal)
|
||||
{
|
||||
if ($this->isOpeningBalance($journal)) {
|
||||
return $this->redirectToAccount($journal);
|
||||
return $this->redirectToAccount($journal); // @codeCoverageIgnore
|
||||
}
|
||||
|
||||
$uploadSize = min(Steam::phpBytes(ini_get('upload_max_filesize')), Steam::phpBytes(ini_get('post_max_size')));
|
||||
@@ -140,7 +140,7 @@ class SplitController extends Controller
|
||||
public function update(SplitJournalFormRequest $request, TransactionJournal $journal)
|
||||
{
|
||||
if ($this->isOpeningBalance($journal)) {
|
||||
return $this->redirectToAccount($journal);
|
||||
return $this->redirectToAccount($journal); // @codeCoverageIgnore
|
||||
}
|
||||
$data = $request->getAll();
|
||||
$journal = $this->repository->update($journal, $data);
|
||||
|
Reference in New Issue
Block a user