mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-18 18:44:16 +00:00
83 lines
2.4 KiB
PHP
83 lines
2.4 KiB
PHP
<?php
|
|
/**
|
|
* ConfigurationControllerTest.php
|
|
* Copyright (C) 2016 thegrumpydictator@gmail.com
|
|
*
|
|
* This software may be modified and distributed under the terms of the
|
|
* Creative Commons Attribution-ShareAlike 4.0 International License.
|
|
*
|
|
* See the LICENSE file for details.
|
|
*/
|
|
|
|
namespace Admin;
|
|
|
|
use FireflyIII\Models\Configuration;
|
|
use FireflyIII\Support\Facades\FireflyConfig;
|
|
use TestCase;
|
|
|
|
/**
|
|
* Generated by PHPUnit_SkeletonGenerator on 2016-12-07 at 18:50:31.
|
|
*/
|
|
class ConfigurationControllerTest extends TestCase
|
|
{
|
|
|
|
|
|
/**
|
|
* Sets up the fixture, for example, opens a network connection.
|
|
* This method is called before a test is executed.
|
|
*/
|
|
public function setUp()
|
|
{
|
|
parent::setUp();
|
|
|
|
FireflyConfig::shouldReceive('get')->withArgs(['must_confirm_account', false])->once();
|
|
}
|
|
|
|
/**
|
|
* @covers \FireflyIII\Http\Controllers\Admin\ConfigurationController::index
|
|
* Implement testIndex().
|
|
*/
|
|
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);
|
|
}
|
|
|
|
/**
|
|
* @covers \FireflyIII\Http\Controllers\Admin\ConfigurationController::store
|
|
* Implement testStore().
|
|
*/
|
|
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'));
|
|
$this->assertSessionHas('success');
|
|
$this->assertResponseStatus(302);
|
|
}
|
|
|
|
/**
|
|
* Tears down the fixture, for example, closes a network connection.
|
|
* This method is called after a test is executed.
|
|
*/
|
|
protected function tearDown()
|
|
{
|
|
}
|
|
}
|