From 57dcdfa0c48794d3bd1d834532dfdcd17aa9630c Mon Sep 17 00:00:00 2001 From: James Cole Date: Wed, 15 Nov 2017 11:33:07 +0100 Subject: [PATCH] Code clean up. --- .../Report/Tag/MonthReportGenerator.php | 6 +- app/Helpers/Collector/JournalCollector.php | 4 +- .../Account/ReconcileController.php | 6 +- app/Http/Controllers/AccountController.php | 4 +- app/Http/Controllers/Auth/LoginController.php | 8 +- .../Controllers/Auth/RegisterController.php | 6 +- app/Http/Controllers/BudgetController.php | 8 +- app/Http/Controllers/HomeController.php | 4 +- app/Http/Controllers/PiggyBankController.php | 30 +++---- app/Http/Controllers/ReportController.php | 60 ++++++------- app/Http/Controllers/RuleController.php | 6 +- app/Http/breadcrumbs.php | 84 ++++++++++--------- app/Import/Routine/ImportRoutine.php | 1 + app/Import/Storage/ImportSupport.php | 8 +- app/Repositories/Journal/JournalTasker.php | 8 +- app/Support/Twig/AmountFormat.php | 8 +- app/Support/Twig/Extension/Transaction.php | 4 +- app/Support/Twig/General.php | 22 ++--- app/Support/Twig/Journal.php | 10 +-- app/Support/Twig/Rule.php | 6 +- app/TransactionRules/Actions/SetBudget.php | 4 +- config/auth.php | 12 +-- config/broadcasting.php | 10 +-- config/cache.php | 20 ++--- config/queue.php | 24 +++--- config/services.php | 6 +- config/twigbridge.php | 2 +- config/upgrade.php | 4 +- public/css/firefly.css | 2 +- public/css/google-fonts.css | 48 +++++++++++ public/index.php | 4 +- public/js/ff/export/index.js | 2 +- public/js/ff/intro/intro.js | 2 +- public/js/ff/rules/index.js | 2 +- public/js/ff/tags/show.js | 11 ++- public/js/ff/transactions/show.js | 2 +- tests/CreatesApplication.php | 2 +- .../Controllers/BudgetControllerTest.php | 2 +- .../Controllers/ExportControllerTest.php | 2 +- .../Controllers/JsonControllerTest.php | 5 -- .../Transaction/SingleControllerTest.php | 2 +- tests/Feature/ExampleTest.php | 1 - tests/Unit/ExampleTest.php | 1 - .../Actions/ClearCategoryTest.php | 3 +- .../Actions/PrependDescriptionTest.php | 4 +- .../Actions/SetDestinationAccountTest.php | 1 + .../TransactionRules/Actions/SetNotesTest.php | 1 - .../Triggers/AmountLessTest.php | 24 +++--- .../Triggers/DescriptionContainsTest.php | 25 +++--- .../Triggers/DescriptionEndsTest.php | 19 ++--- .../Triggers/DescriptionIsTest.php | 13 ++- .../Triggers/DescriptionStartsTest.php | 19 ++--- .../Triggers/FromAccountIsTest.php | 21 +++-- .../Triggers/FromAccountStartsTest.php | 2 +- .../Triggers/HasAnyTagTest.php | 4 +- .../Triggers/NotesAreTest.php | 32 +++---- .../Triggers/NotesContainTest.php | 64 +++++++------- .../TransactionRules/Triggers/TagIsTest.php | 28 +++---- .../Triggers/ToAccountIsTest.php | 20 ++--- .../Triggers/ToAccountStartsTest.php | 2 +- 60 files changed, 398 insertions(+), 347 deletions(-) diff --git a/app/Generator/Report/Tag/MonthReportGenerator.php b/app/Generator/Report/Tag/MonthReportGenerator.php index 9abd0af38d..cffaf129a6 100644 --- a/app/Generator/Report/Tag/MonthReportGenerator.php +++ b/app/Generator/Report/Tag/MonthReportGenerator.php @@ -89,7 +89,7 @@ class MonthReportGenerator extends Support implements ReportGeneratorInterface return view( 'reports.tag.month', compact( - 'accountIds', + 'accountIds', 'tagTags', 'reportType', 'accountSummary', @@ -97,8 +97,8 @@ class MonthReportGenerator extends Support implements ReportGeneratorInterface 'averageExpenses', 'averageIncome', 'topIncome', - 'topExpenses' - ) + 'topExpenses' + ) )->with('start', $this->start)->with('end', $this->end)->with('tags', $this->tags)->with('accounts', $this->accounts)->render(); } diff --git a/app/Helpers/Collector/JournalCollector.php b/app/Helpers/Collector/JournalCollector.php index 2a281c1a9b..39e31ba888 100644 --- a/app/Helpers/Collector/JournalCollector.php +++ b/app/Helpers/Collector/JournalCollector.php @@ -785,8 +785,8 @@ class JournalCollector implements JournalCollectorInterface 'transactions as opposing', function (JoinClause $join) { $join->on('opposing.transaction_journal_id', '=', 'transactions.transaction_journal_id') - ->where('opposing.identifier', '=', DB::raw('transactions.identifier')) - ->where('opposing.amount', '=', DB::raw('transactions.amount * -1')); + ->where('opposing.identifier', '=', DB::raw('transactions.identifier')) + ->where('opposing.amount', '=', DB::raw('transactions.amount * -1')); } ); $this->query->leftJoin('accounts as opposing_accounts', 'opposing.account_id', '=', 'opposing_accounts.id'); diff --git a/app/Http/Controllers/Account/ReconcileController.php b/app/Http/Controllers/Account/ReconcileController.php index 0d5f9a58cb..d0c1d1234c 100644 --- a/app/Http/Controllers/Account/ReconcileController.php +++ b/app/Http/Controllers/Account/ReconcileController.php @@ -132,7 +132,7 @@ class ReconcileController extends Controller return view( 'accounts.reconcile.index', compact( - 'account', + 'account', 'currency', 'subTitleIcon', 'start', @@ -141,11 +141,11 @@ class ReconcileController extends Controller 'startBalance', 'endBalance', 'transactionsUri', - 'selectionStart', + 'selectionStart', 'selectionEnd', 'overviewUri', 'indexUri' - ) + ) ); } diff --git a/app/Http/Controllers/AccountController.php b/app/Http/Controllers/AccountController.php index 0162b01c55..1880401794 100644 --- a/app/Http/Controllers/AccountController.php +++ b/app/Http/Controllers/AccountController.php @@ -209,7 +209,7 @@ class AccountController extends Controller return view( 'accounts.edit', compact( - 'allCurrencies', + 'allCurrencies', 'currencySelectList', 'account', 'currency', @@ -218,7 +218,7 @@ class AccountController extends Controller 'what', 'roles', 'preFilled' - ) + ) ); } diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php index f6f1a986a5..2d958b0d94 100644 --- a/app/Http/Controllers/Auth/LoginController.php +++ b/app/Http/Controllers/Auth/LoginController.php @@ -85,14 +85,18 @@ class LoginController extends Controller $hasTable = Schema::hasTable('users'); if (!$hasTable) { - $message = 'Firefly III could not find the "users" table. This is a strong indication your database credentials are wrong or the database has not been initialized. Did you follow the installation instructions correctly?'; + $message + = 'Firefly III could not find the "users" table. This is a strong indication your database credentials are wrong or the database has not been initialized. Did you follow the installation instructions correctly?'; + return view('error', compact('message')); } // check for presence of currency: $currency = TransactionCurrency::where('code', 'EUR')->first(); if (is_null($currency)) { - $message = 'Firefly III could not find the EURO currency. This is a strong indication the database has not been initialized correctly. Did you follow the installation instructions?'; + $message + = 'Firefly III could not find the EURO currency. This is a strong indication the database has not been initialized correctly. Did you follow the installation instructions?'; + return view('error', compact('message')); } diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php index 8bea5e15da..b539028c8d 100644 --- a/app/Http/Controllers/Auth/RegisterController.php +++ b/app/Http/Controllers/Auth/RegisterController.php @@ -160,9 +160,9 @@ class RegisterController extends Controller return Validator::make( $data, [ - 'email' => 'required|string|email|max:255|unique:users', - 'password' => 'required|string|secure_password|confirmed', - ] + 'email' => 'required|string|email|max:255|unique:users', + 'password' => 'required|string|secure_password|confirmed', + ] ); } } diff --git a/app/Http/Controllers/BudgetController.php b/app/Http/Controllers/BudgetController.php index fdcfc77ec6..9f0d5a0519 100644 --- a/app/Http/Controllers/BudgetController.php +++ b/app/Http/Controllers/BudgetController.php @@ -455,10 +455,10 @@ class BudgetController extends Controller $subTitle = trans( 'firefly.budget_in_period', [ - 'name' => $budget->name, - 'start' => $budgetLimit->start_date->formatLocalized($this->monthAndDayFormat), - 'end' => $budgetLimit->end_date->formatLocalized($this->monthAndDayFormat), - ] + 'name' => $budget->name, + 'start' => $budgetLimit->start_date->formatLocalized($this->monthAndDayFormat), + 'end' => $budgetLimit->end_date->formatLocalized($this->monthAndDayFormat), + ] ); // collector: diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index e6f754dc3e..8f8c8f6be5 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -123,7 +123,7 @@ class HomeController extends Controller return view( 'debug', compact( - 'phpVersion', + 'phpVersion', 'extensions', 'carbon', 'now', @@ -136,7 +136,7 @@ class HomeController extends Controller 'isDocker', 'isSandstorm', 'trustedProxies' - ) + ) ); } diff --git a/app/Http/Controllers/PiggyBankController.php b/app/Http/Controllers/PiggyBankController.php index 1d092b25b5..35fe50d4ae 100644 --- a/app/Http/Controllers/PiggyBankController.php +++ b/app/Http/Controllers/PiggyBankController.php @@ -291,11 +291,11 @@ class PiggyBankController extends Controller Session::flash( 'success', strval( - trans( - 'firefly.added_amount_to_piggy', - ['amount' => app('amount')->formatAnything($currency, $amount, false), 'name' => $piggyBank->name] - ) - ) + trans( + 'firefly.added_amount_to_piggy', + ['amount' => app('amount')->formatAnything($currency, $amount, false), 'name' => $piggyBank->name] + ) + ) ); Preferences::mark(); @@ -306,11 +306,11 @@ class PiggyBankController extends Controller Session::flash( 'error', strval( - trans( - 'firefly.cannot_add_amount_piggy', - ['amount' => app('amount')->formatAnything($currency, $amount, false), 'name' => $piggyBank->name] - ) - ) + trans( + 'firefly.cannot_add_amount_piggy', + ['amount' => app('amount')->formatAnything($currency, $amount, false), 'name' => $piggyBank->name] + ) + ) ); return redirect(route('piggy-banks.index')); @@ -348,11 +348,11 @@ class PiggyBankController extends Controller Session::flash( 'error', strval( - trans( - 'firefly.cannot_remove_from_piggy', - ['amount' => app('amount')->formatAnything($currency, $amount, false), 'name' => $piggyBank->name] - ) - ) + trans( + 'firefly.cannot_remove_from_piggy', + ['amount' => app('amount')->formatAnything($currency, $amount, false), 'name' => $piggyBank->name] + ) + ) ); return redirect(route('piggy-banks.index')); diff --git a/app/Http/Controllers/ReportController.php b/app/Http/Controllers/ReportController.php index 1b5a9fb89f..3193cad81e 100644 --- a/app/Http/Controllers/ReportController.php +++ b/app/Http/Controllers/ReportController.php @@ -90,12 +90,12 @@ class ReportController extends Controller View::share( 'subTitle', trans( - 'firefly.report_audit', - [ - 'start' => $start->formatLocalized($this->monthFormat), - 'end' => $end->formatLocalized($this->monthFormat), - ] - ) + 'firefly.report_audit', + [ + 'start' => $start->formatLocalized($this->monthFormat), + 'end' => $end->formatLocalized($this->monthFormat), + ] + ) ); @@ -126,12 +126,12 @@ class ReportController extends Controller View::share( 'subTitle', trans( - 'firefly.report_budget', - [ - 'start' => $start->formatLocalized($this->monthFormat), - 'end' => $end->formatLocalized($this->monthFormat), - ] - ) + 'firefly.report_budget', + [ + 'start' => $start->formatLocalized($this->monthFormat), + 'end' => $end->formatLocalized($this->monthFormat), + ] + ) ); $generator = ReportGeneratorFactory::reportGenerator('Budget', $start, $end); @@ -162,12 +162,12 @@ class ReportController extends Controller View::share( 'subTitle', trans( - 'firefly.report_category', - [ - 'start' => $start->formatLocalized($this->monthFormat), - 'end' => $end->formatLocalized($this->monthFormat), - ] - ) + 'firefly.report_category', + [ + 'start' => $start->formatLocalized($this->monthFormat), + 'end' => $end->formatLocalized($this->monthFormat), + ] + ) ); $generator = ReportGeneratorFactory::reportGenerator('Category', $start, $end); @@ -198,12 +198,12 @@ class ReportController extends Controller View::share( 'subTitle', trans( - 'firefly.report_default', - [ - 'start' => $start->formatLocalized($this->monthFormat), - 'end' => $end->formatLocalized($this->monthFormat), - ] - ) + 'firefly.report_default', + [ + 'start' => $start->formatLocalized($this->monthFormat), + 'end' => $end->formatLocalized($this->monthFormat), + ] + ) ); $generator = ReportGeneratorFactory::reportGenerator('Standard', $start, $end); @@ -344,12 +344,12 @@ class ReportController extends Controller View::share( 'subTitle', trans( - 'firefly.report_tag', - [ - 'start' => $start->formatLocalized($this->monthFormat), - 'end' => $end->formatLocalized($this->monthFormat), - ] - ) + 'firefly.report_tag', + [ + 'start' => $start->formatLocalized($this->monthFormat), + 'end' => $end->formatLocalized($this->monthFormat), + ] + ) ); $generator = ReportGeneratorFactory::reportGenerator('Tag', $start, $end); diff --git a/app/Http/Controllers/RuleController.php b/app/Http/Controllers/RuleController.php index 12a30e77ed..5335f1a70e 100644 --- a/app/Http/Controllers/RuleController.php +++ b/app/Http/Controllers/RuleController.php @@ -213,15 +213,15 @@ class RuleController extends Controller return view( 'rules.rule.edit', compact( - 'rule', + 'rule', 'subTitle', - 'primaryTrigger', + 'primaryTrigger', 'oldTriggers', 'oldActions', 'triggerCount', 'actionCount', 'ruleGroups' - ) + ) ); } diff --git a/app/Http/breadcrumbs.php b/app/Http/breadcrumbs.php index 3dac647c08..ff2b8e7227 100644 --- a/app/Http/breadcrumbs.php +++ b/app/Http/breadcrumbs.php @@ -94,10 +94,10 @@ Breadcrumbs::register( // when is specific period or when empty: if ($moment !== 'all' && $moment !== '(nothing)') { $title = trans( - 'firefly.between_dates_breadcrumb', - ['start' => $start->formatLocalized(strval(trans('config.month_and_day'))), - 'end' => $end->formatLocalized(strval(trans('config.month_and_day')))] - ); + 'firefly.between_dates_breadcrumb', + ['start' => $start->formatLocalized(strval(trans('config.month_and_day'))), + 'end' => $end->formatLocalized(strval(trans('config.month_and_day')))] + ); $breadcrumbs->push($title, route('accounts.show', [$account->id, $moment, $start, $end])); } } @@ -344,10 +344,10 @@ Breadcrumbs::register( // when is specific period or when empty: if ($moment !== 'all' && $moment !== '(nothing)') { $title = trans( - 'firefly.between_dates_breadcrumb', - ['start' => $start->formatLocalized(strval(trans('config.month_and_day'))), - 'end' => $end->formatLocalized(strval(trans('config.month_and_day')))] - ); + 'firefly.between_dates_breadcrumb', + ['start' => $start->formatLocalized(strval(trans('config.month_and_day'))), + 'end' => $end->formatLocalized(strval(trans('config.month_and_day')))] + ); $breadcrumbs->push($title, route('budgets.no-budget', [$moment])); } } @@ -369,15 +369,15 @@ Breadcrumbs::register( $breadcrumbs->push(e($budget->name), route('budgets.show', [$budget->id])); $title = trans( - 'firefly.between_dates_breadcrumb', - ['start' => $budgetLimit->start_date->formatLocalized(strval(trans('config.month_and_day'))), - 'end' => $budgetLimit->end_date->formatLocalized(strval(trans('config.month_and_day'))),] - ); + 'firefly.between_dates_breadcrumb', + ['start' => $budgetLimit->start_date->formatLocalized(strval(trans('config.month_and_day'))), + 'end' => $budgetLimit->end_date->formatLocalized(strval(trans('config.month_and_day'))),] + ); $breadcrumbs->push( - $title, - route('budgets.show.limit', [$budget->id, $budgetLimit->id]) - ); + $title, + route('budgets.show.limit', [$budget->id, $budgetLimit->id]) + ); } ); @@ -427,10 +427,10 @@ Breadcrumbs::register( // when is specific period or when empty: if ($moment !== 'all' && $moment !== '(nothing)') { $title = trans( - 'firefly.between_dates_breadcrumb', - ['start' => $start->formatLocalized(strval(trans('config.month_and_day'))), - 'end' => $end->formatLocalized(strval(trans('config.month_and_day')))] - ); + 'firefly.between_dates_breadcrumb', + ['start' => $start->formatLocalized(strval(trans('config.month_and_day'))), + 'end' => $end->formatLocalized(strval(trans('config.month_and_day')))] + ); $breadcrumbs->push($title, route('categories.show', [$category->id, $moment])); } } @@ -450,10 +450,10 @@ Breadcrumbs::register( // when is specific period or when empty: if ($moment !== 'all' && $moment !== '(nothing)') { $title = trans( - 'firefly.between_dates_breadcrumb', - ['start' => $start->formatLocalized(strval(trans('config.month_and_day'))), - 'end' => $end->formatLocalized(strval(trans('config.month_and_day')))] - ); + 'firefly.between_dates_breadcrumb', + ['start' => $start->formatLocalized(strval(trans('config.month_and_day'))), + 'end' => $end->formatLocalized(strval(trans('config.month_and_day')))] + ); $breadcrumbs->push($title, route('categories.no-category', [$moment])); } } @@ -559,9 +559,9 @@ Breadcrumbs::register( function (BreadCrumbGenerator $breadcrumbs, PiggyBank $piggyBank) { $breadcrumbs->parent('piggy-banks.show', $piggyBank); $breadcrumbs->push( - trans('firefly.remove_money_from_piggy_title', ['name' => $piggyBank->name]), - route('piggy-banks.remove-money-mobile', [$piggyBank->id]) - ); + trans('firefly.remove_money_from_piggy_title', ['name' => $piggyBank->name]), + route('piggy-banks.remove-money-mobile', [$piggyBank->id]) + ); } ); @@ -795,7 +795,9 @@ Breadcrumbs::register( 'rule-groups.select-transactions', function (BreadCrumbGenerator $breadcrumbs, RuleGroup $ruleGroup) { $breadcrumbs->parent('rules.index'); - $breadcrumbs->push(trans('firefly.rule_group_select_transactions', ['title' => $ruleGroup->title]), route('rule-groups.select-transactions', [$ruleGroup])); + $breadcrumbs->push( + trans('firefly.rule_group_select_transactions', ['title' => $ruleGroup->title]), route('rule-groups.select-transactions', [$ruleGroup]) + ); } ); @@ -804,9 +806,9 @@ Breadcrumbs::register( function (BreadCrumbGenerator $breadcrumbs, RuleGroup $ruleGroup) { $breadcrumbs->parent('rules.index'); $breadcrumbs->push( - trans('firefly.execute_group_on_existing_transactions', ['title' => $ruleGroup->title]), - route('rule-groups.select_transactions', [$ruleGroup]) - ); + trans('firefly.execute_group_on_existing_transactions', ['title' => $ruleGroup->title]), + route('rule-groups.select_transactions', [$ruleGroup]) + ); } ); @@ -870,10 +872,10 @@ Breadcrumbs::register( // when is specific period or when empty: if ($moment !== 'all' && $moment !== '(nothing)') { $title = trans( - 'firefly.between_dates_breadcrumb', - ['start' => $start->formatLocalized(strval(trans('config.month_and_day'))), - 'end' => $end->formatLocalized(strval(trans('config.month_and_day')))] - ); + 'firefly.between_dates_breadcrumb', + ['start' => $start->formatLocalized(strval(trans('config.month_and_day'))), + 'end' => $end->formatLocalized(strval(trans('config.month_and_day')))] + ); $breadcrumbs->push($title, route('tags.show', [$tag->id, $moment])); } } @@ -894,10 +896,10 @@ Breadcrumbs::register( // when is specific period or when empty: if ($moment !== 'all' && $moment !== '(nothing)') { $title = trans( - 'firefly.between_dates_breadcrumb', - ['start' => $start->formatLocalized(strval(trans('config.month_and_day'))), - 'end' => $end->formatLocalized(strval(trans('config.month_and_day')))] - ); + 'firefly.between_dates_breadcrumb', + ['start' => $start->formatLocalized(strval(trans('config.month_and_day'))), + 'end' => $end->formatLocalized(strval(trans('config.month_and_day')))] + ); $breadcrumbs->push($title, route('transactions.index', [$what, $moment])); } } @@ -940,9 +942,9 @@ Breadcrumbs::register( function (BreadCrumbGenerator $breadcrumbs, TransactionType $destinationType, TransactionJournal $journal) { $breadcrumbs->parent('transactions.show', $journal); $breadcrumbs->push( - trans('firefly.convert_to_' . $destinationType->type, ['description' => $journal->description]), - route('transactions.convert.index', [strtolower($destinationType->type), $journal->id]) - ); + trans('firefly.convert_to_' . $destinationType->type, ['description' => $journal->description]), + route('transactions.convert.index', [strtolower($destinationType->type), $journal->id]) + ); } ); diff --git a/app/Import/Routine/ImportRoutine.php b/app/Import/Routine/ImportRoutine.php index 304fd3a09e..9fe520e137 100644 --- a/app/Import/Routine/ImportRoutine.php +++ b/app/Import/Routine/ImportRoutine.php @@ -140,6 +140,7 @@ class ImportRoutine if ($this->journals->count() < 1) { Log::info(sprintf('Will not create tag, %d journals imported.', $this->journals->count())); + return new Tag; } diff --git a/app/Import/Storage/ImportSupport.php b/app/Import/Storage/ImportSupport.php index 99ed36614a..b594d27ee8 100644 --- a/app/Import/Storage/ImportSupport.php +++ b/app/Import/Storage/ImportSupport.php @@ -277,10 +277,10 @@ trait ImportSupport 'transactions AS destination', function (JoinClause $join) { $join->on('transaction_journals.id', '=', 'destination.transaction_journal_id')->where( - 'destination.amount', - '>', - 0 - ); + 'destination.amount', + '>', + 0 + ); } ) ->leftJoin('accounts as source_accounts', 'source.account_id', '=', 'source_accounts.id') diff --git a/app/Repositories/Journal/JournalTasker.php b/app/Repositories/Journal/JournalTasker.php index 31fb04e1cb..a0a3928d2a 100644 --- a/app/Repositories/Journal/JournalTasker.php +++ b/app/Repositories/Journal/JournalTasker.php @@ -89,10 +89,10 @@ class JournalTasker implements JournalTaskerInterface 'transactions as destination', function (JoinClause $join) { $join - ->on('transactions.transaction_journal_id', '=', 'destination.transaction_journal_id') - ->where('transactions.amount', '=', DB::raw('destination.amount * -1')) - ->where('transactions.identifier', '=', DB::raw('destination.identifier')) - ->whereNull('destination.deleted_at'); + ->on('transactions.transaction_journal_id', '=', 'destination.transaction_journal_id') + ->where('transactions.amount', '=', DB::raw('destination.amount * -1')) + ->where('transactions.identifier', '=', DB::raw('destination.identifier')) + ->whereNull('destination.deleted_at'); } ) ->with(['budgets', 'categories']) diff --git a/app/Support/Twig/AmountFormat.php b/app/Support/Twig/AmountFormat.php index 45f30556f2..cd2c528e3c 100644 --- a/app/Support/Twig/AmountFormat.php +++ b/app/Support/Twig/AmountFormat.php @@ -176,7 +176,7 @@ class AmountFormat extends Twig_Extension 'formatDestinationAfter', function (array $transaction): string { - // build fake currency for main amount. + // build fake currency for main amount. $format = new TransactionCurrency; $format->decimal_places = $transaction['transaction_currency_dp']; $format->symbol = $transaction['transaction_currency_symbol']; @@ -207,7 +207,7 @@ class AmountFormat extends Twig_Extension 'formatDestinationBefore', function (array $transaction): string { - // build fake currency for main amount. + // build fake currency for main amount. $format = new TransactionCurrency; $format->decimal_places = $transaction['transaction_currency_dp']; $format->symbol = $transaction['transaction_currency_symbol']; @@ -227,7 +227,7 @@ class AmountFormat extends Twig_Extension 'formatSourceAfter', function (array $transaction): string { - // build fake currency for main amount. + // build fake currency for main amount. $format = new TransactionCurrency; $format->decimal_places = $transaction['transaction_currency_dp']; $format->symbol = $transaction['transaction_currency_symbol']; @@ -258,7 +258,7 @@ class AmountFormat extends Twig_Extension 'formatSourceBefore', function (array $transaction): string { - // build fake currency for main amount. + // build fake currency for main amount. $format = new TransactionCurrency; $format->decimal_places = $transaction['transaction_currency_dp']; $format->symbol = $transaction['transaction_currency_symbol']; diff --git a/app/Support/Twig/Extension/Transaction.php b/app/Support/Twig/Extension/Transaction.php index 8bcde09923..b9d9816859 100644 --- a/app/Support/Twig/Extension/Transaction.php +++ b/app/Support/Twig/Extension/Transaction.php @@ -310,7 +310,7 @@ class Transaction extends Twig_Extension $other = TransactionModel::where('transaction_journal_id', $journalId)->where('transactions.id', '!=', $transaction->id) ->where('amount', '=', bcmul($transaction->transaction_amount, '-1'))->where( 'identifier', - $transaction->identifier + $transaction->identifier ) ->leftJoin('accounts', 'accounts.id', '=', 'transactions.account_id') ->leftJoin('account_types', 'account_types.id', '=', 'accounts.account_type_id') @@ -489,7 +489,7 @@ class Transaction extends Twig_Extension $other = TransactionModel::where('transaction_journal_id', $journalId)->where('transactions.id', '!=', $transaction->id) ->where('amount', '=', bcmul($transaction->transaction_amount, '-1'))->where( 'identifier', - $transaction->identifier + $transaction->identifier ) ->leftJoin('accounts', 'accounts.id', '=', 'transactions.account_id') ->leftJoin('account_types', 'account_types.id', '=', 'accounts.account_type_id') diff --git a/app/Support/Twig/General.php b/app/Support/Twig/General.php index b2d04de926..9b8d524a0b 100644 --- a/app/Support/Twig/General.php +++ b/app/Support/Twig/General.php @@ -118,8 +118,8 @@ class General extends Twig_Extension function ($context): string { $args = func_get_args(); $route = $args[1]; // name of the route. - $what = $args[2]; // name of the route. - $activeWhat = $context['what'] ?? false; + $what = $args[2]; // name of the route. + $activeWhat = $context['what'] ?? false; if ($what === $activeWhat && !(strpos(Route::getCurrentRoute()->getName(), $route) === false)) { return 'active'; @@ -194,7 +194,7 @@ class General extends Twig_Extension 'filesize', function (int $size): string { - // less than one GB, more than one MB + // less than one GB, more than one MB if ($size < (1024 * 1024 * 2014) && $size >= (1024 * 1024)) { return round($size / (1024 * 1024), 2) . ' MB'; } @@ -245,14 +245,14 @@ class General extends Twig_Extension 'mimeIcon', function (string $string): string { switch ($string) { - default: - return 'fa-file-o'; - case 'application/pdf': - return 'fa-file-pdf-o'; - case 'image/png': - case 'image/jpeg': - return 'fa-file-image-o'; - } + default: + return 'fa-file-o'; + case 'application/pdf': + return 'fa-file-pdf-o'; + case 'image/png': + case 'image/jpeg': + return 'fa-file-image-o'; + } }, ['is_safe' => ['html']] ); diff --git a/app/Support/Twig/Journal.php b/app/Support/Twig/Journal.php index 3998ba15ec..808bf2199d 100644 --- a/app/Support/Twig/Journal.php +++ b/app/Support/Twig/Journal.php @@ -207,11 +207,11 @@ class Journal extends Twig_Extension } if (count($categories) === 0) { $set = Category::distinct()->leftJoin('category_transaction', 'categories.id', '=', 'category_transaction.category_id') - ->leftJoin('transactions', 'category_transaction.transaction_id', '=', 'transactions.id') - ->leftJoin('transaction_journals', 'transactions.transaction_journal_id', '=', 'transaction_journals.id') - ->where('categories.user_id', $journal->user_id) - ->where('transaction_journals.id', $journal->id) - ->get(['categories.*']); + ->leftJoin('transactions', 'category_transaction.transaction_id', '=', 'transactions.id') + ->leftJoin('transaction_journals', 'transactions.transaction_journal_id', '=', 'transaction_journals.id') + ->where('categories.user_id', $journal->user_id) + ->where('transaction_journals.id', $journal->id) + ->get(['categories.*']); /** @var Category $category */ foreach ($set as $category) { $categories[] = sprintf('%1$s', e($category->name), route('categories.show', $category->id)); diff --git a/app/Support/Twig/Rule.php b/app/Support/Twig/Rule.php index 646912c370..8b89b48226 100644 --- a/app/Support/Twig/Rule.php +++ b/app/Support/Twig/Rule.php @@ -66,9 +66,9 @@ class Rule extends Twig_Extension 'allJournalTriggers', function () { return [ - 'store-journal' => trans('firefly.rule_trigger_store_journal'), - 'update-journal' => trans('firefly.rule_trigger_update_journal'), - ]; + 'store-journal' => trans('firefly.rule_trigger_store_journal'), + 'update-journal' => trans('firefly.rule_trigger_update_journal'), + ]; } ); } diff --git a/app/TransactionRules/Actions/SetBudget.php b/app/TransactionRules/Actions/SetBudget.php index d9fd23f02d..932cca045c 100644 --- a/app/TransactionRules/Actions/SetBudget.php +++ b/app/TransactionRules/Actions/SetBudget.php @@ -60,9 +60,9 @@ class SetBudget implements ActionInterface /** @var BudgetRepositoryInterface $repository */ $repository = app(BudgetRepositoryInterface::class); $repository->setUser($journal->user); - $search = $this->action->action_value; + $search = $this->action->action_value; $budgets = $repository->getActiveBudgets(); - $budget = $budgets->filter( + $budget = $budgets->filter( function (Budget $current) use ($search) { return $current->name === $search; } diff --git a/config/auth.php b/config/auth.php index e324d1a6f8..73352da7a0 100644 --- a/config/auth.php +++ b/config/auth.php @@ -36,7 +36,7 @@ return [ */ 'defaults' => [ - 'guard' => 'web', + 'guard' => 'web', 'passwords' => 'users', ], @@ -59,12 +59,12 @@ return [ 'guards' => [ 'web' => [ - 'driver' => 'session', + 'driver' => 'session', 'provider' => 'users', ], 'api' => [ - 'driver' => 'token', + 'driver' => 'token', 'provider' => 'users', ], ], @@ -89,7 +89,7 @@ return [ 'providers' => [ 'users' => [ 'driver' => 'eloquent', - 'model' => FireflyIII\User::class, + 'model' => FireflyIII\User::class, ], // 'users' => [ @@ -116,8 +116,8 @@ return [ 'passwords' => [ 'users' => [ 'provider' => 'users', - 'table' => 'password_resets', - 'expire' => 60, + 'table' => 'password_resets', + 'expire' => 60, ], ], diff --git a/config/broadcasting.php b/config/broadcasting.php index 962c603b70..00c45c8caf 100644 --- a/config/broadcasting.php +++ b/config/broadcasting.php @@ -53,17 +53,17 @@ return [ 'connections' => [ 'pusher' => [ - 'driver' => 'pusher', - 'key' => env('PUSHER_APP_KEY'), - 'secret' => env('PUSHER_APP_SECRET'), - 'app_id' => env('PUSHER_APP_ID'), + 'driver' => 'pusher', + 'key' => env('PUSHER_APP_KEY'), + 'secret' => env('PUSHER_APP_SECRET'), + 'app_id' => env('PUSHER_APP_ID'), 'options' => [ // ], ], 'redis' => [ - 'driver' => 'redis', + 'driver' => 'redis', 'connection' => 'default', ], diff --git a/config/cache.php b/config/cache.php index 812128ea27..c3360fdae1 100644 --- a/config/cache.php +++ b/config/cache.php @@ -61,37 +61,37 @@ return [ ], 'database' => [ - 'driver' => 'database', - 'table' => 'cache', + 'driver' => 'database', + 'table' => 'cache', 'connection' => null, ], 'file' => [ 'driver' => 'file', - 'path' => storage_path('framework/cache/data'), + 'path' => storage_path('framework/cache/data'), ], 'memcached' => [ - 'driver' => 'memcached', + 'driver' => 'memcached', 'persistent_id' => env('MEMCACHED_PERSISTENT_ID'), - 'sasl' => [ + 'sasl' => [ env('MEMCACHED_USERNAME'), env('MEMCACHED_PASSWORD'), ], - 'options' => [ + 'options' => [ // Memcached::OPT_CONNECT_TIMEOUT => 2000, ], - 'servers' => [ + 'servers' => [ [ - 'host' => env('MEMCACHED_HOST', '127.0.0.1'), - 'port' => env('MEMCACHED_PORT', 11211), + 'host' => env('MEMCACHED_HOST', '127.0.0.1'), + 'port' => env('MEMCACHED_PORT', 11211), 'weight' => 100, ], ], ], 'redis' => [ - 'driver' => 'redis', + 'driver' => 'redis', 'connection' => 'default', ], diff --git a/config/queue.php b/config/queue.php index 7c4b8840a2..171e9babc5 100644 --- a/config/queue.php +++ b/config/queue.php @@ -57,32 +57,32 @@ return [ ], 'database' => [ - 'driver' => 'database', - 'table' => 'jobs', - 'queue' => 'default', + 'driver' => 'database', + 'table' => 'jobs', + 'queue' => 'default', 'retry_after' => 90, ], 'beanstalkd' => [ - 'driver' => 'beanstalkd', - 'host' => 'localhost', - 'queue' => 'default', + 'driver' => 'beanstalkd', + 'host' => 'localhost', + 'queue' => 'default', 'retry_after' => 90, ], 'sqs' => [ 'driver' => 'sqs', - 'key' => 'your-public-key', + 'key' => 'your-public-key', 'secret' => 'your-secret-key', 'prefix' => 'https://sqs.us-east-1.amazonaws.com/your-account-id', - 'queue' => 'your-queue-name', + 'queue' => 'your-queue-name', 'region' => 'us-east-1', ], 'redis' => [ - 'driver' => 'redis', - 'connection' => 'default', - 'queue' => 'default', + 'driver' => 'redis', + 'connection' => 'default', + 'queue' => 'default', 'retry_after' => 90, ], @@ -101,7 +101,7 @@ return [ 'failed' => [ 'database' => env('DB_CONNECTION', 'mysql'), - 'table' => 'failed_jobs', + 'table' => 'failed_jobs', ], ]; diff --git a/config/services.php b/config/services.php index 0e0dd3b120..8b9e73ff36 100644 --- a/config/services.php +++ b/config/services.php @@ -42,7 +42,7 @@ return [ ], 'ses' => [ - 'key' => env('SES_KEY'), + 'key' => env('SES_KEY'), 'secret' => env('SES_SECRET'), 'region' => 'us-east-1', ], @@ -52,8 +52,8 @@ return [ ], 'stripe' => [ - 'model' => FireflyIII\User::class, - 'key' => env('STRIPE_KEY'), + 'model' => FireflyIII\User::class, + 'key' => env('STRIPE_KEY'), 'secret' => env('STRIPE_SECRET'), ], diff --git a/config/twigbridge.php b/config/twigbridge.php index 601364ccfe..df96c93a2d 100644 --- a/config/twigbridge.php +++ b/config/twigbridge.php @@ -176,7 +176,7 @@ return [ 'is_safe' => [ 'date', 'text', 'select', 'balance', 'optionsList', 'checkbox', 'amount', 'tags', 'integer', 'textarea', 'location', 'multiRadio', 'file', 'multiCheckbox', 'staticText', 'amountSmall', 'password', 'nonSelectableBalance', 'nonSelectableAmount', - 'number' + 'number', ], ], 'Form' => [ diff --git a/config/upgrade.php b/config/upgrade.php index 9d162714ac..d0f6e5b716 100644 --- a/config/upgrade.php +++ b/config/upgrade.php @@ -27,13 +27,13 @@ return [ [ '4.3' => 'Make sure you run the migrations and clear your cache. If you need more help, please check Github or the Firefly III website.', '4.6.3' => 'This will be the last version to require PHP7.0. Future versions will require PHP7.1 minimum.', - '4.6.4' => 'This version of Firefly III requires PHP7.1.' + '4.6.4' => 'This version of Firefly III requires PHP7.1.', ], 'install' => [ '4.3' => 'Welcome to Firefly! Make sure you follow the installation guide. If you need more help, please check Github or the Firefly III website. The installation guide has a FAQ which you should check out as well.', '4.6.3' => 'This will be the last version to require PHP7.0. Future versions will require PHP7.1 minimum.', - '4.6.4' => 'This version of Firefly III requires PHP7.1.' + '4.6.4' => 'This version of Firefly III requires PHP7.1.', ], ], ]; diff --git a/public/css/firefly.css b/public/css/firefly.css index 87489e2b14..2762b01073 100644 --- a/public/css/firefly.css +++ b/public/css/firefly.css @@ -28,7 +28,7 @@ } p.tagcloud .label { - line-height:2; + line-height: 2; } .handle { diff --git a/public/css/google-fonts.css b/public/css/google-fonts.css index ad3e4c6983..3647aa35a3 100644 --- a/public/css/google-fonts.css +++ b/public/css/google-fonts.css @@ -26,6 +26,7 @@ src: local('Source Sans Pro Light Italic'), local('SourceSansPro-LightItalic'), url('../fonts/SourceSansPro-LightItalic-cyrillic-ext.woff2') format('woff2'); unicode-range: U+0460-052F, U+20B4, U+2DE0-2DFF, U+A640-A69F; } + /* cyrillic */ @font-face { font-family: 'Source Sans Pro'; @@ -34,6 +35,7 @@ src: local('Source Sans Pro Light Italic'), local('SourceSansPro-LightItalic'), url('../fonts/SourceSansPro-LightItalic-cyrillic.woff2') format('woff2'); unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; } + /* greek-ext */ @font-face { font-family: 'Source Sans Pro'; @@ -42,6 +44,7 @@ src: local('Source Sans Pro Light Italic'), local('SourceSansPro-LightItalic'), url('../fonts/SourceSansPro-LightItalic-greek-ext.woff2') format('woff2'); unicode-range: U+1F00-1FFF; } + /* greek */ @font-face { font-family: 'Source Sans Pro'; @@ -50,6 +53,7 @@ src: local('Source Sans Pro Light Italic'), local('SourceSansPro-LightItalic'), url('../fonts/SourceSansPro-LightItalic-greek.woff2') format('woff2'); unicode-range: U+0370-03FF; } + /* vietnamese */ @font-face { font-family: 'Source Sans Pro'; @@ -58,6 +62,7 @@ src: local('Source Sans Pro Light Italic'), local('SourceSansPro-LightItalic'), url('../fonts/SourceSansPro-LightItalic-vietnamese.woff2') format('woff2'); unicode-range: U+0102-0103, U+1EA0-1EF9, U+20AB; } + /* latin-ext */ @font-face { font-family: 'Source Sans Pro'; @@ -66,6 +71,7 @@ src: local('Source Sans Pro Light Italic'), local('SourceSansPro-LightItalic'), url('../fonts/SourceSansPro-LightItalic-latin-ext.woff2') format('woff2'); unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF; } + /* latin */ @font-face { font-family: 'Source Sans Pro'; @@ -74,6 +80,7 @@ src: local('Source Sans Pro Light Italic'), local('SourceSansPro-LightItalic'), url('../fonts/SourceSansPro-LightItalic-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215; } + /* cyrillic-ext */ @font-face { font-family: 'Source Sans Pro'; @@ -82,6 +89,7 @@ src: local('Source Sans Pro Italic'), local('SourceSansPro-Italic'), url('../fonts/SourceSansPro-Italic-cyrillic-ext.woff2') format('woff2'); unicode-range: U+0460-052F, U+20B4, U+2DE0-2DFF, U+A640-A69F; } + /* cyrillic */ @font-face { font-family: 'Source Sans Pro'; @@ -90,6 +98,7 @@ src: local('Source Sans Pro Italic'), local('SourceSansPro-Italic'), url('../fonts/SourceSansPro-Italic-cyrillic.woff2') format('woff2'); unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; } + /* greek-ext */ @font-face { font-family: 'Source Sans Pro'; @@ -98,6 +107,7 @@ src: local('Source Sans Pro Italic'), local('SourceSansPro-Italic'), url('../fonts/SourceSansPro-Italic-greek-ext.woff2') format('woff2'); unicode-range: U+1F00-1FFF; } + /* greek */ @font-face { font-family: 'Source Sans Pro'; @@ -106,6 +116,7 @@ src: local('Source Sans Pro Italic'), local('SourceSansPro-Italic'), url('../fonts/SourceSansPro-Italic-greek.woff2') format('woff2'); unicode-range: U+0370-03FF; } + /* vietnamese */ @font-face { font-family: 'Source Sans Pro'; @@ -114,6 +125,7 @@ src: local('Source Sans Pro Italic'), local('SourceSansPro-Italic'), url('../fonts/SourceSansPro-Italic-vietnamese.woff2') format('woff2'); unicode-range: U+0102-0103, U+1EA0-1EF9, U+20AB; } + /* latin-ext */ @font-face { font-family: 'Source Sans Pro'; @@ -122,6 +134,7 @@ src: local('Source Sans Pro Italic'), local('SourceSansPro-Italic'), url('../fonts/SourceSansPro-Italic-latin-ext.woff2') format('woff2'); unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF; } + /* latin */ @font-face { font-family: 'Source Sans Pro'; @@ -130,6 +143,7 @@ src: local('Source Sans Pro Italic'), local('SourceSansPro-Italic'), url('../fonts/SourceSansPro-Italic-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215; } + /* cyrillic-ext */ @font-face { font-family: 'Source Sans Pro'; @@ -138,6 +152,7 @@ src: local('Source Sans Pro SemiBold Italic'), local('SourceSansPro-SemiBoldItalic'), url('../fonts/SourceSansPro-SemiBoldItalic-cyrillic-ext.woff2') format('woff2'); unicode-range: U+0460-052F, U+20B4, U+2DE0-2DFF, U+A640-A69F; } + /* cyrillic */ @font-face { font-family: 'Source Sans Pro'; @@ -146,6 +161,7 @@ src: local('Source Sans Pro SemiBold Italic'), local('SourceSansPro-SemiBoldItalic'), url('../fonts/SourceSansPro-SemiBoldItalic-cyrillic.woff2') format('woff2'); unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; } + /* greek-ext */ @font-face { font-family: 'Source Sans Pro'; @@ -154,6 +170,7 @@ src: local('Source Sans Pro SemiBold Italic'), local('SourceSansPro-SemiBoldItalic'), url('../fonts/SourceSansPro-SemiBoldItalic-greek-ext.woff2') format('woff2'); unicode-range: U+1F00-1FFF; } + /* greek */ @font-face { font-family: 'Source Sans Pro'; @@ -162,6 +179,7 @@ src: local('Source Sans Pro SemiBold Italic'), local('SourceSansPro-SemiBoldItalic'), url('../fonts/SourceSansPro-SemiBoldItalic-greek.woff2') format('woff2'); unicode-range: U+0370-03FF; } + /* vietnamese */ @font-face { font-family: 'Source Sans Pro'; @@ -170,6 +188,7 @@ src: local('Source Sans Pro SemiBold Italic'), local('SourceSansPro-SemiBoldItalic'), url('../fonts/SourceSansPro-SemiBoldItalic-vietnamese.woff2') format('woff2'); unicode-range: U+0102-0103, U+1EA0-1EF9, U+20AB; } + /* latin-ext */ @font-face { font-family: 'Source Sans Pro'; @@ -178,6 +197,7 @@ src: local('Source Sans Pro SemiBold Italic'), local('SourceSansPro-SemiBoldItalic'), url('../fonts/SourceSansPro-SemiBoldItalic-latin-ext.woff2') format('woff2'); unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF; } + /* latin */ @font-face { font-family: 'Source Sans Pro'; @@ -186,6 +206,7 @@ src: local('Source Sans Pro SemiBold Italic'), local('SourceSansPro-SemiBoldItalic'), url('../fonts/SourceSansPro-SemiBoldItalic-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215; } + /* cyrillic-ext */ @font-face { font-family: 'Source Sans Pro'; @@ -194,6 +215,7 @@ src: local('Source Sans Pro Light'), local('SourceSansPro-Light'), url('../fonts/SourceSansPro-Light-cyrillic-ext.woff2') format('woff2'); unicode-range: U+0460-052F, U+20B4, U+2DE0-2DFF, U+A640-A69F; } + /* cyrillic */ @font-face { font-family: 'Source Sans Pro'; @@ -202,6 +224,7 @@ src: local('Source Sans Pro Light'), local('SourceSansPro-Light'), url('../fonts/SourceSansPro-Light-cyrillic.woff2') format('woff2'); unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; } + /* greek-ext */ @font-face { font-family: 'Source Sans Pro'; @@ -210,6 +233,7 @@ src: local('Source Sans Pro Light'), local('SourceSansPro-Light'), url('../fonts/SourceSansPro-Light-greek-ext.woff2') format('woff2'); unicode-range: U+1F00-1FFF; } + /* greek */ @font-face { font-family: 'Source Sans Pro'; @@ -218,6 +242,7 @@ src: local('Source Sans Pro Light'), local('SourceSansPro-Light'), url('../fonts/SourceSansPro-Light-greek.woff2') format('woff2'); unicode-range: U+0370-03FF; } + /* vietnamese */ @font-face { font-family: 'Source Sans Pro'; @@ -226,6 +251,7 @@ src: local('Source Sans Pro Light'), local('SourceSansPro-Light'), url('../fonts/SourceSansPro-Light-vietnamese.woff2') format('woff2'); unicode-range: U+0102-0103, U+1EA0-1EF9, U+20AB; } + /* latin-ext */ @font-face { font-family: 'Source Sans Pro'; @@ -234,6 +260,7 @@ src: local('Source Sans Pro Light'), local('SourceSansPro-Light'), url('../fonts/SourceSansPro-Light-latin-ext.woff2') format('woff2'); unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF; } + /* latin */ @font-face { font-family: 'Source Sans Pro'; @@ -242,6 +269,7 @@ src: local('Source Sans Pro Light'), local('SourceSansPro-Light'), url('../fonts/SourceSansPro-Light-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215; } + /* cyrillic-ext */ @font-face { font-family: 'Source Sans Pro'; @@ -250,6 +278,7 @@ src: local('Source Sans Pro Regular'), local('SourceSansPro-Regular'), url('../fonts/SourceSansPro-Regular-cyrillic-ext.woff2') format('woff2'); unicode-range: U+0460-052F, U+20B4, U+2DE0-2DFF, U+A640-A69F; } + /* cyrillic */ @font-face { font-family: 'Source Sans Pro'; @@ -258,6 +287,7 @@ src: local('Source Sans Pro Regular'), local('SourceSansPro-Regular'), url('../fonts/SourceSansPro-Regular-cyrillic.woff2') format('woff2'); unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; } + /* greek-ext */ @font-face { font-family: 'Source Sans Pro'; @@ -266,6 +296,7 @@ src: local('Source Sans Pro Regular'), local('SourceSansPro-Regular'), url('../fonts/SourceSansPro-Regular-greek-ext.woff2') format('woff2'); unicode-range: U+1F00-1FFF; } + /* greek */ @font-face { font-family: 'Source Sans Pro'; @@ -274,6 +305,7 @@ src: local('Source Sans Pro Regular'), local('SourceSansPro-Regular'), url('../fonts/SourceSansPro-Regular-greek.woff2') format('woff2'); unicode-range: U+0370-03FF; } + /* vietnamese */ @font-face { font-family: 'Source Sans Pro'; @@ -282,6 +314,7 @@ src: local('Source Sans Pro Regular'), local('SourceSansPro-Regular'), url('../fonts/SourceSansPro-Regular-vietnamese.woff2') format('woff2'); unicode-range: U+0102-0103, U+1EA0-1EF9, U+20AB; } + /* latin-ext */ @font-face { font-family: 'Source Sans Pro'; @@ -290,6 +323,7 @@ src: local('Source Sans Pro Regular'), local('SourceSansPro-Regular'), url('../fonts/SourceSansPro-Regular-latin-ext.woff2') format('woff2'); unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF; } + /* latin */ @font-face { font-family: 'Source Sans Pro'; @@ -298,6 +332,7 @@ src: local('Source Sans Pro Regular'), local('SourceSansPro-Regular'), url('../fonts/SourceSansPro-Regular-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215; } + /* cyrillic-ext */ @font-face { font-family: 'Source Sans Pro'; @@ -306,6 +341,7 @@ src: local('Source Sans Pro SemiBold'), local('SourceSansPro-SemiBold'), url('../fonts/SourceSansPro-SemiBold-cyrillic-ext.woff2') format('woff2'); unicode-range: U+0460-052F, U+20B4, U+2DE0-2DFF, U+A640-A69F; } + /* cyrillic */ @font-face { font-family: 'Source Sans Pro'; @@ -314,6 +350,7 @@ src: local('Source Sans Pro SemiBold'), local('SourceSansPro-SemiBold'), url('../fonts/SourceSansPro-SemiBold-cyrillic.woff2') format('woff2'); unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; } + /* greek-ext */ @font-face { font-family: 'Source Sans Pro'; @@ -322,6 +359,7 @@ src: local('Source Sans Pro SemiBold'), local('SourceSansPro-SemiBold'), url('../fonts/SourceSansPro-SemiBold-greek-ext.woff2') format('woff2'); unicode-range: U+1F00-1FFF; } + /* greek */ @font-face { font-family: 'Source Sans Pro'; @@ -330,6 +368,7 @@ src: local('Source Sans Pro SemiBold'), local('SourceSansPro-SemiBold'), url('../fonts/SourceSansPro-SemiBold-greek.woff2') format('woff2'); unicode-range: U+0370-03FF; } + /* vietnamese */ @font-face { font-family: 'Source Sans Pro'; @@ -338,6 +377,7 @@ src: local('Source Sans Pro SemiBold'), local('SourceSansPro-SemiBold'), url('../fonts/SourceSansPro-SemiBold-vietnamese.woff2') format('woff2'); unicode-range: U+0102-0103, U+1EA0-1EF9, U+20AB; } + /* latin-ext */ @font-face { font-family: 'Source Sans Pro'; @@ -346,6 +386,7 @@ src: local('Source Sans Pro SemiBold'), local('SourceSansPro-SemiBold'), url('../fonts/SourceSansPro-SemiBold-latin-ext.woff2') format('woff2'); unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF; } + /* latin */ @font-face { font-family: 'Source Sans Pro'; @@ -354,6 +395,7 @@ src: local('Source Sans Pro SemiBold'), local('SourceSansPro-SemiBold'), url('../fonts/SourceSansPro-SemiBold-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215; } + /* cyrillic-ext */ @font-face { font-family: 'Source Sans Pro'; @@ -362,6 +404,7 @@ src: local('Source Sans Pro Bold'), local('SourceSansPro-Bold'), url('../fonts/SourceSansPro-Bold-cyrillic-ext.woff2') format('woff2'); unicode-range: U+0460-052F, U+20B4, U+2DE0-2DFF, U+A640-A69F; } + /* cyrillic */ @font-face { font-family: 'Source Sans Pro'; @@ -370,6 +413,7 @@ src: local('Source Sans Pro Bold'), local('SourceSansPro-Bold'), url('../fonts/SourceSansPro-Bold-cyrillic.woff2') format('woff2'); unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; } + /* greek-ext */ @font-face { font-family: 'Source Sans Pro'; @@ -378,6 +422,7 @@ src: local('Source Sans Pro Bold'), local('SourceSansPro-Bold'), url('../fonts/SourceSansPro-Bold-greek-ext.woff2') format('woff2'); unicode-range: U+1F00-1FFF; } + /* greek */ @font-face { font-family: 'Source Sans Pro'; @@ -386,6 +431,7 @@ src: local('Source Sans Pro Bold'), local('SourceSansPro-Bold'), url('../fonts/SourceSansPro-Bold-greek.woff2') format('woff2'); unicode-range: U+0370-03FF; } + /* vietnamese */ @font-face { font-family: 'Source Sans Pro'; @@ -394,6 +440,7 @@ src: local('Source Sans Pro Bold'), local('SourceSansPro-Bold'), url('../fonts/SourceSansPro-Bold-vietnamese.woff2') format('woff2'); unicode-range: U+0102-0103, U+1EA0-1EF9, U+20AB; } + /* latin-ext */ @font-face { font-family: 'Source Sans Pro'; @@ -402,6 +449,7 @@ src: local('Source Sans Pro Bold'), local('SourceSansPro-Bold'), url('../fonts/SourceSansPro-Bold-latin-ext.woff2') format('woff2'); unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF; } + /* latin */ @font-face { font-family: 'Source Sans Pro'; diff --git a/public/index.php b/public/index.php index fee61b0b1d..abea8072d8 100644 --- a/public/index.php +++ b/public/index.php @@ -40,7 +40,7 @@ define('LARAVEL_START', microtime(true)); | */ -require __DIR__.'/../vendor/autoload.php'; +require __DIR__ . '/../vendor/autoload.php'; /* |-------------------------------------------------------------------------- @@ -54,7 +54,7 @@ require __DIR__.'/../vendor/autoload.php'; | */ -$app = require_once __DIR__.'/../bootstrap/app.php'; +$app = require_once __DIR__ . '/../bootstrap/app.php'; /* |-------------------------------------------------------------------------- diff --git a/public/js/ff/export/index.js b/public/js/ff/export/index.js index 97bfd5bf67..b446b20f03 100644 --- a/public/js/ff/export/index.js +++ b/public/js/ff/export/index.js @@ -120,7 +120,7 @@ function callExport() { var response = jqXHR.responseJSON; var errorText = 'The export failed. Please check the log files to find out why.'; if (typeof response === 'object') { - errorText =response.message; + errorText = response.message; } showError(errorText); diff --git a/public/js/ff/intro/intro.js b/public/js/ff/intro/intro.js index d4406076fa..582f92251f 100644 --- a/public/js/ff/intro/intro.js +++ b/public/js/ff/intro/intro.js @@ -42,5 +42,5 @@ function setupIntro(steps) { } function reportIntroFinished() { - $.post(routeForFinishedTour, {_token:token}); + $.post(routeForFinishedTour, {_token: token}); } \ No newline at end of file diff --git a/public/js/ff/rules/index.js b/public/js/ff/rules/index.js index 3c975859ea..7e74c5edbc 100644 --- a/public/js/ff/rules/index.js +++ b/public/js/ff/rules/index.js @@ -58,7 +58,7 @@ function testRuleTriggers(e) { var obj = $(e.target); var ruleId = parseInt(obj.data('id')); var icon = obj; - if(obj.prop("tagName") === 'A') { + if (obj.prop("tagName") === 'A') { icon = $('i', obj); } // change icon: diff --git a/public/js/ff/tags/show.js b/public/js/ff/tags/show.js index a8dffd046d..07e0abbf7d 100644 --- a/public/js/ff/tags/show.js +++ b/public/js/ff/tags/show.js @@ -31,7 +31,14 @@ $(function () { */ // make map: - var mymap = L.map('tag_location_map', {zoomControl: false, touchZoom: false, doubleClickZoom: false, scrollWheelZoom: false, boxZoom: false, dragging: false}).setView([latitude, longitude], zoomLevel); + var mymap = L.map('tag_location_map', { + zoomControl: false, + touchZoom: false, + doubleClickZoom: false, + scrollWheelZoom: false, + boxZoom: false, + dragging: false + }).setView([latitude, longitude], zoomLevel); L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={accessToken}', { attribution: 'Map data © OpenStreetMap contributors, CC-BY-SA, Imagery © Mapbox', @@ -40,7 +47,7 @@ $(function () { accessToken: mapboxToken }).addTo(mymap); - if(doPlaceMarker) { + if (doPlaceMarker) { var marker = L.marker([latitude, longitude]).addTo(mymap); } } diff --git a/public/js/ff/transactions/show.js b/public/js/ff/transactions/show.js index f3dfc8cb31..093703bcdb 100644 --- a/public/js/ff/transactions/show.js +++ b/public/js/ff/transactions/show.js @@ -30,7 +30,7 @@ $(function () { source: data, autoSelect: true }); - $input.change(function() { + $input.change(function () { var current = $input.typeahead("getActive"); if (current) { // Some item from your model is active! diff --git a/tests/CreatesApplication.php b/tests/CreatesApplication.php index a473168274..f74c104bda 100644 --- a/tests/CreatesApplication.php +++ b/tests/CreatesApplication.php @@ -35,7 +35,7 @@ trait CreatesApplication */ public function createApplication() { - $app = require __DIR__.'/../bootstrap/app.php'; + $app = require __DIR__ . '/../bootstrap/app.php'; $app->make(Kernel::class)->bootstrap(); diff --git a/tests/Feature/Controllers/BudgetControllerTest.php b/tests/Feature/Controllers/BudgetControllerTest.php index 5bd106fba6..db039117f3 100644 --- a/tests/Feature/Controllers/BudgetControllerTest.php +++ b/tests/Feature/Controllers/BudgetControllerTest.php @@ -205,7 +205,7 @@ class BudgetControllerTest extends TestCase // mock stuff $budget = factory(Budget::class)->make(); $budgetLimit = factory(BudgetLimit::class)->make(); - $budgetInfo = [ + $budgetInfo = [ $budget->id => [ 'spent' => '0', 'budgeted' => '0', diff --git a/tests/Feature/Controllers/ExportControllerTest.php b/tests/Feature/Controllers/ExportControllerTest.php index a704fdc5db..d4c8f23e71 100644 --- a/tests/Feature/Controllers/ExportControllerTest.php +++ b/tests/Feature/Controllers/ExportControllerTest.php @@ -155,7 +155,7 @@ class ExportControllerTest extends TestCase $processor->shouldReceive('collectOldUploads')->once(); $processor->shouldReceive('collectAttachments')->once(); - $job = new ExportJob; + $job = new ExportJob; $job->user = $this->user(); $repository->shouldReceive('changeStatus')->andReturn(true); diff --git a/tests/Feature/Controllers/JsonControllerTest.php b/tests/Feature/Controllers/JsonControllerTest.php index 78dd8a5a87..510da9a313 100644 --- a/tests/Feature/Controllers/JsonControllerTest.php +++ b/tests/Feature/Controllers/JsonControllerTest.php @@ -23,15 +23,10 @@ declare(strict_types=1); namespace Tests\Feature\Controllers; -use Amount; -use FireflyIII\Helpers\Collector\JournalCollectorInterface; use FireflyIII\Models\Budget; use FireflyIII\Models\Category; use FireflyIII\Models\Tag; -use FireflyIII\Models\Transaction; use FireflyIII\Models\TransactionJournal; -use FireflyIII\Models\TransactionType; -use FireflyIII\Repositories\Bill\BillRepositoryInterface; use FireflyIII\Repositories\Budget\BudgetRepositoryInterface; use FireflyIII\Repositories\Category\CategoryRepositoryInterface; use FireflyIII\Repositories\Journal\JournalRepositoryInterface; diff --git a/tests/Feature/Controllers/Transaction/SingleControllerTest.php b/tests/Feature/Controllers/Transaction/SingleControllerTest.php index 026e7eea20..a78e15577a 100644 --- a/tests/Feature/Controllers/Transaction/SingleControllerTest.php +++ b/tests/Feature/Controllers/Transaction/SingleControllerTest.php @@ -296,7 +296,7 @@ class SingleControllerTest extends TestCase /** * @covers \FireflyIII\Http\Controllers\Transaction\SingleController::store - * @covers \FireflyIII\Http\Controllers\Transaction\SingleController::groupedActiveAccountList + * @covers \FireflyIII\Http\Controllers\Transaction\SingleController::groupedActiveAccountList */ public function testStoreSuccess() { diff --git a/tests/Feature/ExampleTest.php b/tests/Feature/ExampleTest.php index 48cb9dc8b5..910ea86035 100644 --- a/tests/Feature/ExampleTest.php +++ b/tests/Feature/ExampleTest.php @@ -25,7 +25,6 @@ declare(strict_types=1); namespace Tests\Feature; use Tests\TestCase; -use Illuminate\Foundation\Testing\RefreshDatabase; class ExampleTest extends TestCase { diff --git a/tests/Unit/ExampleTest.php b/tests/Unit/ExampleTest.php index 9d3fffcb7a..72011a9b73 100644 --- a/tests/Unit/ExampleTest.php +++ b/tests/Unit/ExampleTest.php @@ -25,7 +25,6 @@ declare(strict_types=1); namespace Tests\Unit; use Tests\TestCase; -use Illuminate\Foundation\Testing\RefreshDatabase; class ExampleTest extends TestCase { diff --git a/tests/Unit/TransactionRules/Actions/ClearCategoryTest.php b/tests/Unit/TransactionRules/Actions/ClearCategoryTest.php index ce73265513..fbee3211df 100644 --- a/tests/Unit/TransactionRules/Actions/ClearCategoryTest.php +++ b/tests/Unit/TransactionRules/Actions/ClearCategoryTest.php @@ -22,6 +22,7 @@ declare(strict_types=1); namespace Tests\Unit\TransactionRules\Actions; + use FireflyIII\Models\RuleAction; use FireflyIII\Models\TransactionJournal; use FireflyIII\TransactionRules\Actions\ClearCategory; @@ -41,7 +42,7 @@ class ClearCategoryTest extends TestCase public function testAct() { // associate budget with journal: - $journal = TransactionJournal::find(5); + $journal = TransactionJournal::find(5); $category = $journal->user->categories()->first(); $journal->budgets()->save($category); $this->assertGreaterThan(0, $journal->categories()->count()); diff --git a/tests/Unit/TransactionRules/Actions/PrependDescriptionTest.php b/tests/Unit/TransactionRules/Actions/PrependDescriptionTest.php index f17d17a1f6..850ecf8c79 100644 --- a/tests/Unit/TransactionRules/Actions/PrependDescriptionTest.php +++ b/tests/Unit/TransactionRules/Actions/PrependDescriptionTest.php @@ -55,10 +55,10 @@ class PrependDescriptionTest extends TestCase $action = new PrependDescription($ruleAction); $result = $action->act($journal); $this->assertTrue($result); - $journal = TransactionJournal::find(7); + $journal = TransactionJournal::find(7); // assert result - $this->assertEquals($prepend.$description, $journal->description); + $this->assertEquals($prepend . $description, $journal->description); } } diff --git a/tests/Unit/TransactionRules/Actions/SetDestinationAccountTest.php b/tests/Unit/TransactionRules/Actions/SetDestinationAccountTest.php index 89084544e1..dabee5609e 100644 --- a/tests/Unit/TransactionRules/Actions/SetDestinationAccountTest.php +++ b/tests/Unit/TransactionRules/Actions/SetDestinationAccountTest.php @@ -166,6 +166,7 @@ class SetDestinationAccountTest extends TestCase /** * Test this on a split journal. + * * @covers \FireflyIII\TransactionRules\Actions\SetDestinationAccount::__construct() * @covers \FireflyIII\TransactionRules\Actions\SetDestinationAccount::act() */ diff --git a/tests/Unit/TransactionRules/Actions/SetNotesTest.php b/tests/Unit/TransactionRules/Actions/SetNotesTest.php index 22a5878e59..63884197b7 100644 --- a/tests/Unit/TransactionRules/Actions/SetNotesTest.php +++ b/tests/Unit/TransactionRules/Actions/SetNotesTest.php @@ -27,7 +27,6 @@ namespace Tests\Unit\TransactionRules\Actions; use FireflyIII\Models\Note; use FireflyIII\Models\RuleAction; use FireflyIII\Models\TransactionJournal; -use FireflyIII\TransactionRules\Actions\ClearNotes; use FireflyIII\TransactionRules\Actions\SetNotes; use Tests\TestCase; diff --git a/tests/Unit/TransactionRules/Triggers/AmountLessTest.php b/tests/Unit/TransactionRules/Triggers/AmountLessTest.php index 533d73c5ac..b2dc9c3d0f 100644 --- a/tests/Unit/TransactionRules/Triggers/AmountLessTest.php +++ b/tests/Unit/TransactionRules/Triggers/AmountLessTest.php @@ -35,18 +35,6 @@ use Tests\TestCase; */ class AmountLessTest extends TestCase { - /** - * @covers \FireflyIII\TransactionRules\Triggers\AmountLess::triggered - */ - public function testTriggeredLess() - { - $journal = new TransactionJournal; - $journal->destination_amount = '12.34'; - $trigger = AmountLess::makeFromStrings('12.50', false); - $result = $trigger->triggered($journal); - $this->assertTrue($result); - } - /** * @covers \FireflyIII\TransactionRules\Triggers\AmountLess::triggered */ @@ -59,6 +47,18 @@ class AmountLessTest extends TestCase $this->assertFalse($result); } + /** + * @covers \FireflyIII\TransactionRules\Triggers\AmountLess::triggered + */ + public function testTriggeredLess() + { + $journal = new TransactionJournal; + $journal->destination_amount = '12.34'; + $trigger = AmountLess::makeFromStrings('12.50', false); + $result = $trigger->triggered($journal); + $this->assertTrue($result); + } + /** * @covers \FireflyIII\TransactionRules\Triggers\AmountLess::triggered */ diff --git a/tests/Unit/TransactionRules/Triggers/DescriptionContainsTest.php b/tests/Unit/TransactionRules/Triggers/DescriptionContainsTest.php index 99bf22574b..b937835cb3 100644 --- a/tests/Unit/TransactionRules/Triggers/DescriptionContainsTest.php +++ b/tests/Unit/TransactionRules/Triggers/DescriptionContainsTest.php @@ -47,19 +47,6 @@ class DescriptionContainsTest extends TestCase $this->assertTrue($result); } - /** - * @covers \FireflyIII\TransactionRules\Triggers\DescriptionContains::triggered - */ - public function testTriggeredNot() - { - $journal = new TransactionJournal; - $journal->description = 'Lorem IPSUM bla bla '; - $trigger = DescriptionContains::makeFromStrings('blurb', false); - $result = $trigger->triggered($journal); - $this->assertFalse($result); - } - - /** * @covers \FireflyIII\TransactionRules\Triggers\DescriptionContains::triggered */ @@ -84,6 +71,18 @@ class DescriptionContainsTest extends TestCase $this->assertTrue($result); } + /** + * @covers \FireflyIII\TransactionRules\Triggers\DescriptionContains::triggered + */ + public function testTriggeredNot() + { + $journal = new TransactionJournal; + $journal->description = 'Lorem IPSUM bla bla '; + $trigger = DescriptionContains::makeFromStrings('blurb', false); + $result = $trigger->triggered($journal); + $this->assertFalse($result); + } + /** * @covers \FireflyIII\TransactionRules\Triggers\DescriptionContains::triggered */ diff --git a/tests/Unit/TransactionRules/Triggers/DescriptionEndsTest.php b/tests/Unit/TransactionRules/Triggers/DescriptionEndsTest.php index 994848e3ad..10aa263264 100644 --- a/tests/Unit/TransactionRules/Triggers/DescriptionEndsTest.php +++ b/tests/Unit/TransactionRules/Triggers/DescriptionEndsTest.php @@ -50,16 +50,15 @@ class DescriptionEndsTest extends TestCase /** * @covers \FireflyIII\TransactionRules\Triggers\DescriptionEnds::triggered */ - public function testTriggeredNot() + public function testTriggeredClose() { $journal = new TransactionJournal; - $journal->description = 'Lorem IPSUM blabla'; - $trigger = DescriptionEnds::makeFromStrings('lorem', false); + $journal->description = 'Something is going to happen'; + $trigger = DescriptionEnds::makeFromStrings('happe', false); $result = $trigger->triggered($journal); $this->assertFalse($result); } - /** * @covers \FireflyIII\TransactionRules\Triggers\DescriptionEnds::triggered */ @@ -75,11 +74,11 @@ class DescriptionEndsTest extends TestCase /** * @covers \FireflyIII\TransactionRules\Triggers\DescriptionEnds::triggered */ - public function testTriggeredClose() + public function testTriggeredLongSearch() { $journal = new TransactionJournal; - $journal->description = 'Something is going to happen'; - $trigger = DescriptionEnds::makeFromStrings('happe', false); + $journal->description = 'Something'; + $trigger = DescriptionEnds::makeFromStrings('Something is', false); $result = $trigger->triggered($journal); $this->assertFalse($result); } @@ -99,11 +98,11 @@ class DescriptionEndsTest extends TestCase /** * @covers \FireflyIII\TransactionRules\Triggers\DescriptionEnds::triggered */ - public function testTriggeredLongSearch() + public function testTriggeredNot() { $journal = new TransactionJournal; - $journal->description = 'Something'; - $trigger = DescriptionEnds::makeFromStrings('Something is', false); + $journal->description = 'Lorem IPSUM blabla'; + $trigger = DescriptionEnds::makeFromStrings('lorem', false); $result = $trigger->triggered($journal); $this->assertFalse($result); } diff --git a/tests/Unit/TransactionRules/Triggers/DescriptionIsTest.php b/tests/Unit/TransactionRules/Triggers/DescriptionIsTest.php index 12b4255e6c..0a8d24ba2c 100644 --- a/tests/Unit/TransactionRules/Triggers/DescriptionIsTest.php +++ b/tests/Unit/TransactionRules/Triggers/DescriptionIsTest.php @@ -50,16 +50,15 @@ class DescriptionIsTest extends TestCase /** * @covers \FireflyIII\TransactionRules\Triggers\DescriptionIs::triggered */ - public function testTriggeredNot() + public function testTriggeredClose() { $journal = new TransactionJournal; - $journal->description = 'Lorem IPSUM blabla'; - $trigger = DescriptionIs::makeFromStrings('lorem', false); + $journal->description = 'Something is going to happen'; + $trigger = DescriptionIs::makeFromStrings('Something is going to happe', false); $result = $trigger->triggered($journal); $this->assertFalse($result); } - /** * @covers \FireflyIII\TransactionRules\Triggers\DescriptionIs::triggered */ @@ -75,11 +74,11 @@ class DescriptionIsTest extends TestCase /** * @covers \FireflyIII\TransactionRules\Triggers\DescriptionIs::triggered */ - public function testTriggeredClose() + public function testTriggeredNot() { $journal = new TransactionJournal; - $journal->description = 'Something is going to happen'; - $trigger = DescriptionIs::makeFromStrings('Something is going to happe', false); + $journal->description = 'Lorem IPSUM blabla'; + $trigger = DescriptionIs::makeFromStrings('lorem', false); $result = $trigger->triggered($journal); $this->assertFalse($result); } diff --git a/tests/Unit/TransactionRules/Triggers/DescriptionStartsTest.php b/tests/Unit/TransactionRules/Triggers/DescriptionStartsTest.php index aa0e3b3042..a2e5faba0e 100644 --- a/tests/Unit/TransactionRules/Triggers/DescriptionStartsTest.php +++ b/tests/Unit/TransactionRules/Triggers/DescriptionStartsTest.php @@ -50,16 +50,15 @@ class DescriptionStartsTest extends TestCase /** * @covers \FireflyIII\TransactionRules\Triggers\DescriptionStarts::triggered */ - public function testTriggeredNot() + public function testTriggeredClose() { $journal = new TransactionJournal; - $journal->description = 'Lorem IPSUM blabla'; - $trigger = DescriptionStarts::makeFromStrings('blabla', false); + $journal->description = 'Something is going to happen'; + $trigger = DescriptionStarts::makeFromStrings('omething', false); $result = $trigger->triggered($journal); $this->assertFalse($result); } - /** * @covers \FireflyIII\TransactionRules\Triggers\DescriptionStarts::triggered */ @@ -75,11 +74,11 @@ class DescriptionStartsTest extends TestCase /** * @covers \FireflyIII\TransactionRules\Triggers\DescriptionStarts::triggered */ - public function testTriggeredClose() + public function testTriggeredLongSearch() { $journal = new TransactionJournal; - $journal->description = 'Something is going to happen'; - $trigger = DescriptionStarts::makeFromStrings('omething', false); + $journal->description = 'Something'; + $trigger = DescriptionStarts::makeFromStrings('Something is', false); $result = $trigger->triggered($journal); $this->assertFalse($result); } @@ -87,11 +86,11 @@ class DescriptionStartsTest extends TestCase /** * @covers \FireflyIII\TransactionRules\Triggers\DescriptionStarts::triggered */ - public function testTriggeredLongSearch() + public function testTriggeredNot() { $journal = new TransactionJournal; - $journal->description = 'Something'; - $trigger = DescriptionStarts::makeFromStrings('Something is', false); + $journal->description = 'Lorem IPSUM blabla'; + $trigger = DescriptionStarts::makeFromStrings('blabla', false); $result = $trigger->triggered($journal); $this->assertFalse($result); } diff --git a/tests/Unit/TransactionRules/Triggers/FromAccountIsTest.php b/tests/Unit/TransactionRules/Triggers/FromAccountIsTest.php index 21b3317457..42f2228024 100644 --- a/tests/Unit/TransactionRules/Triggers/FromAccountIsTest.php +++ b/tests/Unit/TransactionRules/Triggers/FromAccountIsTest.php @@ -62,6 +62,16 @@ class FromAccountIsTest extends TestCase $this->assertFalse($result); } + /** + * @covers \FireflyIII\TransactionRules\Triggers\FromAccountIs::willMatchEverything + */ + public function testWillMatchEverythingEmpty() + { + $value = ''; + $result = FromAccountIs::willMatchEverything($value); + $this->assertTrue($result); + } + /** * @covers \FireflyIII\TransactionRules\Triggers\FromAccountIs::willMatchEverything */ @@ -82,15 +92,4 @@ class FromAccountIsTest extends TestCase $this->assertTrue($result); } - - /** - * @covers \FireflyIII\TransactionRules\Triggers\FromAccountIs::willMatchEverything - */ - public function testWillMatchEverythingEmpty() - { - $value = ''; - $result = FromAccountIs::willMatchEverything($value); - $this->assertTrue($result); - } - } diff --git a/tests/Unit/TransactionRules/Triggers/FromAccountStartsTest.php b/tests/Unit/TransactionRules/Triggers/FromAccountStartsTest.php index 68b49952da..d7bd8883a5 100644 --- a/tests/Unit/TransactionRules/Triggers/FromAccountStartsTest.php +++ b/tests/Unit/TransactionRules/Triggers/FromAccountStartsTest.php @@ -44,7 +44,7 @@ class FromAccountStartsTest extends TestCase $transaction = $journal->transactions()->where('amount', '<', 0)->first(); $account = $transaction->account; - $trigger = FromAccountStarts::makeFromStrings(substr($account->name,0, -3), false); + $trigger = FromAccountStarts::makeFromStrings(substr($account->name, 0, -3), false); $result = $trigger->triggered($journal); $this->assertTrue($result); } diff --git a/tests/Unit/TransactionRules/Triggers/HasAnyTagTest.php b/tests/Unit/TransactionRules/Triggers/HasAnyTagTest.php index f9bfda041a..6226e386a7 100644 --- a/tests/Unit/TransactionRules/Triggers/HasAnyTagTest.php +++ b/tests/Unit/TransactionRules/Triggers/HasAnyTagTest.php @@ -39,8 +39,8 @@ class HasAnyTagTest extends TestCase */ public function testTriggered() { - $journal = TransactionJournal::find(25); - $tag = $journal->user->tags()->first(); + $journal = TransactionJournal::find(25); + $tag = $journal->user->tags()->first(); $journal->tags()->detach(); $journal->tags()->save($tag); diff --git a/tests/Unit/TransactionRules/Triggers/NotesAreTest.php b/tests/Unit/TransactionRules/Triggers/NotesAreTest.php index 1a32d55599..491d1f74d1 100644 --- a/tests/Unit/TransactionRules/Triggers/NotesAreTest.php +++ b/tests/Unit/TransactionRules/Triggers/NotesAreTest.php @@ -53,22 +53,6 @@ class NotesAreTest extends TestCase $this->assertTrue($result); } - /** - * @covers \FireflyIII\TransactionRules\Triggers\NotesAre::triggered - */ - public function testTriggeredEmpty() - { - $journal = TransactionJournal::find(40); - $journal->notes()->delete(); - $note = new Note(); - $note->noteable()->associate($journal); - $note->text = ''; - $note->save(); - $trigger = NotesAre::makeFromStrings('', false); - $result = $trigger->triggered($journal); - $this->assertFalse($result); - } - /** * @covers \FireflyIII\TransactionRules\Triggers\NotesAre::triggered */ @@ -85,6 +69,22 @@ class NotesAreTest extends TestCase $this->assertFalse($result); } + /** + * @covers \FireflyIII\TransactionRules\Triggers\NotesAre::triggered + */ + public function testTriggeredEmpty() + { + $journal = TransactionJournal::find(40); + $journal->notes()->delete(); + $note = new Note(); + $note->noteable()->associate($journal); + $note->text = ''; + $note->save(); + $trigger = NotesAre::makeFromStrings('', false); + $result = $trigger->triggered($journal); + $this->assertFalse($result); + } + /** * @covers \FireflyIII\TransactionRules\Triggers\NotesAre::triggered */ diff --git a/tests/Unit/TransactionRules/Triggers/NotesContainTest.php b/tests/Unit/TransactionRules/Triggers/NotesContainTest.php index 3e31ada8bd..7640d57ac2 100644 --- a/tests/Unit/TransactionRules/Triggers/NotesContainTest.php +++ b/tests/Unit/TransactionRules/Triggers/NotesContainTest.php @@ -53,38 +53,6 @@ class NotesContainTest extends TestCase $this->assertTrue($result); } - /** - * @covers \FireflyIII\TransactionRules\Triggers\NotesContain::triggered - */ - public function testTriggeredEmpty() - { - $journal = TransactionJournal::find(44); - $journal->notes()->delete(); - $note = new Note(); - $note->noteable()->associate($journal); - $note->text = ''; - $note->save(); - $trigger = NotesContain::makeFromStrings('', false); - $result = $trigger->triggered($journal); - $this->assertFalse($result); - } - - /** - * @covers \FireflyIII\TransactionRules\Triggers\NotesContain::triggered - */ - public function testTriggeredPartial() - { - $journal = TransactionJournal::find(45); - $journal->notes()->delete(); - $note = new Note(); - $note->noteable()->associate($journal); - $note->text = 'Some note'; - $note->save(); - $trigger = NotesContain::makeFromStrings('Some note contains', false); - $result = $trigger->triggered($journal); - $this->assertFalse($result); - } - /** * @covers \FireflyIII\TransactionRules\Triggers\NotesContain::triggered */ @@ -101,6 +69,22 @@ class NotesContainTest extends TestCase $this->assertFalse($result); } + /** + * @covers \FireflyIII\TransactionRules\Triggers\NotesContain::triggered + */ + public function testTriggeredEmpty() + { + $journal = TransactionJournal::find(44); + $journal->notes()->delete(); + $note = new Note(); + $note->noteable()->associate($journal); + $note->text = ''; + $note->save(); + $trigger = NotesContain::makeFromStrings('', false); + $result = $trigger->triggered($journal); + $this->assertFalse($result); + } + /** * @covers \FireflyIII\TransactionRules\Triggers\NotesContain::triggered */ @@ -113,6 +97,22 @@ class NotesContainTest extends TestCase $this->assertFalse($result); } + /** + * @covers \FireflyIII\TransactionRules\Triggers\NotesContain::triggered + */ + public function testTriggeredPartial() + { + $journal = TransactionJournal::find(45); + $journal->notes()->delete(); + $note = new Note(); + $note->noteable()->associate($journal); + $note->text = 'Some note'; + $note->save(); + $trigger = NotesContain::makeFromStrings('Some note contains', false); + $result = $trigger->triggered($journal); + $this->assertFalse($result); + } + /** * @covers \FireflyIII\TransactionRules\Triggers\NotesContain::willMatchEverything */ diff --git a/tests/Unit/TransactionRules/Triggers/TagIsTest.php b/tests/Unit/TransactionRules/Triggers/TagIsTest.php index 901aece556..b51116a06d 100644 --- a/tests/Unit/TransactionRules/Triggers/TagIsTest.php +++ b/tests/Unit/TransactionRules/Triggers/TagIsTest.php @@ -36,6 +36,20 @@ use Tests\TestCase; class TagIsTest extends TestCase { + /** + * @covers \FireflyIII\TransactionRules\Triggers\TagIs::triggered + */ + public function testNotTriggered() + { + $journal = TransactionJournal::find(58); + $journal->tags()->detach(); + $this->assertEquals(0, $journal->tags()->count()); + + $trigger = TagIs::makeFromStrings('SomeTag', false); + $result = $trigger->triggered($journal); + $this->assertFalse($result); + } + /** * @covers \FireflyIII\TransactionRules\Triggers\TagIs::triggered */ @@ -58,20 +72,6 @@ class TagIsTest extends TestCase $this->assertTrue($result); } - /** - * @covers \FireflyIII\TransactionRules\Triggers\TagIs::triggered - */ - public function testNotTriggered() - { - $journal = TransactionJournal::find(58); - $journal->tags()->detach(); - $this->assertEquals(0, $journal->tags()->count()); - - $trigger = TagIs::makeFromStrings('SomeTag', false); - $result = $trigger->triggered($journal); - $this->assertFalse($result); - } - /** * @covers \FireflyIII\TransactionRules\Triggers\TagIs::willMatchEverything */ diff --git a/tests/Unit/TransactionRules/Triggers/ToAccountIsTest.php b/tests/Unit/TransactionRules/Triggers/ToAccountIsTest.php index 2d7473f2bd..1f7cc15e27 100644 --- a/tests/Unit/TransactionRules/Triggers/ToAccountIsTest.php +++ b/tests/Unit/TransactionRules/Triggers/ToAccountIsTest.php @@ -62,16 +62,6 @@ class ToAccountIsTest extends TestCase $this->assertFalse($result); } - /** - * @covers \FireflyIII\TransactionRules\Triggers\ToAccountIs::willMatchEverything - */ - public function testWillMatchEverythingNotNull() - { - $value = 'x'; - $result = ToAccountIs::willMatchEverything($value); - $this->assertFalse($result); - } - /** * @covers \FireflyIII\TransactionRules\Triggers\ToAccountIs::willMatchEverything */ @@ -82,6 +72,16 @@ class ToAccountIsTest extends TestCase $this->assertTrue($result); } + /** + * @covers \FireflyIII\TransactionRules\Triggers\ToAccountIs::willMatchEverything + */ + public function testWillMatchEverythingNotNull() + { + $value = 'x'; + $result = ToAccountIs::willMatchEverything($value); + $this->assertFalse($result); + } + /** * @covers \FireflyIII\TransactionRules\Triggers\ToAccountIs::willMatchEverything */ diff --git a/tests/Unit/TransactionRules/Triggers/ToAccountStartsTest.php b/tests/Unit/TransactionRules/Triggers/ToAccountStartsTest.php index d8108e026f..13816f3446 100644 --- a/tests/Unit/TransactionRules/Triggers/ToAccountStartsTest.php +++ b/tests/Unit/TransactionRules/Triggers/ToAccountStartsTest.php @@ -44,7 +44,7 @@ class ToAccountStartsTest extends TestCase $transaction = $journal->transactions()->where('amount', '>', 0)->first(); $account = $transaction->account; - $trigger = ToAccountStarts::makeFromStrings(substr($account->name,0, -3), false); + $trigger = ToAccountStarts::makeFromStrings(substr($account->name, 0, -3), false); $result = $trigger->triggered($journal); $this->assertTrue($result); }