Files
firefly-iii/tests/acceptance/Controllers/Admin/ConfigurationControllerTest.php

83 lines
2.4 KiB
PHP
Raw Normal View History

2016-11-19 20:30:30 +01:00
<?php
2016-12-06 09:16:36 +01:00
/**
* 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.
*/
2016-11-19 20:30:30 +01:00
namespace Admin;
2016-11-20 11:43:19 +01:00
2016-12-07 20:45:26 +01:00
use FireflyIII\Models\Configuration;
use FireflyIII\Support\Facades\FireflyConfig;
2016-11-19 20:30:30 +01:00
use TestCase;
/**
2016-12-07 19:53:41 +01:00
* Generated by PHPUnit_SkeletonGenerator on 2016-12-07 at 18:50:31.
2016-11-19 20:30:30 +01:00
*/
class ConfigurationControllerTest extends TestCase
{
2016-11-20 07:24:18 +01:00
2016-11-19 20:30:30 +01:00
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
public function setUp()
{
2016-11-20 08:30:25 +01:00
parent::setUp();
2016-12-07 20:45:26 +01:00
FireflyConfig::shouldReceive('get')->withArgs(['must_confirm_account', false])->once();
2016-11-19 20:30:30 +01:00
}
/**
2016-12-07 19:53:41 +01:00
* @covers \FireflyIII\Http\Controllers\Admin\ConfigurationController::index
2016-11-26 08:55:26 +01:00
* Implement testIndex().
2016-11-19 20:30:30 +01:00
*/
public function testIndex()
{
2016-12-07 20:06:06 +01:00
$this->be($this->user());
2016-12-07 20:45:26 +01:00
$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);
2016-12-07 20:06:06 +01:00
$this->call('GET', route('admin.configuration.index'));
$this->assertResponseStatus(200);
2016-11-19 20:30:30 +01:00
}
/**
2016-12-07 19:53:41 +01:00
* @covers \FireflyIII\Http\Controllers\Admin\ConfigurationController::store
2016-11-26 08:55:26 +01:00
* Implement testStore().
2016-11-19 20:30:30 +01:00
*/
2016-12-07 20:06:06 +01:00
public function testPostIndex()
2016-11-19 20:30:30 +01:00
{
2016-12-07 20:06:06 +01:00
2016-12-07 20:45:26 +01:00
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();
2016-12-07 20:06:06 +01:00
2016-12-07 20:45:26 +01:00
$this->be($this->user());
$this->call('POST', route('admin.configuration.index.post'));
2016-12-07 20:06:06 +01:00
$this->assertSessionHas('success');
$this->assertResponseStatus(302);
2016-11-19 20:30:30 +01:00
}
2016-11-20 11:43:19 +01:00
/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*/
protected function tearDown()
{
}
2016-11-19 20:30:30 +01:00
}