Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
This fixes the tests.
James Coleefe290d96cef
diff --git a/app/Http/Middleware/IsConfirmed.php b/app/Http/Middleware/IsConfirmed.phpindex ef8e398a9e..1f53e2f41a 100644--- a/app/Http/Middleware/IsConfirmed.php+++ b/app/Http/Middleware/IsConfirmed.php@@ -46,7 +46,12 @@ class IsConfirmedreturn 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;diff --git a/tests/acceptance/Controllers/Admin/ConfigurationControllerTest.php b/tests/acceptance/Controllers/Admin/ConfigurationControllerTest.phpindex d9be6296fe..85abca1373 100644--- a/tests/acceptance/Controllers/Admin/ConfigurationControllerTest.php+++ b/tests/acceptance/Controllers/Admin/ConfigurationControllerTest.php@@ -11,6 +11,8 @@namespace Admin;+use FireflyIII\Models\Configuration;+use FireflyIII\Support\Facades\FireflyConfig;use TestCase;/**@@ -27,6 +29,8 @@ class ConfigurationControllerTest extends TestCasepublic function setUp(){parent::setUp();++ FireflyConfig::shouldReceive('get')->withArgs(['must_confirm_account', false])->once();}/**@@ -36,6 +40,17 @@ class ConfigurationControllerTest extends TestCasepublic 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(){- $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();+ 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'));$this->assertSessionHas('success');$this->assertResponseStatus(302);}diff --git a/tests/acceptance/Controllers/Admin/HomeControllerTest.php b/tests/acceptance/Controllers/Admin/HomeControllerTest.phpindex 0d5b851fd5..260417cdb2 100644--- a/tests/acceptance/Controllers/Admin/HomeControllerTest.php+++ b/tests/acceptance/Controllers/Admin/HomeControllerTest.php@@ -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);}/**diff --git a/tests/acceptance/Controllers/Admin/UserControllerTest.php b/tests/acceptance/Controllers/Admin/UserControllerTest.phpindex 8c881daf40..0058c92a0d 100644--- a/tests/acceptance/Controllers/Admin/UserControllerTest.php+++ b/tests/acceptance/Controllers/Admin/UserControllerTest.php@@ -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);}/**