mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2024-11-25 18:30:55 -06:00
This fixes the tests.
This commit is contained in:
parent
da3988cc63
commit
efe290d96c
@ -46,7 +46,12 @@ class IsConfirmed
|
||||
return redirect()->guest('login');
|
||||
}
|
||||
// must the user be confirmed in the first place?
|
||||
$mustConfirmAccount = FireflyConfig::get('must_confirm_account', config('firefly.configuration.must_confirm_account'))->data;
|
||||
$confirmPreference = FireflyConfig::get('must_confirm_account', config('firefly.configuration.must_confirm_account'));
|
||||
$mustConfirmAccount = false;
|
||||
if (!is_null($confirmPreference)) {
|
||||
$mustConfirmAccount = $confirmPreference->data;
|
||||
}
|
||||
|
||||
// user must be logged in, then continue:
|
||||
$isConfirmed = Preferences::get('user_confirmed', false)->data;
|
||||
|
||||
|
@ -11,6 +11,8 @@
|
||||
|
||||
namespace Admin;
|
||||
|
||||
use FireflyIII\Models\Configuration;
|
||||
use FireflyIII\Support\Facades\FireflyConfig;
|
||||
use TestCase;
|
||||
|
||||
/**
|
||||
@ -27,6 +29,8 @@ class ConfigurationControllerTest extends TestCase
|
||||
public function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
FireflyConfig::shouldReceive('get')->withArgs(['must_confirm_account', false])->once();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -36,6 +40,17 @@ class ConfigurationControllerTest extends TestCase
|
||||
public function testIndex()
|
||||
{
|
||||
$this->be($this->user());
|
||||
|
||||
$falseConfig = new Configuration;
|
||||
$falseConfig->data = false;
|
||||
|
||||
$trueConfig = new Configuration;
|
||||
$trueConfig->data = true;
|
||||
|
||||
FireflyConfig::shouldReceive('get')->withArgs(['single_user_mode', true])->once()->andReturn($trueConfig);
|
||||
FireflyConfig::shouldReceive('get')->withArgs(['must_confirm_account', false])->once()->andReturn($falseConfig);
|
||||
FireflyConfig::shouldReceive('get')->withArgs(['is_demo_site', false])->once()->andReturn($falseConfig);
|
||||
|
||||
$this->call('GET', route('admin.configuration.index'));
|
||||
$this->assertResponseStatus(200);
|
||||
}
|
||||
@ -46,14 +61,13 @@ class ConfigurationControllerTest extends TestCase
|
||||
*/
|
||||
public function testPostIndex()
|
||||
{
|
||||
|
||||
FireflyConfig::shouldReceive('set')->withArgs(['single_user_mode', false])->once();
|
||||
FireflyConfig::shouldReceive('set')->withArgs(['must_confirm_account', false])->once();
|
||||
FireflyConfig::shouldReceive('set')->withArgs(['is_demo_site', false])->once();
|
||||
|
||||
$this->be($this->user());
|
||||
$this->call('POST', route('admin.configuration.index.post'));
|
||||
|
||||
// mock FireflyConfig
|
||||
\FireflyConfig::shouldReceive('get')->withArgs(['single_user_mode', false])->once();
|
||||
\FireflyConfig::shouldReceive('get')->withArgs(['must_confirm_account', false])->once();
|
||||
\FireflyConfig::shouldReceive('get')->withArgs(['is_demo_site', false])->once();
|
||||
|
||||
$this->assertSessionHas('success');
|
||||
$this->assertResponseStatus(302);
|
||||
}
|
||||
|
@ -35,10 +35,9 @@ class HomeControllerTest extends TestCase
|
||||
*/
|
||||
public function testIndex()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$this->be($this->user());
|
||||
$this->call('GET', route('admin.index'));
|
||||
$this->assertResponseStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -35,10 +35,9 @@ class UserControllerTest extends TestCase
|
||||
*/
|
||||
public function testEdit()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$this->be($this->user());
|
||||
$this->call('GET', route('admin.users.edit', [1]));
|
||||
$this->assertResponseStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -47,10 +46,9 @@ class UserControllerTest extends TestCase
|
||||
*/
|
||||
public function testIndex()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$this->be($this->user());
|
||||
$this->call('GET', route('admin.users'));
|
||||
$this->assertResponseStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -59,10 +57,9 @@ class UserControllerTest extends TestCase
|
||||
*/
|
||||
public function testShow()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
$this->be($this->user());
|
||||
$this->call('GET', route('admin.users.edit', [1]));
|
||||
$this->assertResponseStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user