Various issues fixed (SonarQube)

This commit is contained in:
James Cole
2020-10-26 19:15:57 +01:00
parent e4923a3c69
commit 372c6ac667
57 changed files with 86 additions and 221 deletions

View File

@@ -82,10 +82,9 @@ class TransactionStoreRequest extends FormRequest
{ {
$return = []; $return = [];
/** /**
* @var int $index
* @var array $transaction * @var array $transaction
*/ */
foreach ($this->get('transactions') as $index => $transaction) { foreach ($this->get('transactions') as $transaction) {
$object = new NullArrayObject($transaction); $object = new NullArrayObject($transaction);
$return[] = [ $return[] = [
'type' => $this->stringFromValue($object['type']), 'type' => $this->stringFromValue($object['type']),

View File

@@ -63,7 +63,6 @@ class TransactionJournalFactory
private array $fields; private array $fields;
private PiggyBankEventFactory $piggyEventFactory; private PiggyBankEventFactory $piggyEventFactory;
private PiggyBankRepositoryInterface $piggyRepository; private PiggyBankRepositoryInterface $piggyRepository;
private TransactionFactory $transactionFactory;
private TransactionTypeRepositoryInterface $typeRepository; private TransactionTypeRepositoryInterface $typeRepository;
private User $user; private User $user;

View File

@@ -155,7 +155,7 @@ class MonthReportGenerator implements ReportGeneratorInterface
return [ return [
'journals' => $journals, 'journals' => $journals,
'currency' => $currency, 'currency' => $currency,
'exists' => count($journals) > 0, 'exists' => !empty($journals),
'end' => $this->end->formatLocalized((string) trans('config.month_and_day', [], $locale)), 'end' => $this->end->formatLocalized((string) trans('config.month_and_day', [], $locale)),
'endBalance' => app('steam')->balance($account, $this->end), 'endBalance' => app('steam')->balance($account, $this->end),
'dayBefore' => $date->formatLocalized((string) trans('config.month_and_day', [], $locale)), 'dayBefore' => $date->formatLocalized((string) trans('config.month_and_day', [], $locale)),

View File

@@ -224,7 +224,7 @@ class AttachmentHelper implements AttachmentHelperInterface
} }
Log::debug('Done processing uploads.'); Log::debug('Done processing uploads.');
} }
if (!is_array($files) || (is_array($files) && 0 === count($files))) { if (!is_array($files) || empty($files)) {
Log::debug('Array of files is not an array. Probably nothing uploaded. Will not store attachments.'); Log::debug('Array of files is not an array. Probably nothing uploaded. Will not store attachments.');
} }

View File

@@ -267,7 +267,7 @@ class GroupCollector implements GroupCollectorInterface
*/ */
public function setJournalIds(array $journalIds): GroupCollectorInterface public function setJournalIds(array $journalIds): GroupCollectorInterface
{ {
if (count($journalIds) > 0) { if (!empty($journalIds)) {
$this->query->whereIn('transaction_journals.id', $journalIds); $this->query->whereIn('transaction_journals.id', $journalIds);
} }

View File

@@ -116,7 +116,7 @@ class LoginController extends Controller
$this->incrementLoginAttempts($request); $this->incrementLoginAttempts($request);
Log::channel('audit')->info(sprintf('Login failed. Attempt for user "%s" failed.', $request->get('email'))); Log::channel('audit')->info(sprintf('Login failed. Attempt for user "%s" failed.', $request->get('email')));
return $this->sendFailedLoginResponse($request); $this->sendFailedLoginResponse($request);
} }
/** /**

View File

@@ -264,10 +264,9 @@ class IndexController extends Controller
return []; return [];
} }
/** /**
* @var int $objectGroupId
* @var array $array * @var array $array
*/ */
foreach ($sums as $objectGroupId => $array) { foreach ($sums as $array) {
/** /**
* @var int $currencyId * @var int $currencyId
* @var array $entry * @var array $entry

View File

@@ -50,16 +50,11 @@ class BudgetController extends Controller
{ {
use DateCalculation, AugumentData; use DateCalculation, AugumentData;
/** @var GeneratorInterface Chart generation methods. */ protected GeneratorInterface $generator;
protected $generator; protected OperationsRepositoryInterface $opsRepository;
/** @var OperationsRepositoryInterface */ protected BudgetRepositoryInterface $repository;
protected $opsRepository; private BudgetLimitRepositoryInterface $blRepository;
/** @var BudgetRepositoryInterface The budget repository */ private NoBudgetRepositoryInterface $nbRepository;
protected $repository;
/** @var BudgetLimitRepositoryInterface */
private $blRepository;
/** @var NoBudgetRepositoryInterface */
private $nbRepository;
/** /**
* BudgetController constructor. * BudgetController constructor.
@@ -185,12 +180,12 @@ class BudgetController extends Controller
while ($start <= $end) { while ($start <= $end) {
$spent = $this->opsRepository->spentInPeriod($budgetCollection, new Collection, $start, $start); $spent = $this->opsRepository->spentInPeriod($budgetCollection, new Collection, $start, $start);
$amount = bcadd($amount, $spent); $amount = bcadd($amount, $spent);
$format = $start->formatLocalized((string) trans('config.month_and_day', [], $locale)); $format = $start->formatLocalized((string)trans('config.month_and_day', [], $locale));
$entries[$format] = $amount; $entries[$format] = $amount;
$start->addDay(); $start->addDay();
} }
$data = $this->generator->singleSet((string) trans('firefly.left'), $entries); $data = $this->generator->singleSet((string)trans('firefly.left'), $entries);
// add currency symbol from budget limit: // add currency symbol from budget limit:
$data['datasets'][0]['currency_symbol'] = $budgetLimit->transactionCurrency->symbol; $data['datasets'][0]['currency_symbol'] = $budgetLimit->transactionCurrency->symbol;
$data['datasets'][0]['currency_code'] = $budgetLimit->transactionCurrency->code; $data['datasets'][0]['currency_code'] = $budgetLimit->transactionCurrency->code;
@@ -239,7 +234,7 @@ class BudgetController extends Controller
// group by asset account ID: // group by asset account ID:
foreach ($journals as $journal) { foreach ($journals as $journal) {
$key = sprintf('%d-%d', (int) $journal['source_account_id'], $journal['currency_id']); $key = sprintf('%d-%d', (int)$journal['source_account_id'], $journal['currency_id']);
$result[$key] = $result[$key] ?? [ $result[$key] = $result[$key] ?? [
'amount' => '0', 'amount' => '0',
'currency_symbol' => $journal['currency_symbol'], 'currency_symbol' => $journal['currency_symbol'],
@@ -252,7 +247,7 @@ class BudgetController extends Controller
$names = $this->getAccountNames(array_keys($result)); $names = $this->getAccountNames(array_keys($result));
foreach ($result as $combinedId => $info) { foreach ($result as $combinedId => $info) {
$parts = explode('-', $combinedId); $parts = explode('-', $combinedId);
$assetId = (int) $parts[0]; $assetId = (int)$parts[0];
$title = sprintf('%s (%s)', $names[$assetId] ?? '(empty)', $info['currency_name']); $title = sprintf('%s (%s)', $names[$assetId] ?? '(empty)', $info['currency_name']);
$chartData[$title] $chartData[$title]
= [ = [
@@ -319,7 +314,7 @@ class BudgetController extends Controller
$names = $this->getCategoryNames(array_keys($result)); $names = $this->getCategoryNames(array_keys($result));
foreach ($result as $combinedId => $info) { foreach ($result as $combinedId => $info) {
$parts = explode('-', $combinedId); $parts = explode('-', $combinedId);
$categoryId = (int) $parts[0]; $categoryId = (int)$parts[0];
$title = sprintf('%s (%s)', $names[$categoryId] ?? '(empty)', $info['currency_name']); $title = sprintf('%s (%s)', $names[$categoryId] ?? '(empty)', $info['currency_name']);
$chartData[$title] = [ $chartData[$title] = [
'amount' => $info['amount'], 'amount' => $info['amount'],
@@ -385,7 +380,7 @@ class BudgetController extends Controller
$names = $this->getAccountNames(array_keys($result)); $names = $this->getAccountNames(array_keys($result));
foreach ($result as $combinedId => $info) { foreach ($result as $combinedId => $info) {
$parts = explode('-', $combinedId); $parts = explode('-', $combinedId);
$opposingId = (int) $parts[0]; $opposingId = (int)$parts[0];
$name = $names[$opposingId] ?? 'no name'; $name = $names[$opposingId] ?? 'no name';
$title = sprintf('%s (%s)', $name, $info['currency_name']); $title = sprintf('%s (%s)', $name, $info['currency_name']);
$chartData[$title] = [ $chartData[$title] = [
@@ -422,12 +417,12 @@ class BudgetController extends Controller
return response()->json($cache->get()); // @codeCoverageIgnore return response()->json($cache->get()); // @codeCoverageIgnore
} }
$generator = app(FrontpageChartGenerator::class); $chartGenerator = app(FrontpageChartGenerator::class);
$generator->setUser(auth()->user()); $chartGenerator->setUser(auth()->user());
$generator->setStart($start); $chartGenerator->setStart($start);
$generator->setEnd($end); $chartGenerator->setEnd($end);
$chartData = $generator->generate(); $chartData = $chartGenerator->generate();
$data = $this->generator->multiSet($chartData); $data = $this->generator->multiSet($chartData);
$cache->store($data); $cache->store($data);
@@ -463,14 +458,14 @@ class BudgetController extends Controller
$preferredRange = app('navigation')->preferredRangeFormat($start, $end); $preferredRange = app('navigation')->preferredRangeFormat($start, $end);
$chartData = [ $chartData = [
[ [
'label' => (string) trans('firefly.box_spent_in_currency', ['currency' => $currency->name]), 'label' => (string)trans('firefly.box_spent_in_currency', ['currency' => $currency->name]),
'type' => 'bar', 'type' => 'bar',
'entries' => [], 'entries' => [],
'currency_symbol' => $currency->symbol, 'currency_symbol' => $currency->symbol,
'currency_code' => $currency->code, 'currency_code' => $currency->code,
], ],
[ [
'label' => (string) trans('firefly.box_budgeted_in_currency', ['currency' => $currency->name]), 'label' => (string)trans('firefly.box_budgeted_in_currency', ['currency' => $currency->name]),
'type' => 'bar', 'type' => 'bar',
'currency_symbol' => $currency->symbol, 'currency_symbol' => $currency->symbol,
'currency_code' => $currency->code, 'currency_code' => $currency->code,
@@ -549,7 +544,7 @@ class BudgetController extends Controller
$currentStart = app('navigation')->addPeriod($currentStart, $preferredRange, 0); $currentStart = app('navigation')->addPeriod($currentStart, $preferredRange, 0);
} }
$data = $this->generator->singleSet((string) trans('firefly.spent'), $chartData); $data = $this->generator->singleSet((string)trans('firefly.spent'), $chartData);
$cache->store($data); $cache->store($data);
return response()->json($data); return response()->json($data);

View File

@@ -187,7 +187,7 @@ class ExpenseReportController extends Controller
$newSet[$key] = $chartData[$key]; // @codeCoverageIgnore $newSet[$key] = $chartData[$key]; // @codeCoverageIgnore
} }
} }
if (0 === count($newSet)) { if (empty($newSet)) {
$newSet = $chartData; // @codeCoverageIgnore $newSet = $chartData; // @codeCoverageIgnore
} }
$data = $this->generator->multiSet($newSet); $data = $this->generator->multiSet($newSet);

View File

@@ -193,7 +193,7 @@ class BoxController extends Controller
$incomes[$currencyId] = app('amount')->formatAnything($currency, $incomes[$currencyId] ?? '0', false); $incomes[$currencyId] = app('amount')->formatAnything($currency, $incomes[$currencyId] ?? '0', false);
$expenses[$currencyId] = app('amount')->formatAnything($currency, $expenses[$currencyId] ?? '0', false); $expenses[$currencyId] = app('amount')->formatAnything($currency, $expenses[$currencyId] ?? '0', false);
} }
if (0 === count($sums)) { if (empty($sums)) {
$currency = app('amount')->getDefaultCurrency(); $currency = app('amount')->getDefaultCurrency();
$sums[$currency->id] = app('amount')->formatAnything($currency, '0', false); $sums[$currency->id] = app('amount')->formatAnything($currency, '0', false);
$incomes[$currency->id] = app('amount')->formatAnything($currency, '0', false); $incomes[$currency->id] = app('amount')->formatAnything($currency, '0', false);
@@ -257,7 +257,7 @@ class BoxController extends Controller
$return = []; $return = [];
foreach ($netWorthSet as $index => $data) { foreach ($netWorthSet as $data) {
/** @var TransactionCurrency $currency */ /** @var TransactionCurrency $currency */
$currency = $data['currency']; $currency = $data['currency'];
$return[$currency->id] = app('amount')->formatAnything($currency, $data['balance'], false); $return[$currency->id] = app('amount')->formatAnything($currency, $data['balance'], false);

View File

@@ -64,7 +64,7 @@ class FrontpageController extends Controller
} }
} }
$html = ''; $html = '';
if (count($info) > 0) { if (!empty($info)) {
try { try {
$html = view('json.piggy-banks', compact('info'))->render(); $html = view('json.piggy-banks', compact('info'))->render();
// @codeCoverageIgnoreStart // @codeCoverageIgnoreStart

View File

@@ -67,8 +67,6 @@ class EditController extends Controller
{ {
$subTitle = (string) trans('firefly.edit_object_group', ['title' => $objectGroup->title]); $subTitle = (string) trans('firefly.edit_object_group', ['title' => $objectGroup->title]);
$subTitleIcon = 'fa-pencil'; $subTitleIcon = 'fa-pencil';
$targetDate = null;
$startDate = null;
if (true !== session('object-groups.edit.fromUpdate')) { if (true !== session('object-groups.edit.fromUpdate')) {
$this->rememberPreviousUri('object-groups.edit.uri'); $this->rememberPreviousUri('object-groups.edit.uri');

View File

@@ -165,7 +165,6 @@ class BudgetController extends Controller
$spent = $this->opsRepository->listExpenses($start, $end, $accounts, $budgets); $spent = $this->opsRepository->listExpenses($start, $end, $accounts, $budgets);
$result = []; $result = [];
foreach ($spent as $currency) { foreach ($spent as $currency) {
$currencyId = $currency['currency_id'];
foreach ($currency['budgets'] as $budget) { foreach ($currency['budgets'] as $budget) {
foreach ($budget['transaction_journals'] as $journal) { foreach ($budget['transaction_journals'] as $journal) {
$destinationId = $journal['destination_account_id']; $destinationId = $journal['destination_account_id'];
@@ -328,7 +327,6 @@ class BudgetController extends Controller
foreach ($expenses as $currency) { foreach ($expenses as $currency) {
foreach ($currency['budgets'] as $budget) { foreach ($currency['budgets'] as $budget) {
$count = 0; $count = 0;
$total = '0';
foreach ($budget['transaction_journals'] as $journal) { foreach ($budget['transaction_journals'] as $journal) {
$count++; $count++;
$key = sprintf('%d-%d', $budget['id'], $currency['currency_id']); $key = sprintf('%d-%d', $budget['id'], $currency['currency_id']);
@@ -377,7 +375,6 @@ class BudgetController extends Controller
$spent = $this->opsRepository->listExpenses($start, $end, $accounts, $budgets); $spent = $this->opsRepository->listExpenses($start, $end, $accounts, $budgets);
$result = []; $result = [];
foreach ($spent as $currency) { foreach ($spent as $currency) {
$currencyId = $currency['currency_id'];
foreach ($currency['budgets'] as $budget) { foreach ($currency['budgets'] as $budget) {
foreach ($budget['transaction_journals'] as $journal) { foreach ($budget['transaction_journals'] as $journal) {
$result[] = [ $result[] = [

View File

@@ -40,10 +40,7 @@ use Throwable;
*/ */
class TagController extends Controller class TagController extends Controller
{ {
private OperationsRepositoryInterface $opsRepository;
/** @var OperationsRepositoryInterface */
private $opsRepository;
/** /**
* ExpenseReportController constructor. * ExpenseReportController constructor.
@@ -282,7 +279,6 @@ class TagController extends Controller
$spent = $this->opsRepository->listExpenses($start, $end, $accounts, $tags); $spent = $this->opsRepository->listExpenses($start, $end, $accounts, $tags);
$result = []; $result = [];
foreach ($spent as $currency) { foreach ($spent as $currency) {
$currencyId = $currency['currency_id'];
foreach ($currency['tags'] as $tag) { foreach ($currency['tags'] as $tag) {
foreach ($tag['transaction_journals'] as $journal) { foreach ($tag['transaction_journals'] as $journal) {
$destinationId = $journal['destination_account_id']; $destinationId = $journal['destination_account_id'];
@@ -335,7 +331,6 @@ class TagController extends Controller
$spent = $this->opsRepository->listIncome($start, $end, $accounts, $tags); $spent = $this->opsRepository->listIncome($start, $end, $accounts, $tags);
$result = []; $result = [];
foreach ($spent as $currency) { foreach ($spent as $currency) {
$currencyId = $currency['currency_id'];
foreach ($currency['tags'] as $tag) { foreach ($currency['tags'] as $tag) {
foreach ($tag['transaction_journals'] as $journal) { foreach ($tag['transaction_journals'] as $journal) {
$sourceId = $journal['source_account_id']; $sourceId = $journal['source_account_id'];
@@ -496,7 +491,6 @@ class TagController extends Controller
$spent = $this->opsRepository->listExpenses($start, $end, $accounts, $tags); $spent = $this->opsRepository->listExpenses($start, $end, $accounts, $tags);
$result = []; $result = [];
foreach ($spent as $currency) { foreach ($spent as $currency) {
$currencyId = $currency['currency_id'];
foreach ($currency['tags'] as $tag) { foreach ($currency['tags'] as $tag) {
foreach ($tag['transaction_journals'] as $journal) { foreach ($tag['transaction_journals'] as $journal) {
$result[] = [ $result[] = [
@@ -546,7 +540,6 @@ class TagController extends Controller
$spent = $this->opsRepository->listIncome($start, $end, $accounts, $tags); $spent = $this->opsRepository->listIncome($start, $end, $accounts, $tags);
$result = []; $result = [];
foreach ($spent as $currency) { foreach ($spent as $currency) {
$currencyId = $currency['currency_id'];
foreach ($currency['tags'] as $tag) { foreach ($currency['tags'] as $tag) {
foreach ($tag['transaction_journals'] as $journal) { foreach ($tag['transaction_journals'] as $journal) {
$result[] = [ $result[] = [

View File

@@ -242,17 +242,15 @@ class ConvertController extends Controller
private function getAssetAccounts(): array private function getAssetAccounts(): array
{ {
// make repositories // make repositories
/** @var AccountRepositoryInterface $accountRepository */ $accountList = $this->accountRepository->getActiveAccountsByType([AccountType::ASSET]);
$accountRepository = app(AccountRepositoryInterface::class);
$accountList = $accountRepository->getActiveAccountsByType([AccountType::ASSET]);
$defaultCurrency = app('amount')->getDefaultCurrency(); $defaultCurrency = app('amount')->getDefaultCurrency();
$grouped = []; $grouped = [];
// group accounts: // group accounts:
/** @var Account $account */ /** @var Account $account */
foreach ($accountList as $account) { foreach ($accountList as $account) {
$balance = app('steam')->balance($account, today()); $balance = app('steam')->balance($account, today());
$currency = $accountRepository->getAccountCurrency($account) ?? $defaultCurrency; $currency = $this->accountRepository->getAccountCurrency($account) ?? $defaultCurrency;
$role = (string)$accountRepository->getMetaValue($account, 'account_role'); $role = (string)$this->accountRepository->getMetaValue($account, 'account_role');
if ('' === $role) { if ('' === $role) {
$role = 'no_account_type'; // @codeCoverageIgnore $role = 'no_account_type'; // @codeCoverageIgnore
} }
@@ -271,16 +269,14 @@ class ConvertController extends Controller
private function getLiabilities(): array private function getLiabilities(): array
{ {
// make repositories // make repositories
/** @var AccountRepositoryInterface $accountRepository */ $accountList = $this->accountRepository->getActiveAccountsByType([AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE]);
$accountRepository = app(AccountRepositoryInterface::class);
$accountList = $accountRepository->getActiveAccountsByType([AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE]);
$defaultCurrency = app('amount')->getDefaultCurrency(); $defaultCurrency = app('amount')->getDefaultCurrency();
$grouped = []; $grouped = [];
// group accounts: // group accounts:
/** @var Account $account */ /** @var Account $account */
foreach ($accountList as $account) { foreach ($accountList as $account) {
$balance = app('steam')->balance($account, today()); $balance = app('steam')->balance($account, today());
$currency = $accountRepository->getAccountCurrency($account) ?? $defaultCurrency; $currency = $this->accountRepository->getAccountCurrency($account) ?? $defaultCurrency;
$role = 'l_' . $account->accountType->type; $role = 'l_' . $account->accountType->type;
$key = (string)trans('firefly.opt_group_' . $role); $key = (string)trans('firefly.opt_group_' . $role);
$grouped[$key][$account->id] = $account->name . ' (' . app('amount')->formatAnything($currency, $balance, false) . ')'; $grouped[$key][$account->id] = $account->name . ' (' . app('amount')->formatAnything($currency, $balance, false) . ')';
@@ -295,16 +291,14 @@ class ConvertController extends Controller
private function getValidDepositSources(): array private function getValidDepositSources(): array
{ {
// make repositories // make repositories
/** @var AccountRepositoryInterface $accountRepository */
$accountRepository = app(AccountRepositoryInterface::class);
$liabilityTypes = [AccountType::MORTGAGE, AccountType::DEBT, AccountType::CREDITCARD, AccountType::LOAN]; $liabilityTypes = [AccountType::MORTGAGE, AccountType::DEBT, AccountType::CREDITCARD, AccountType::LOAN];
$accountList = $accountRepository $accountList = $this->accountRepository
->getActiveAccountsByType([AccountType::REVENUE, AccountType::CASH, AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE]); ->getActiveAccountsByType([AccountType::REVENUE, AccountType::CASH, AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE]);
$grouped = []; $grouped = [];
// group accounts: // group accounts:
/** @var Account $account */ /** @var Account $account */
foreach ($accountList as $account) { foreach ($accountList as $account) {
$role = (string)$accountRepository->getMetaValue($account, 'account_role'); $role = (string)$this->accountRepository->getMetaValue($account, 'account_role');
$name = $account->name; $name = $account->name;
if ('' === $role) { if ('' === $role) {
$role = 'no_account_type'; // @codeCoverageIgnore $role = 'no_account_type'; // @codeCoverageIgnore
@@ -337,17 +331,15 @@ class ConvertController extends Controller
private function getValidWithdrawalDests(): array private function getValidWithdrawalDests(): array
{ {
// make repositories // make repositories
/** @var AccountRepositoryInterface $accountRepository */
$accountRepository = app(AccountRepositoryInterface::class);
$liabilityTypes = [AccountType::MORTGAGE, AccountType::DEBT, AccountType::CREDITCARD, AccountType::LOAN]; $liabilityTypes = [AccountType::MORTGAGE, AccountType::DEBT, AccountType::CREDITCARD, AccountType::LOAN];
$accountList = $accountRepository->getActiveAccountsByType( $accountList = $this->accountRepository->getActiveAccountsByType(
[AccountType::EXPENSE, AccountType::CASH, AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE] [AccountType::EXPENSE, AccountType::CASH, AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE]
); );
$grouped = []; $grouped = [];
// group accounts: // group accounts:
/** @var Account $account */ /** @var Account $account */
foreach ($accountList as $account) { foreach ($accountList as $account) {
$role = (string)$accountRepository->getMetaValue($account, 'account_role'); $role = (string)$this->accountRepository->getMetaValue($account, 'account_role');
$name = $account->name; $name = $account->name;
if ('' === $role) { if ('' === $role) {
$role = 'no_account_type'; // @codeCoverageIgnore $role = 'no_account_type'; // @codeCoverageIgnore

View File

@@ -171,7 +171,7 @@ class ShowController extends Controller
{ {
$accounts = []; $accounts = [];
foreach ($group['transactions'] as $index => $transaction) { foreach ($group['transactions'] as $transaction) {
$accounts['source'][] = [ $accounts['source'][] = [
'type' => $transaction['source_type'], 'type' => $transaction['source_type'],
'id' => $transaction['source_id'], 'id' => $transaction['source_id'],

View File

@@ -354,17 +354,7 @@ class CreateRecurringTransactions implements ShouldQueue
$includeWeekend = clone $this->date; $includeWeekend = clone $this->date;
$includeWeekend->addDays(2); $includeWeekend->addDays(2);
$occurrences = $this->repository->getOccurrencesInRange($repetition, $recurrence->first_date, $includeWeekend); $occurrences = $this->repository->getOccurrencesInRange($repetition, $recurrence->first_date, $includeWeekend);
/*
Log::debug(
sprintf(
'Calculated %d occurrences between %s and %s',
count($occurrences),
$recurrence->first_date->format('Y-m-d'),
$includeWeekend->format('Y-m-d')
),
$this->debugArray($occurrences)
);
*/
unset($includeWeekend); unset($includeWeekend);
$result = $this->handleOccurrences($recurrence, $repetition, $occurrences); $result = $this->handleOccurrences($recurrence, $repetition, $occurrences);

View File

@@ -70,12 +70,6 @@ class ReportNewJournalsMail extends Mailable
*/ */
public function build(): self public function build(): self
{ {
$subject = 1 === $this->groups->count()
? 'Firefly III has created a new transaction'
: sprintf(
'Firefly III has created new %d transactions',
$this->groups->count()
);
$this->transform(); $this->transform();
return $this->view('emails.report-new-journals-html')->text('emails.report-new-journals-text') return $this->view('emails.report-new-journals-html')->text('emails.report-new-journals-text')

View File

@@ -355,7 +355,7 @@ class TransactionJournal extends Model
if (!self::isJoined($query, 'transaction_types')) { if (!self::isJoined($query, 'transaction_types')) {
$query->leftJoin('transaction_types', 'transaction_types.id', '=', 'transaction_journals.transaction_type_id'); $query->leftJoin('transaction_types', 'transaction_types.id', '=', 'transaction_journals.transaction_type_id');
} }
if (count($types) > 0) { if (!empty($types)) {
$query->whereIn('transaction_types.type', $types); $query->whereIn('transaction_types.type', $types);
} }
} }

View File

@@ -128,7 +128,7 @@ class AccountRepository implements AccountRepositoryInterface
->where('account_meta.name', 'account_number') ->where('account_meta.name', 'account_number')
->where('account_meta.data', json_encode($number)); ->where('account_meta.data', json_encode($number));
if (count($types) > 0) { if (!empty($types)) {
$query->leftJoin('account_types', 'accounts.account_type_id', '=', 'account_types.id'); $query->leftJoin('account_types', 'accounts.account_type_id', '=', 'account_types.id');
$query->whereIn('account_types.type', $types); $query->whereIn('account_types.type', $types);
} }
@@ -152,7 +152,7 @@ class AccountRepository implements AccountRepositoryInterface
{ {
$query = $this->user->accounts()->where('iban', '!=', '')->whereNotNull('iban'); $query = $this->user->accounts()->where('iban', '!=', '')->whereNotNull('iban');
if (count($types) > 0) { if (!empty($types)) {
$query->leftJoin('account_types', 'accounts.account_type_id', '=', 'account_types.id'); $query->leftJoin('account_types', 'accounts.account_type_id', '=', 'account_types.id');
$query->whereIn('account_types.type', $types); $query->whereIn('account_types.type', $types);
} }
@@ -180,7 +180,7 @@ class AccountRepository implements AccountRepositoryInterface
{ {
$query = $this->user->accounts(); $query = $this->user->accounts();
if (count($types) > 0) { if (!empty($types)) {
$query->leftJoin('account_types', 'accounts.account_type_id', '=', 'account_types.id'); $query->leftJoin('account_types', 'accounts.account_type_id', '=', 'account_types.id');
$query->whereIn('account_types.type', $types); $query->whereIn('account_types.type', $types);
} }
@@ -260,7 +260,7 @@ class AccountRepository implements AccountRepositoryInterface
/** @var Collection $result */ /** @var Collection $result */
$query = $this->user->accounts(); $query = $this->user->accounts();
if (count($accountIds) > 0) { if (!empty($accountIds)) {
$query->whereIn('accounts.id', $accountIds); $query->whereIn('accounts.id', $accountIds);
} }
$query->orderBy('accounts.order', 'ASC'); $query->orderBy('accounts.order', 'ASC');
@@ -279,7 +279,7 @@ class AccountRepository implements AccountRepositoryInterface
{ {
/** @var Collection $result */ /** @var Collection $result */
$query = $this->user->accounts(); $query = $this->user->accounts();
if (count($types) > 0) { if (!empty($types)) {
$query->accountTypeIn($types); $query->accountTypeIn($types);
} }
$query->orderBy('accounts.order', 'ASC'); $query->orderBy('accounts.order', 'ASC');
@@ -303,7 +303,7 @@ class AccountRepository implements AccountRepositoryInterface
$query->where('name', 'account_role'); $query->where('name', 'account_role');
}, 'attachments'] }, 'attachments']
); );
if (count($types) > 0) { if (!empty($types)) {
$query->accountTypeIn($types); $query->accountTypeIn($types);
} }
$query->where('active', 1); $query->where('active', 1);
@@ -572,7 +572,7 @@ class AccountRepository implements AccountRepositoryInterface
} }
} }
if (count($types) > 0) { if (!empty($types)) {
$dbQuery->leftJoin('account_types', 'accounts.account_type_id', '=', 'account_types.id'); $dbQuery->leftJoin('account_types', 'accounts.account_type_id', '=', 'account_types.id');
$dbQuery->whereIn('account_types.type', $types); $dbQuery->whereIn('account_types.type', $types);
} }
@@ -630,7 +630,7 @@ class AccountRepository implements AccountRepositoryInterface
$query->where('name', 'account_role'); $query->where('name', 'account_role');
}] }]
); );
if (count($types) > 0) { if (!empty($types)) {
$query->accountTypeIn($types); $query->accountTypeIn($types);
} }
$query->where('active', 0); $query->where('active', 0);
@@ -728,7 +728,7 @@ class AccountRepository implements AccountRepositoryInterface
}); });
} }
} }
if (count($types) > 0) { if (!empty($types)) {
$dbQuery->leftJoin('account_types', 'accounts.account_type_id', '=', 'account_types.id'); $dbQuery->leftJoin('account_types', 'accounts.account_type_id', '=', 'account_types.id');
$dbQuery->whereIn('account_types.type', $types); $dbQuery->whereIn('account_types.type', $types);
} }

View File

@@ -157,7 +157,6 @@ class BudgetRepository implements BudgetRepositoryInterface
*/ */
public function firstUseDate(Budget $budget): ?Carbon public function firstUseDate(Budget $budget): ?Carbon
{ {
$oldest = null;
$journal = $budget->transactionJournals()->orderBy('date', 'ASC')->first(); $journal = $budget->transactionJournals()->orderBy('date', 'ASC')->first();
if (null !== $journal) { if (null !== $journal) {
return $journal->date; return $journal->date;

View File

@@ -215,7 +215,6 @@ class JournalRepository implements JournalRepositoryInterface
*/ */
public function getLinkNoteText(TransactionJournalLink $link): string public function getLinkNoteText(TransactionJournalLink $link): string
{ {
$notes = null;
/** @var Note $note */ /** @var Note $note */
$note = $link->notes()->first(); $note = $link->notes()->first();
if (null !== $note) { if (null !== $note) {

View File

@@ -60,7 +60,6 @@ trait CreatesObjectGroups
*/ */
protected function findOrCreateObjectGroup(string $title): ?ObjectGroup protected function findOrCreateObjectGroup(string $title): ?ObjectGroup
{ {
$group = null;
$maxOrder = $this->getObjectGroupMaxOrder(); $maxOrder = $this->getObjectGroupMaxOrder();
if (!$this->hasObjectGroup($title)) { if (!$this->hasObjectGroup($title)) {
return ObjectGroup::create( return ObjectGroup::create(

View File

@@ -327,7 +327,7 @@ class RecurringRepository implements RecurringRepositoryInterface
foreach ($journalMeta as $journalId) { foreach ($journalMeta as $journalId) {
$search[] = (int)$journalId; $search[] = (int)$journalId;
} }
if (0 === count($search)) { if (empty($search)) {
return new Collection; return new Collection;
} }

View File

@@ -476,7 +476,6 @@ class TagRepository implements TagRepositoryInterface
*/ */
public function update(Tag $tag, array $data): Tag public function update(Tag $tag, array $data): Tag
{ {
$oldTag = $data['tag'];
$tag->tag = $data['tag']; $tag->tag = $data['tag'];
$tag->date = $data['date']; $tag->date = $data['date'];
$tag->description = $data['description']; $tag->description = $data['description'];

View File

@@ -275,7 +275,7 @@ trait RecurringTransactionTrait
*/ */
protected function updateTags(RecurrenceTransaction $transaction, array $tags): void protected function updateTags(RecurrenceTransaction $transaction, array $tags): void
{ {
if (count($tags) > 0) { if (!empty($tags)) {
/** @var RecurrenceMeta $entry */ /** @var RecurrenceMeta $entry */
$entry = $transaction->recurrenceTransactionMeta()->where('name', 'tags')->first(); $entry = $transaction->recurrenceTransactionMeta()->where('name', 'tags')->first();
if (null === $entry) { if (null === $entry) {
@@ -284,7 +284,7 @@ trait RecurringTransactionTrait
$entry->value = json_encode($tags); $entry->value = json_encode($tags);
$entry->save(); $entry->save();
} }
if (0 === count($tags)) { if (empty($tags)) {
// delete if present // delete if present
$transaction->recurrenceTransactionMeta()->where('name', 'tags')->delete(); $transaction->recurrenceTransactionMeta()->where('name', 'tags')->delete();
} }

View File

@@ -76,10 +76,6 @@ class JournalUpdateService
private $transactionGroup; private $transactionGroup;
/** @var TransactionJournal The journal to update. */ /** @var TransactionJournal The journal to update. */
private $transactionJournal; private $transactionJournal;
/** @var Account If new account info is submitted, this array will hold the valid destination. */
private $validDestination;
/** @var Account If new account info is submitted, this array will hold the valid source. */
private $validSource;
/** /**
* JournalUpdateService constructor. * JournalUpdateService constructor.

View File

@@ -41,8 +41,7 @@ class RecurrenceUpdateService
{ {
use TransactionTypeTrait, RecurringTransactionTrait; use TransactionTypeTrait, RecurringTransactionTrait;
/** @var User */ private User $user;
private $user;
/** /**
* Updates a recurrence. * Updates a recurrence.
@@ -99,7 +98,7 @@ class RecurrenceUpdateService
$this->createRepetitions($recurrence, $data['repetitions'] ?? []); $this->createRepetitions($recurrence, $data['repetitions'] ?? []);
} }
// update all transactions (and associated meta-data); // update all transactions (and associated meta-data)
if (null !== $data['transactions']) { if (null !== $data['transactions']) {
$this->deleteTransactions($recurrence); $this->deleteTransactions($recurrence);
$this->createTransactions($recurrence, $data['transactions'] ?? []); $this->createTransactions($recurrence, $data['transactions'] ?? []);

View File

@@ -57,8 +57,6 @@ class WholePeriodChartGenerator
public function generate(Category $category, Carbon $start, Carbon $end): array public function generate(Category $category, Carbon $start, Carbon $end): array
{ {
$collection = new Collection([$category]); $collection = new Collection([$category]);
/** @var CategoryRepositoryInterface $repository */
$repository = app(CategoryRepositoryInterface::class);
/** @var OperationsRepositoryInterface $opsRepository */ /** @var OperationsRepositoryInterface $opsRepository */
$opsRepository = app(OperationsRepositoryInterface::class); $opsRepository = app(OperationsRepositoryInterface::class);

View File

@@ -717,7 +717,7 @@ class ExportDataGenerator
*/ */
private function mergeTags(array $tags): string private function mergeTags(array $tags): string
{ {
if (0 === count($tags)) { if (empty($tags)) {
return ''; return '';
} }
$smol = []; $smol = [];

View File

@@ -129,7 +129,7 @@ trait RequestInformation
$triggers = []; $triggers = [];
$data = $request->get('triggers'); $data = $request->get('triggers');
if (is_array($data)) { if (is_array($data)) {
foreach ($data as $index => $triggerInfo) { foreach ($data as $triggerInfo) {
$triggers[] = [ $triggers[] = [
'type' => $triggerInfo['type'] ?? '', 'type' => $triggerInfo['type'] ?? '',
'value' => $triggerInfo['value'] ?? '', 'value' => $triggerInfo['value'] ?? '',

View File

@@ -154,9 +154,9 @@ class BudgetReportGenerator
*/ */
private function generalBudgetReport(): void private function generalBudgetReport(): void
{ {
$budgets = $this->repository->getBudgets(); $budgetList = $this->repository->getBudgets();
/** @var Budget $budget */ /** @var Budget $budget */
foreach ($budgets as $budget) { foreach ($budgetList as $budget) {
$this->processBudget($budget); $this->processBudget($budget);
} }
} }
@@ -192,14 +192,14 @@ class BudgetReportGenerator
*/ */
private function processLimit(Budget $budget, BudgetLimit $limit): void private function processLimit(Budget $budget, BudgetLimit $limit): void
{ {
$budgetId = (int)$budget->id; $budgetId = (int)$budget->id;
$limitId = (int)$limit->id; $limitId = (int)$limit->id;
$currency = $limit->transactionCurrency ?? $this->currency; $limitCurrency = $limit->transactionCurrency ?? $this->currency;
$currencyId = (int)$currency->id; $currencyId = (int)$limitCurrency->id;
$expenses = $this->opsRepository->sumExpenses($limit->start_date, $limit->end_date, $this->accounts, new Collection([$budget])); $expenses = $this->opsRepository->sumExpenses($limit->start_date, $limit->end_date, $this->accounts, new Collection([$budget]));
$spent = $expenses[$currencyId]['sum'] ?? '0'; $spent = $expenses[$currencyId]['sum'] ?? '0';
$left = -1 === bccomp(bcadd($limit->amount, $spent), '0') ? '0' : bcadd($limit->amount, $spent); $left = -1 === bccomp(bcadd($limit->amount, $spent), '0') ? '0' : bcadd($limit->amount, $spent);
$overspent = 1 === bccomp(bcmul($spent, '-1'), $limit->amount) ? bcadd($spent, $limit->amount) : '0'; $overspent = 1 === bccomp(bcmul($spent, '-1'), $limit->amount) ? bcadd($spent, $limit->amount) : '0';
$this->report['budgets'][$budgetId]['budget_limits'][$limitId] = $this->report['budgets'][$budgetId]['budget_limits'][$limitId] ?? [ $this->report['budgets'][$budgetId]['budget_limits'][$limitId] = $this->report['budgets'][$budgetId]['budget_limits'][$limitId] ?? [
'budget_limit_id' => $limitId, 'budget_limit_id' => $limitId,
@@ -212,10 +212,10 @@ class BudgetReportGenerator
'left' => $left, 'left' => $left,
'overspent' => $overspent, 'overspent' => $overspent,
'currency_id' => $currencyId, 'currency_id' => $currencyId,
'currency_code' => $currency->code, 'currency_code' => $limitCurrency->code,
'currency_name' => $currency->name, 'currency_name' => $limitCurrency->name,
'currency_symbol' => $currency->symbol, 'currency_symbol' => $limitCurrency->symbol,
'currency_decimal_places' => $currency->decimal_places, 'currency_decimal_places' => $limitCurrency->decimal_places,
]; ];
// make sum information: // make sum information:
@@ -226,10 +226,10 @@ class BudgetReportGenerator
'left' => '0', 'left' => '0',
'overspent' => '0', 'overspent' => '0',
'currency_id' => $currencyId, 'currency_id' => $currencyId,
'currency_code' => $currency->code, 'currency_code' => $limitCurrency->code,
'currency_name' => $currency->name, 'currency_name' => $limitCurrency->name,
'currency_symbol' => $currency->symbol, 'currency_symbol' => $limitCurrency->symbol,
'currency_decimal_places' => $currency->decimal_places, 'currency_decimal_places' => $limitCurrency->decimal_places,
]; ];
$this->report['sums'][$currencyId]['budgeted'] = bcadd($this->report['sums'][$currencyId]['budgeted'], $limit->amount); $this->report['sums'][$currencyId]['budgeted'] = bcadd($this->report['sums'][$currencyId]['budgeted'], $limit->amount);
$this->report['sums'][$currencyId]['spent'] = bcadd($this->report['sums'][$currencyId]['spent'], $spent); $this->report['sums'][$currencyId]['spent'] = bcadd($this->report['sums'][$currencyId]['spent'], $spent);

View File

@@ -36,14 +36,14 @@ $factory->state(TransactionJournal::class, 'ob_broken', function ($faker) {
$factory->afterCreatingState(TransactionJournal::class, TransactionType::OPENING_BALANCE, function ($journal, $faker) { $factory->afterCreatingState(TransactionJournal::class, TransactionType::OPENING_BALANCE, function ($journal, $faker) {
$obAccount = factory(Account::class)->state(AccountType::INITIAL_BALANCE)->create(); $obAccount = factory(Account::class)->state(AccountType::INITIAL_BALANCE)->create();
$assetAccount = factory(Account::class)->state(AccountType::ASSET)->create(); $assetAccount = factory(Account::class)->state(AccountType::ASSET)->create();
$sourceTransaction = factory(Transaction::class)->create( factory(Transaction::class)->create(
[ [
'account_id' => $obAccount->id, 'account_id' => $obAccount->id,
'transaction_journal_id' => $journal->id, 'transaction_journal_id' => $journal->id,
'amount' => '5', 'amount' => '5',
]); ]);
$destTransaction = factory(Transaction::class)->create( factory(Transaction::class)->create(
[ [
'account_id' => $assetAccount->id, 'account_id' => $assetAccount->id,
'transaction_journal_id' => $journal->id, 'transaction_journal_id' => $journal->id,
@@ -55,14 +55,14 @@ $factory->afterCreatingState(TransactionJournal::class, 'ob_broken', function ($
$ob1 = factory(Account::class)->state(AccountType::INITIAL_BALANCE)->create(); $ob1 = factory(Account::class)->state(AccountType::INITIAL_BALANCE)->create();
$ob2 = factory(Account::class)->state(AccountType::INITIAL_BALANCE)->create(); $ob2 = factory(Account::class)->state(AccountType::INITIAL_BALANCE)->create();
$sourceTransaction = factory(Transaction::class)->create( factory(Transaction::class)->create(
[ [
'account_id' => $ob1->id, 'account_id' => $ob1->id,
'transaction_journal_id' => $journal->id, 'transaction_journal_id' => $journal->id,
'amount' => '5', 'amount' => '5',
]); ]);
$destTransaction = factory(Transaction::class)->create( factory(Transaction::class)->create(
[ [
'account_id' => $ob2->id, 'account_id' => $ob2->id,
'transaction_journal_id' => $journal->id, 'transaction_journal_id' => $journal->id,

View File

@@ -43,7 +43,3 @@ export default {
name: "ProfileOptions" name: "ProfileOptions"
} }
</script> </script>
<style scoped>
</style>

View File

@@ -245,7 +245,3 @@ export default {
} }
} }
</script> </script>
<style scoped>
</style>

View File

@@ -151,7 +151,3 @@ export default {
} }
} }
</script> </script>
<style scoped>
</style>

View File

@@ -106,7 +106,3 @@ export default {
} }
} }
</script> </script>
<style scoped>
</style>

View File

@@ -105,7 +105,3 @@ export default {
} }
} }
</script> </script>
<style scoped>
</style>

View File

@@ -168,7 +168,3 @@ export default {
} }
} }
</script> </script>
<style scoped>
</style>

View File

@@ -72,7 +72,3 @@ export default {
} }
} }
</script> </script>
<style scoped>
</style>

View File

@@ -72,7 +72,3 @@ export default {
} }
} }
</script> </script>
<style scoped>
</style>

View File

@@ -131,7 +131,3 @@ export default {
} }
} }
</script> </script>
<style scoped>
</style>

View File

@@ -71,7 +71,3 @@ export default {
} }
} }
</script> </script>
<style scoped>
</style>

View File

@@ -1046,7 +1046,3 @@ export default {
} }
} }
</script> </script>
<style scoped>
</style>

View File

@@ -213,7 +213,3 @@ export default {
} }
} }
</script> </script>
<style scoped>
</style>

View File

@@ -73,7 +73,3 @@ export default {
} }
} }
</script> </script>
<style scoped>
</style>

View File

@@ -116,7 +116,3 @@ export default {
} }
} }
</script> </script>
<style scoped>
</style>

View File

@@ -75,7 +75,3 @@ export default {
} }
} }
</script> </script>
<style scoped>
</style>

View File

@@ -105,7 +105,3 @@ export default {
}, },
} }
</script> </script>
<style scoped>
</style>

View File

@@ -155,7 +155,3 @@ export default {
} }
} }
</script> </script>
<style scoped>
</style>

View File

@@ -84,7 +84,3 @@ export default {
name: "TransactionType" name: "TransactionType"
} }
</script> </script>
<style scoped>
</style>

View File

@@ -176,7 +176,7 @@
{# Moment JS #} {# Moment JS #}
<script src="v1/js/lib/moment.min.js?v={{ FF_VERSION }}" type="text/javascript" nonce="{{ JS_NONCE }}"></script> <script src="v1/js/lib/moment.min.js?v={{ FF_VERSION }}" type="text/javascript" nonce="{{ JS_NONCE }}"></script>
<script src="v1/js/ff/moment/{{ language }}.js?v={{ FF_VERSION }}" type="text/javascript" nonce="{{ JS_NONCE }}"></script> <script src="v1/js/lib/moment/{{ language }}.js?v={{ FF_VERSION }}" type="text/javascript" nonce="{{ JS_NONCE }}"></script>
{# All kinds of variables. #} {# All kinds of variables. #}
<script src="{{ route('javascript.variables') }}?ext=.js&amp;v={{ FF_VERSION }}{% if account %}&amp;account={{ account.id }}{% endif %}" type="text/javascript" nonce="{{ JS_NONCE }}"></script> <script src="{{ route('javascript.variables') }}?ext=.js&amp;v={{ FF_VERSION }}{% if account %}&amp;account={{ account.id }}{% endif %}" type="text/javascript" nonce="{{ JS_NONCE }}"></script>

View File

@@ -1143,7 +1143,7 @@ try {
Breadcrumbs::register( Breadcrumbs::register(
'transactions.mass.edit', 'transactions.mass.edit',
static function (BreadcrumbsGenerator $breadcrumbs, array $journals): void { static function (BreadcrumbsGenerator $breadcrumbs, array $journals): void {
if (count($journals) > 0) { if (!empty($journals)) {
$objectType = strtolower(reset($journals)['transaction_type_type']); $objectType = strtolower(reset($journals)['transaction_type_type']);
$breadcrumbs->parent('transactions.index', $objectType); $breadcrumbs->parent('transactions.index', $objectType);
$breadcrumbs->push(trans('firefly.mass_edit_journals'), route('transactions.mass.edit', [''])); $breadcrumbs->push(trans('firefly.mass_edit_journals'), route('transactions.mass.edit', ['']));
@@ -1167,7 +1167,7 @@ try {
Breadcrumbs::register( Breadcrumbs::register(
'transactions.bulk.edit', 'transactions.bulk.edit',
static function (BreadcrumbsGenerator $breadcrumbs, array $journals): void { static function (BreadcrumbsGenerator $breadcrumbs, array $journals): void {
if (count($journals) > 0) { if (!empty($journals)) {
$ids = Arr::pluck($journals, 'transaction_journal_id'); $ids = Arr::pluck($journals, 'transaction_journal_id');
$first = reset($journals); $first = reset($journals);
$breadcrumbs->parent('transactions.index', strtolower($first['transaction_type_type'])); $breadcrumbs->parent('transactions.index', strtolower($first['transaction_type_type']));

View File

@@ -59,7 +59,7 @@ class CorrectOpeningBalanceCurrenciesTest extends TestCase
public function testHandleBroken(): void public function testHandleBroken(): void
{ {
// create opening balance journal for test. Is enough to trigger this test. // create opening balance journal for test. Is enough to trigger this test.
$journal = factory(TransactionJournal::class)->state(TransactionType::OPENING_BALANCE)->create(); factory(TransactionJournal::class)->state(TransactionType::OPENING_BALANCE)->create();
// run command // run command
$this->artisan('firefly-iii:fix-ob-currencies') $this->artisan('firefly-iii:fix-ob-currencies')

View File

@@ -300,7 +300,6 @@ class FixAccountTypesTest extends TestCase
$newSource = $this->getRandomRevenue(); $newSource = $this->getRandomRevenue();
$destination = $this->getRandomAsset(); $destination = $this->getRandomAsset();
$withdrawal = TransactionType::where('type', TransactionType::WITHDRAWAL)->first();
$deposit = TransactionType::where('type', TransactionType::DEPOSIT)->first(); $deposit = TransactionType::where('type', TransactionType::DEPOSIT)->first();
$journal = TransactionJournal::create( $journal = TransactionJournal::create(
[ [

View File

@@ -34,14 +34,7 @@ class FixTransactionTypesTest extends TestCase
*/ */
public function testHandle(): void public function testHandle(): void
{ {
$this->markTestIncomplete();
$this->artisan('firefly-iii:fix-transaction-types')
->expectsOutput(sprintf('Recurring transaction #%d should be a "%s" but is a "%s" and will be corrected.',
1, 'Withdrawal','Transfer',
))
->assertExitCode(0);
} }

View File

@@ -34,7 +34,7 @@ use Tests\Traits\TestHelpers;
*/ */
abstract class TestCase extends BaseTestCase abstract class TestCase extends BaseTestCase
{ {
use CreatesApplication, CollectsValues;//, MocksDefaultValues, TestHelpers, ; use CreatesApplication, CollectsValues; // MocksDefaultValues TestHelpers
/** /**
* @return array * @return array