Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Expand tests and fix various small issues in strict comparison.
James Colefa00ba2edd66
diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.phpindex d46c485086..422f3dbae5 100644--- a/app/Http/Controllers/Controller.php+++ b/app/Http/Controllers/Controller.php@@ -23,10 +23,10 @@ use Illuminate\Foundation\Auth\Access\AuthorizesRequests;use Illuminate\Foundation\Bus\DispatchesJobs;use Illuminate\Foundation\Validation\ValidatesRequests;use Illuminate\Routing\Controller as BaseController;+use Route;use Session;use URL;use View;-use Route;/*** Class Controller@@ -66,10 +66,12 @@ class Controller extends BaseController$this->dateTimeFormat = (string)trans('config.date_time');// get shown-intro-preference:- $key = 'shown_demo_' . Route::currentRouteName();- $shownDemo = Preferences::get($key, false)->data;- View::share('shownDemo', $shownDemo);- View::share('current_route_name', Route::currentRouteName());+ if (auth()->check()) {+ $key = 'shown_demo_' . Route::currentRouteName();+ $shownDemo = Preferences::get($key, false)->data;+ View::share('shownDemo', $shownDemo);+ View::share('current_route_name', Route::currentRouteName());+ }return $next($request);}diff --git a/app/Models/Account.php b/app/Models/Account.phpindex f6b4481c1d..26ab5424a5 100644--- a/app/Models/Account.php+++ b/app/Models/Account.php@@ -116,7 +116,7 @@ class Account extends Model{if (auth()->check()) {- if ($value->user_id === auth()->user()->id) {+ if (intval($value->user_id) === auth()->user()->id) {return $value;}}diff --git a/app/Models/Attachment.php b/app/Models/Attachment.phpindex ce8eeec9fc..bc9fd231f7 100644--- a/app/Models/Attachment.php+++ b/app/Models/Attachment.php@@ -55,7 +55,7 @@ class Attachment extends Model{if (auth()->check()) {- if ($value->user_id === auth()->user()->id) {+ if (intval($value->user_id) === auth()->user()->id) {return $value;}}diff --git a/app/Models/Bill.php b/app/Models/Bill.phpindex d879cbd8d3..8659be7749 100644--- a/app/Models/Bill.php+++ b/app/Models/Bill.php@@ -62,7 +62,7 @@ class Bill extends Modelpublic static function routeBinder(Bill $value){if (auth()->check()) {- if ($value->user_id === auth()->user()->id) {+ if (intval($value->user_id) === auth()->user()->id) {return $value;}}diff --git a/app/Models/Budget.php b/app/Models/Budget.phpindex cbbaafab24..6f1a5f3386 100644--- a/app/Models/Budget.php+++ b/app/Models/Budget.php@@ -85,7 +85,7 @@ class Budget extends Modelpublic static function routeBinder(Budget $value){if (auth()->check()) {- if ($value->user_id === auth()->user()->id) {+ if (intval($value->user_id) === auth()->user()->id) {return $value;}}diff --git a/app/Models/Category.php b/app/Models/Category.phpindex e10e384d35..85894a271a 100644--- a/app/Models/Category.php+++ b/app/Models/Category.php@@ -86,7 +86,7 @@ class Category extends Modelpublic static function routeBinder(Category $value){if (auth()->check()) {- if ($value->user_id === auth()->user()->id) {+ if (intval($value->user_id) === auth()->user()->id) {return $value;}}diff --git a/app/Models/Rule.php b/app/Models/Rule.phpindex 59d572c424..e8f334167b 100644--- a/app/Models/Rule.php+++ b/app/Models/Rule.php@@ -51,7 +51,7 @@ class Rule extends Modelpublic static function routeBinder(Rule $value){if (auth()->check()) {- if ($value->user_id === auth()->user()->id) {+ if (intval($value->user_id) === auth()->user()->id) {return $value;}}diff --git a/app/Models/RuleGroup.php b/app/Models/RuleGroup.phpindex 1b62d9a1fe..98ac15354b 100644--- a/app/Models/RuleGroup.php+++ b/app/Models/RuleGroup.php@@ -52,7 +52,7 @@ class RuleGroup extends Modelpublic static function routeBinder(RuleGroup $value){if (auth()->check()) {- if ($value->user_id === auth()->user()->id) {+ if (intval($value->user_id) === auth()->user()->id) {return $value;}}diff --git a/app/Models/Tag.php b/app/Models/Tag.phpindex 4ac3c24356..c7a67e4f6a 100644--- a/app/Models/Tag.php+++ b/app/Models/Tag.php@@ -87,7 +87,7 @@ class Tag extends Modelpublic static function routeBinder(Tag $value){if (auth()->check()) {- if ($value->user_id === auth()->user()->id) {+ if (intval($value->user_id) === auth()->user()->id) {return $value;}}diff --git a/config/twigbridge.php b/config/twigbridge.phpindex 095c342c9c..b6470423d3 100644--- a/config/twigbridge.php+++ b/config/twigbridge.php@@ -156,6 +156,7 @@ return ['Preferences','URL','Config',+ 'Request','ExpandedForm' => ['is_safe' => ['date', 'text', 'select', 'balance', 'optionsList', 'checkbox', 'amount', 'tags', 'integer', 'textarea', 'location',diff --git a/resources/views/errors/404.twig b/resources/views/errors/404.twigindex d84ff35ca6..73b145622f 100644--- a/resources/views/errors/404.twig+++ b/resources/views/errors/404.twig@@ -30,6 +30,8 @@<p class="text-danger">The page you have requested does not exist. Please check that you have not enteredthe wrong URL. Did you make a typo perhaps?++ <!-- {{ Request.url() }} --></p></div></div>diff --git a/tests/Feature/Controllers/Auth/TwoFactorControllerTest.php b/tests/Feature/Controllers/Auth/TwoFactorControllerTest.phpindex 5c268d3560..feed6fb66e 100644--- a/tests/Feature/Controllers/Auth/TwoFactorControllerTest.php+++ b/tests/Feature/Controllers/Auth/TwoFactorControllerTest.php@@ -35,9 +35,16 @@ class TwoFactorControllerTest extends TestCase$truePref->data = true;$secretPreference = new Preference;$secretPreference->data = 'BlablaSeecret';++Preferences::shouldReceive('get')->withArgs(['twoFactorAuthEnabled', false])->andReturn($truePref)->twice();Preferences::shouldReceive('get')->withArgs(['twoFactorAuthSecret', null])->andReturn($secretPreference)->once();Preferences::shouldReceive('get')->withArgs(['twoFactorAuthSecret'])->andReturn($secretPreference)->once();++ $falsePref = new Preference;+ $falsePref->data = false;+ Preferences::shouldReceive('get')->withArgs(['shown_demo_two-factor.index', false])->andReturn($falsePref)->once();+$response = $this->get(route('two-factor.index'));$response->assertStatus(200);}@@ -54,6 +61,8 @@ class TwoFactorControllerTest extends TestCasePreferences::shouldReceive('get')->withArgs(['twoFactorAuthEnabled', false])->andReturn($falsePreference)->twice();Preferences::shouldReceive('get')->withArgs(['twoFactorAuthSecret', null])->andReturn(null)->once();Preferences::shouldReceive('get')->withArgs(['twoFactorAuthSecret'])->andReturn(null)->once();+ Preferences::shouldReceive('get')->withArgs(['shown_demo_two-factor.index', false])->andReturn($falsePreference)->once();+$response = $this->get(route('two-factor.index'));$response->assertStatus(302);$response->assertRedirect(route('index'));@@ -74,6 +83,11 @@ class TwoFactorControllerTest extends TestCasePreferences::shouldReceive('get')->withArgs(['twoFactorAuthEnabled', false])->andReturn($truePref)->twice();Preferences::shouldReceive('get')->withArgs(['twoFactorAuthSecret', null])->andReturn($secretPreference)->once();Preferences::shouldReceive('get')->withArgs(['twoFactorAuthSecret'])->andReturn($secretPreference)->once();++ $falsePref = new Preference;+ $falsePref->data = false;+ Preferences::shouldReceive('get')->withArgs(['shown_demo_two-factor.index', false])->andReturn($falsePref)->once();+$response = $this->get(route('two-factor.index'));$response->assertStatus(500);}@@ -92,6 +106,11 @@ class TwoFactorControllerTest extends TestCasePreferences::shouldReceive('get')->withArgs(['twoFactorAuthEnabled', false])->andReturn($truePreference);Preferences::shouldReceive('get')->withArgs(['twoFactorAuthSecret', null])->andReturn($secretPreference);Preferences::shouldReceive('get')->withArgs(['twoFactorAuthSecret'])->andReturn($secretPreference);++ $falsePref = new Preference;+ $falsePref->data = false;+ Preferences::shouldReceive('get')->withArgs(['shown_demo_two-factor.lost', false])->andReturn($falsePref)->once();+$response = $this->get(route('two-factor.lost'));$response->assertStatus(200);}