mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-10-13 08:52:05 -05:00
Expand tests, do code cleanup.
This commit is contained in:
141 files changed
+773
-54
No files matched your search
@@ -111,6 +111,7 @@ class ReconcileController extends Controller
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*
|
||||
* @throws FireflyException
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function overview(Request $request, Account $account, Carbon $start, Carbon $end)
|
||||
{
|
||||
@@ -165,6 +166,7 @@ class ReconcileController extends Controller
|
||||
* @param Carbon|null $end
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|\Illuminate\View\View
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function reconcile(Account $account, Carbon $start = null, Carbon $end = null)
|
||||
{
|
||||
@@ -294,6 +296,8 @@ class ReconcileController extends Controller
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return mixed
|
||||
* @throws \Throwable
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function transactions(Account $account, Carbon $start, Carbon $end)
|
||||
{
|
||||
|
||||
@@ -151,6 +151,9 @@ class AccountController extends Controller
|
||||
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
|
||||
*
|
||||
* @return View
|
||||
* @throws FireflyException
|
||||
* @throws FireflyException
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function edit(Request $request, Account $account)
|
||||
{
|
||||
@@ -258,6 +261,7 @@ class AccountController extends Controller
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.CyclomaticComplexity) // long and complex but not that excessively so.
|
||||
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function show(Request $request, JournalRepositoryInterface $repository, Account $account, string $moment = '')
|
||||
{
|
||||
|
||||
@@ -206,6 +206,13 @@ class LinkController extends Controller
|
||||
return redirect($this->getPreviousUri('link_types.create.uri'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param LinkTypeFormRequest $request
|
||||
* @param LinkTypeRepositoryInterface $repository
|
||||
* @param LinkType $linkType
|
||||
*
|
||||
* @return $this|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
||||
*/
|
||||
public function update(LinkTypeFormRequest $request, LinkTypeRepositoryInterface $repository, LinkType $linkType)
|
||||
{
|
||||
if (!$linkType->editable) {
|
||||
|
||||
@@ -149,6 +149,7 @@ class AttachmentController extends Controller
|
||||
* @param Attachment $attachment
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
* @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
|
||||
*/
|
||||
public function preview(Attachment $attachment)
|
||||
{
|
||||
|
||||
@@ -25,6 +25,9 @@ namespace FireflyIII\Http\Controllers\Auth;
|
||||
use FireflyIII\Http\Controllers\Controller;
|
||||
use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
|
||||
|
||||
/**
|
||||
* Class ForgotPasswordController
|
||||
*/
|
||||
class ForgotPasswordController extends Controller
|
||||
{
|
||||
/*
|
||||
|
||||
@@ -31,6 +31,9 @@ use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Session;
|
||||
|
||||
/**
|
||||
* Class RegisterController
|
||||
*/
|
||||
class RegisterController extends Controller
|
||||
{
|
||||
/*
|
||||
|
||||
@@ -25,6 +25,9 @@ namespace FireflyIII\Http\Controllers\Auth;
|
||||
use FireflyIII\Http\Controllers\Controller;
|
||||
use Illuminate\Foundation\Auth\ResetsPasswords;
|
||||
|
||||
/**
|
||||
* Class ResetPasswordController
|
||||
*/
|
||||
class ResetPasswordController extends Controller
|
||||
{
|
||||
/*
|
||||
|
||||
@@ -70,7 +70,6 @@ class TwoFactorController extends Controller
|
||||
/**
|
||||
* @return mixed
|
||||
*
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function lostTwoFactor()
|
||||
{
|
||||
|
||||
@@ -73,8 +73,9 @@ class BudgetController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param Budget $budget
|
||||
* @param Request $request
|
||||
* @param BudgetRepositoryInterface $repository
|
||||
* @param Budget $budget
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
|
||||
@@ -342,7 +342,6 @@ class AccountController extends Controller
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function period(Account $account, Carbon $start)
|
||||
{
|
||||
|
||||
@@ -38,6 +38,9 @@ use FireflyIII\Support\CacheProperties;
|
||||
use Illuminate\Support\Collection;
|
||||
use Response;
|
||||
|
||||
/**
|
||||
* Class TagReportController
|
||||
*/
|
||||
class TagReportController extends Controller
|
||||
{
|
||||
/** @var GeneratorInterface */
|
||||
|
||||
@@ -273,6 +273,8 @@ class HomeController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
||||
*/
|
||||
public function testFlash(Request $request)
|
||||
|
||||
@@ -27,6 +27,9 @@ use FireflyIII\Http\Controllers\Controller;
|
||||
use FireflyIII\Repositories\ImportJob\ImportJobRepositoryInterface;
|
||||
use FireflyIII\Support\Import\Prerequisites\PrerequisitesInterface;
|
||||
|
||||
/**
|
||||
* Class BankController
|
||||
*/
|
||||
class BankController extends Controller
|
||||
{
|
||||
|
||||
|
||||
@@ -87,7 +87,10 @@ class JavascriptController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param Request $request
|
||||
*
|
||||
* @param AccountRepositoryInterface $repository
|
||||
* @param CurrencyRepositoryInterface $currencyRepository
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
|
||||
@@ -36,6 +36,7 @@ class FrontpageController extends Controller
|
||||
* @param PiggyBankRepositoryInterface $repository
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function piggyBanks(PiggyBankRepositoryInterface $repository)
|
||||
{
|
||||
|
||||
@@ -46,6 +46,7 @@ class JsonController extends Controller
|
||||
* @param Request $request
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function action(Request $request)
|
||||
{
|
||||
@@ -120,6 +121,7 @@ class JsonController extends Controller
|
||||
* @param Request $request
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function trigger(Request $request)
|
||||
{
|
||||
|
||||
@@ -81,6 +81,11 @@ class ReportController extends Controller
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*
|
||||
* @throws FireflyException
|
||||
* @throws \Throwable
|
||||
* @throws \Throwable
|
||||
* @throws \Throwable
|
||||
* @throws \Throwable
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function general(Request $request)
|
||||
{
|
||||
@@ -119,6 +124,7 @@ class ReportController extends Controller
|
||||
* @return string
|
||||
*
|
||||
* @throws FireflyException
|
||||
* @throws \Throwable
|
||||
*/
|
||||
private function balanceAmount(array $attributes): string
|
||||
{
|
||||
@@ -156,7 +162,7 @@ class ReportController extends Controller
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @throws FireflyException
|
||||
* @throws \Throwable
|
||||
*/
|
||||
private function budgetSpentAmount(array $attributes): string
|
||||
{
|
||||
@@ -170,11 +176,11 @@ class ReportController extends Controller
|
||||
/**
|
||||
* Returns all expenses in category in range.
|
||||
*
|
||||
* @param $attributes
|
||||
* @param array $attributes
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @throws FireflyException
|
||||
* @throws \Throwable
|
||||
*/
|
||||
private function categoryEntry(array $attributes): string
|
||||
{
|
||||
@@ -188,11 +194,11 @@ class ReportController extends Controller
|
||||
/**
|
||||
* Returns all the expenses that went to the given expense account.
|
||||
*
|
||||
* @param $attributes
|
||||
* @param array $attributes
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @throws FireflyException
|
||||
* @throws \Throwable
|
||||
*/
|
||||
private function expenseEntry(array $attributes): string
|
||||
{
|
||||
@@ -206,11 +212,11 @@ class ReportController extends Controller
|
||||
/**
|
||||
* Returns all the incomes that went to the given asset account.
|
||||
*
|
||||
* @param $attributes
|
||||
* @param array $attributes
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @throws FireflyException
|
||||
* @throws \Throwable
|
||||
*/
|
||||
private function incomeEntry(array $attributes): string
|
||||
{
|
||||
|
||||
@@ -71,6 +71,8 @@ class PreferencesController extends Controller
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
||||
* @throws \Exception
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function deleteCode()
|
||||
{
|
||||
|
||||
@@ -259,8 +259,9 @@ class ProfileController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $token
|
||||
* @param string $hash
|
||||
* @param UserRepositoryInterface $repository
|
||||
* @param string $token
|
||||
* @param string $hash
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
||||
*
|
||||
|
||||
@@ -39,6 +39,7 @@ class AccountController extends Controller
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return mixed|string
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function general(Collection $accounts, Carbon $start, Carbon $end)
|
||||
{
|
||||
|
||||
@@ -40,6 +40,7 @@ class BalanceController extends Controller
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return mixed|string
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function general(BalanceReportHelperInterface $helper, Collection $accounts, Carbon $start, Carbon $end)
|
||||
{
|
||||
|
||||
@@ -41,6 +41,7 @@ class BudgetController extends Controller
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return mixed|string
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function general(BudgetReportHelperInterface $helper, Collection $accounts, Carbon $start, Carbon $end)
|
||||
{
|
||||
@@ -68,6 +69,7 @@ class BudgetController extends Controller
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return mixed|string
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function period(Collection $accounts, Carbon $start, Carbon $end)
|
||||
{
|
||||
|
||||
@@ -40,6 +40,7 @@ class CategoryController extends Controller
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return mixed|string
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function expenses(Collection $accounts, Carbon $start, Carbon $end)
|
||||
{
|
||||
@@ -71,6 +72,7 @@ class CategoryController extends Controller
|
||||
* @param Collection $accounts
|
||||
*
|
||||
* @return string
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function income(Collection $accounts, Carbon $start, Carbon $end)
|
||||
{
|
||||
@@ -104,6 +106,7 @@ class CategoryController extends Controller
|
||||
* @return mixed|string
|
||||
*
|
||||
* @internal param ReportHelperInterface $helper
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function operations(Collection $accounts, Carbon $start, Carbon $end)
|
||||
{
|
||||
|
||||
@@ -211,6 +211,15 @@ class ExpenseController extends Controller
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Collection $accounts
|
||||
* @param Collection $expense
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return string
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function topExpense(Collection $accounts, Collection $expense, Carbon $start, Carbon $end)
|
||||
{
|
||||
// Properties for cache:
|
||||
@@ -246,6 +255,15 @@ class ExpenseController extends Controller
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param Collection $accounts
|
||||
* @param Collection $expense
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return mixed|string
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function topIncome(Collection $accounts, Collection $expense, Carbon $start, Carbon $end)
|
||||
{
|
||||
// Properties for cache:
|
||||
@@ -366,6 +384,14 @@ class ExpenseController extends Controller
|
||||
return $sum;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Collection $assets
|
||||
* @param Collection $opposing
|
||||
* @param Carbon $start
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function earnedInPeriod(Collection $assets, Collection $opposing, Carbon $start, Carbon $end): array
|
||||
{
|
||||
/** @var JournalCollectorInterface $collector */
|
||||
|
||||
@@ -40,6 +40,7 @@ class OperationsController extends Controller
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return mixed|string
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function expenses(AccountTaskerInterface $tasker, Collection $accounts, Carbon $start, Carbon $end)
|
||||
{
|
||||
@@ -67,6 +68,7 @@ class OperationsController extends Controller
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return string
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function income(AccountTaskerInterface $tasker, Collection $accounts, Carbon $start, Carbon $end)
|
||||
{
|
||||
@@ -95,6 +97,7 @@ class OperationsController extends Controller
|
||||
* @param Carbon $end
|
||||
*
|
||||
* @return mixed|string
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function operations(AccountTaskerInterface $tasker, Collection $accounts, Carbon $start, Carbon $end)
|
||||
{
|
||||
|
||||
@@ -72,6 +72,8 @@ class RuleController extends Controller
|
||||
* @param RuleGroup $ruleGroup
|
||||
*
|
||||
* @return View
|
||||
* @throws \Throwable
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function create(Request $request, RuleGroup $ruleGroup)
|
||||
{
|
||||
@@ -164,6 +166,10 @@ class RuleController extends Controller
|
||||
* @param Rule $rule
|
||||
*
|
||||
* @return View
|
||||
* @throws \Throwable
|
||||
* @throws \Throwable
|
||||
* @throws \Throwable
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function edit(Request $request, RuleRepositoryInterface $repository, Rule $rule)
|
||||
{
|
||||
@@ -356,6 +362,7 @@ class RuleController extends Controller
|
||||
* @param TestRuleFormRequest $request
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function testTriggers(TestRuleFormRequest $request)
|
||||
{
|
||||
@@ -528,6 +535,7 @@ class RuleController extends Controller
|
||||
* @param Rule $rule
|
||||
*
|
||||
* @return array
|
||||
* @throws \Throwable
|
||||
*/
|
||||
private function getCurrentActions(Rule $rule)
|
||||
{
|
||||
@@ -556,6 +564,7 @@ class RuleController extends Controller
|
||||
* @param Rule $rule
|
||||
*
|
||||
* @return array
|
||||
* @throws \Throwable
|
||||
*/
|
||||
private function getCurrentTriggers(Rule $rule)
|
||||
{
|
||||
@@ -586,6 +595,7 @@ class RuleController extends Controller
|
||||
* @param Request $request
|
||||
*
|
||||
* @return array
|
||||
* @throws \Throwable
|
||||
*/
|
||||
private function getPreviousActions(Request $request)
|
||||
{
|
||||
@@ -615,6 +625,7 @@ class RuleController extends Controller
|
||||
* @param Request $request
|
||||
*
|
||||
* @return array
|
||||
* @throws \Throwable
|
||||
*/
|
||||
private function getPreviousTriggers(Request $request)
|
||||
{
|
||||
|
||||
@@ -69,6 +69,13 @@ class SearchController extends Controller
|
||||
return view('search.index', compact('query', 'fullQuery', 'subTitle'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param SearchInterface $searcher
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function search(Request $request, SearchInterface $searcher)
|
||||
{
|
||||
$fullQuery = strval($request->get('query'));
|
||||
@@ -79,7 +86,7 @@ class SearchController extends Controller
|
||||
$cache->addProperty($fullQuery);
|
||||
|
||||
if ($cache->has()) {
|
||||
$transactions = $cache->get();
|
||||
$transactions = $cache->get(); // @codeCoverageIgnore
|
||||
}
|
||||
|
||||
if (!$cache->has()) {
|
||||
|
||||
@@ -161,7 +161,7 @@ class TagController extends Controller
|
||||
$start = new Carbon;
|
||||
if (null !== $oldestTag) {
|
||||
/** @var Carbon $start */
|
||||
$start = $oldestTag->date;
|
||||
$start = $oldestTag->date; // @codeCoverageIgnore
|
||||
}
|
||||
if (null === $oldestTag) {
|
||||
/** @var Carbon $start */
|
||||
|
||||
@@ -128,6 +128,8 @@ class ConvertController extends Controller
|
||||
* @param TransactionJournal $journal
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
||||
* @throws FireflyException
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function postIndex(Request $request, JournalRepositoryInterface $repository, TransactionType $destinationType, TransactionJournal $journal)
|
||||
{
|
||||
|
||||
@@ -97,6 +97,11 @@ class SingleController extends Controller
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param TransactionJournal $journal
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
||||
*/
|
||||
public function cloneTransaction(TransactionJournal $journal)
|
||||
{
|
||||
$source = $journal->sourceAccountList()->first();
|
||||
@@ -149,7 +154,8 @@ class SingleController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $what
|
||||
* @param Request $request
|
||||
* @param string $what
|
||||
*
|
||||
* @return View
|
||||
*/
|
||||
|
||||
@@ -69,6 +69,7 @@ class TransactionController extends Controller
|
||||
* @param string $moment
|
||||
*
|
||||
* @return View
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function index(Request $request, JournalRepositoryInterface $repository, string $what, string $moment = '')
|
||||
{
|
||||
@@ -128,6 +129,8 @@ class TransactionController extends Controller
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param JournalRepositoryInterface $repository
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function reconcile(Request $request, JournalRepositoryInterface $repository)
|
||||
{
|
||||
@@ -139,6 +142,7 @@ class TransactionController extends Controller
|
||||
|
||||
$repository->reconcile($transaction);
|
||||
}
|
||||
return Response::json(['ok'=>'reconciled']);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -180,7 +184,7 @@ class TransactionController extends Controller
|
||||
return $this->redirectToAccount($journal);
|
||||
}
|
||||
if ($journal->transactionType->type === TransactionType::RECONCILIATION) {
|
||||
return redirect(route('accounts.reconcile.show', [$journal->id]));
|
||||
return redirect(route('accounts.reconcile.show', [$journal->id])); // @codeCoverageIgnore
|
||||
}
|
||||
$linkTypes = $linkTypeRepository->get();
|
||||
$links = $linkTypeRepository->getLinks($journal);
|
||||
@@ -197,7 +201,6 @@ class TransactionController extends Controller
|
||||
*
|
||||
* @return Collection
|
||||
*
|
||||
* @throws FireflyException
|
||||
*/
|
||||
private function getPeriodOverview(string $what): Collection
|
||||
{
|
||||
@@ -248,7 +251,7 @@ class TransactionController extends Controller
|
||||
];
|
||||
Log::debug(sprintf('What is %s', $what));
|
||||
if ($journals->count() > 0) {
|
||||
$entries->push($array);
|
||||
$entries->push($array); // @codeCoverageIgnore
|
||||
}
|
||||
$end = app('navigation')->subtractPeriod($end, $range, 1);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user