mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-11-20 08:30:06 +00:00
Expand test coverage.
This commit is contained in:
@@ -291,32 +291,4 @@ class BoxController extends Controller
|
||||
return response()->json($return);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a currency or return default currency.
|
||||
*
|
||||
* @param Account $account
|
||||
*
|
||||
* @return TransactionCurrency
|
||||
*/
|
||||
protected function getCurrencyOrDefault(Account $account): TransactionCurrency // get a preference
|
||||
{
|
||||
/** @var AccountRepositoryInterface $repository */
|
||||
$repository = app(AccountRepositoryInterface::class);
|
||||
/** @var CurrencyRepositoryInterface $currencyRepos */
|
||||
$currencyRepos = app(CurrencyRepositoryInterface::class);
|
||||
|
||||
$currency = app('amount')->getDefaultCurrency();
|
||||
$accountCurrency = null;
|
||||
$currencyId = (int)$repository->getMetaValue($account, 'currency_id');
|
||||
if (0 !== $currencyId) {
|
||||
$accountCurrency = $currencyRepos->findNull($currencyId);
|
||||
}
|
||||
if (null === $accountCurrency) {
|
||||
$accountCurrency = $currency;
|
||||
}
|
||||
|
||||
return $accountCurrency;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -67,10 +67,12 @@ class FrontpageController extends Controller
|
||||
if (\count($info) > 0) {
|
||||
try {
|
||||
$html = view('json.piggy-banks', compact('info'))->render();
|
||||
// @codeCoverageIgnoreStart
|
||||
} catch (Throwable $e) {
|
||||
Log::error(sprintf('Cannot render json.piggy-banks: %s', $e->getMessage()));
|
||||
$html = 'Could not render view.';
|
||||
}
|
||||
// @codeCoverageIgnoreEnd
|
||||
}
|
||||
|
||||
return response()->json(['html' => $html]);
|
||||
|
||||
@@ -119,7 +119,7 @@ class ReconcileController extends Controller
|
||||
/** @var Transaction $transaction */
|
||||
foreach ($cleared as $transaction) {
|
||||
if ($transaction->transactionJournal->date <= $end) {
|
||||
$clearedAmount = bcadd($clearedAmount, $transaction->amount);
|
||||
$clearedAmount = bcadd($clearedAmount, $transaction->amount); // @codeCoverageIgnore
|
||||
++$countCleared;
|
||||
}
|
||||
}
|
||||
@@ -134,10 +134,12 @@ class ReconcileController extends Controller
|
||||
'route', 'countCleared'
|
||||
)
|
||||
)->render();
|
||||
// @codeCoverageIgnoreStart
|
||||
} catch (Throwable $e) {
|
||||
Log::debug(sprintf('View error: %s', $e->getMessage()));
|
||||
$view = 'Could not render accounts.reconcile.overview';
|
||||
}
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
||||
|
||||
$return = [
|
||||
@@ -194,10 +196,12 @@ class ReconcileController extends Controller
|
||||
$html = view(
|
||||
'accounts.reconcile.transactions', compact('account', 'transactions', 'currency', 'start', 'end', 'selectionStart', 'selectionEnd')
|
||||
)->render();
|
||||
// @codeCoverageIgnoreStart
|
||||
} catch (Throwable $e) {
|
||||
Log::debug(sprintf('Could not render: %s', $e->getMessage()));
|
||||
$html = 'Could not render accounts.reconcile.transactions';
|
||||
}
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
||||
return response()->json(['html' => $html, 'startBalance' => $startBalance, 'endBalance' => $endBalance]);
|
||||
}
|
||||
|
||||
@@ -103,10 +103,8 @@ class RecurrenceController extends Controller
|
||||
$repetition->repetition_skip = (int)$request->get('skip');
|
||||
$repetition->weekend = (int)$request->get('weekend');
|
||||
$actualEnd = clone $end;
|
||||
|
||||
$occurrences = [];
|
||||
switch ($endsAt) {
|
||||
default:
|
||||
throw new FireflyException(sprintf('Cannot generate events for type that ends at "%s".', $endsAt));
|
||||
case 'forever':
|
||||
// simply generate up until $end. No change from default behavior.
|
||||
$occurrences = $this->recurring->getOccurrencesInRange($repetition, $actualStart, $actualEnd);
|
||||
|
||||
Reference in New Issue
Block a user