Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Try to test for confirmation errors.
James Cole653692ade092
diff --git a/app/Http/Middleware/IsNotConfirmed.php b/app/Http/Middleware/IsNotConfirmed.phpindex 237f28c17a..0037c00e7a 100644--- a/app/Http/Middleware/IsNotConfirmed.php+++ b/app/Http/Middleware/IsNotConfirmed.php@@ -17,6 +17,7 @@ use Closure;use FireflyConfig;use Illuminate\Http\Request;use Illuminate\Support\Facades\Auth;+use Log;use Preferences;/**@@ -47,9 +48,13 @@ class IsNotConfirmed}// must the user be confirmed in the first place?$mustConfirmAccount = FireflyConfig::get('must_confirm_account', config('firefly.configuration.must_confirm_account'))->data;+ Log::debug(sprintf('mustConfirmAccount is %s', $mustConfirmAccount));// user must be logged in, then continue:$isConfirmed = Preferences::get('user_confirmed', false)->data;+ Log::debug(sprintf('isConfirmed is %s', $isConfirmed));if ($isConfirmed || $mustConfirmAccount === false) {+ Log::debug('User is confirmed or user does not have to confirm account. Redirect home.');+// user account is confirmed, simply send them home.return redirect(route('home'));}diff --git a/config/filesystems.php b/config/filesystems.phpindex bd0b9738ac..cac819789e 100755--- a/config/filesystems.php+++ b/config/filesystems.php@@ -52,7 +52,7 @@ return ['disks' => [- 'local' => [+ 'local' => ['driver' => 'local','root' => storage_path('app'),],@@ -69,8 +69,10 @@ return ['driver' => 'local','root' => storage_path('database'),],--+ 'seeds' => [+ 'driver' => 'local',+ 'root' => base_path('resources/seeds'),+ ],'public' => ['driver' => 'local','root' => storage_path('app/public'),diff --git a/database/seeds/TestDataSeeder.php b/database/seeds/TestDataSeeder.phpindex 334b4725dd..a5e814da50 100644--- a/database/seeds/TestDataSeeder.php+++ b/database/seeds/TestDataSeeder.php@@ -33,7 +33,7 @@ class TestDataSeeder extends Seeder*/public function run(){- $disk = Storage::disk('database');+ $disk = Storage::disk('seeds');$env = App::environment();Log::debug('Environment is ' . $env);$fileName = 'seed.' . $env . '.json';diff --git a/storage/database/seed.bill-test.json b/resources/seeds/seed.bill-test.jsonsimilarity index 100%rename from storage/database/seed.bill-test.jsonrename to resources/seeds/seed.bill-test.jsondiff --git a/storage/database/seed.import-test.json b/resources/seeds/seed.import-test.jsonsimilarity index 100%rename from storage/database/seed.import-test.jsonrename to resources/seeds/seed.import-test.jsondiff --git a/storage/database/seed.local.json b/resources/seeds/seed.local.jsonsimilarity index 100%rename from storage/database/seed.local.jsonrename to resources/seeds/seed.local.jsondiff --git a/storage/database/seed.split.json b/resources/seeds/seed.split.jsonsimilarity index 100%rename from storage/database/seed.split.jsonrename to resources/seeds/seed.split.jsondiff --git a/storage/database/seed.testing.json b/resources/seeds/seed.testing.jsonsimilarity index 100%rename from storage/database/seed.testing.jsonrename to resources/seeds/seed.testing.jsondiff --git a/tests/acceptance/Controllers/Auth/ConfirmationControllerTest.php b/tests/acceptance/Controllers/Auth/ConfirmationControllerTest.phpindex 5039c4cd59..d93dc7a78b 100644--- a/tests/acceptance/Controllers/Auth/ConfirmationControllerTest.php+++ b/tests/acceptance/Controllers/Auth/ConfirmationControllerTest.php@@ -11,6 +11,10 @@namespace Auth;+use FireflyIII\Models\Configuration;+use FireflyIII\Models\Preference;+use FireflyIII\Support\Facades\FireflyConfig;+use FireflyIII\Support\Facades\Preferences;use TestCase;/**@@ -35,10 +39,22 @@ class ConfirmationControllerTest extends TestCase*/public function testConfirmationError(){- // Remove the following lines when you implement this test.- $this->markTestIncomplete(- 'This test has not been implemented yet.'- );+ // need a user that is not activated. And site must require activated users.+ $user = $this->user();+ $trueConfig = new Configuration;+ $trueConfig->data = true;++ $falsePreference = new Preference;+ $falsePreference->data = true;++ Preferences::shouldReceive('get')->withArgs(['user_confirmed',false])->andReturn($falsePreference);++ FireflyConfig::shouldReceive('get')->withArgs(['must_confirm_account', false])->once()->andReturn($trueConfig);++ $this->call('GET', route('confirmation_error'));+ $this->assertResponseStatus(200);+ $this->see('has been sent to the address you used during your registration');+}/**