mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Try to test for confirmation errors.
This commit is contained in:
parent
72c6bfee7e
commit
653692ade0
@ -17,6 +17,7 @@ use Closure;
|
|||||||
use FireflyConfig;
|
use FireflyConfig;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Log;
|
||||||
use Preferences;
|
use Preferences;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -47,9 +48,13 @@ class IsNotConfirmed
|
|||||||
}
|
}
|
||||||
// must the user be confirmed in the first place?
|
// must the user be confirmed in the first place?
|
||||||
$mustConfirmAccount = FireflyConfig::get('must_confirm_account', config('firefly.configuration.must_confirm_account'))->data;
|
$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:
|
// user must be logged in, then continue:
|
||||||
$isConfirmed = Preferences::get('user_confirmed', false)->data;
|
$isConfirmed = Preferences::get('user_confirmed', false)->data;
|
||||||
|
Log::debug(sprintf('isConfirmed is %s', $isConfirmed));
|
||||||
if ($isConfirmed || $mustConfirmAccount === false) {
|
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.
|
// user account is confirmed, simply send them home.
|
||||||
return redirect(route('home'));
|
return redirect(route('home'));
|
||||||
}
|
}
|
||||||
|
@ -69,8 +69,10 @@ return [
|
|||||||
'driver' => 'local',
|
'driver' => 'local',
|
||||||
'root' => storage_path('database'),
|
'root' => storage_path('database'),
|
||||||
],
|
],
|
||||||
|
'seeds' => [
|
||||||
|
'driver' => 'local',
|
||||||
|
'root' => base_path('resources/seeds'),
|
||||||
|
],
|
||||||
'public' => [
|
'public' => [
|
||||||
'driver' => 'local',
|
'driver' => 'local',
|
||||||
'root' => storage_path('app/public'),
|
'root' => storage_path('app/public'),
|
||||||
|
@ -33,7 +33,7 @@ class TestDataSeeder extends Seeder
|
|||||||
*/
|
*/
|
||||||
public function run()
|
public function run()
|
||||||
{
|
{
|
||||||
$disk = Storage::disk('database');
|
$disk = Storage::disk('seeds');
|
||||||
$env = App::environment();
|
$env = App::environment();
|
||||||
Log::debug('Environment is ' . $env);
|
Log::debug('Environment is ' . $env);
|
||||||
$fileName = 'seed.' . $env . '.json';
|
$fileName = 'seed.' . $env . '.json';
|
||||||
|
@ -11,6 +11,10 @@
|
|||||||
|
|
||||||
namespace Auth;
|
namespace Auth;
|
||||||
|
|
||||||
|
use FireflyIII\Models\Configuration;
|
||||||
|
use FireflyIII\Models\Preference;
|
||||||
|
use FireflyIII\Support\Facades\FireflyConfig;
|
||||||
|
use FireflyIII\Support\Facades\Preferences;
|
||||||
use TestCase;
|
use TestCase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -35,10 +39,22 @@ class ConfirmationControllerTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
public function testConfirmationError()
|
public function testConfirmationError()
|
||||||
{
|
{
|
||||||
// Remove the following lines when you implement this test.
|
// need a user that is not activated. And site must require activated users.
|
||||||
$this->markTestIncomplete(
|
$user = $this->user();
|
||||||
'This test has not been implemented yet.'
|
$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');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user