2016-11-19 20:30:30 +01:00
|
|
|
<?php
|
2016-12-06 09:16:36 +01:00
|
|
|
/**
|
|
|
|
* PreferencesControllerTest.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
|
|
|
|
|
|
|
|
|
|
|
/**
|
2016-12-10 06:54:50 +01:00
|
|
|
* Generated by PHPUnit_SkeletonGenerator on 2016-12-10 at 05:51:42.
|
2016-11-19 20:30:30 +01:00
|
|
|
*/
|
|
|
|
class PreferencesControllerTest 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-11-19 20:30:30 +01:00
|
|
|
}
|
|
|
|
|
2016-12-07 19:53:41 +01:00
|
|
|
/**
|
|
|
|
* @covers \FireflyIII\Http\Controllers\PreferencesController::code
|
2016-11-19 20:30:30 +01:00
|
|
|
*/
|
|
|
|
public function testCode()
|
|
|
|
{
|
2016-12-18 17:54:11 +01:00
|
|
|
$this->be($this->user());
|
|
|
|
$this->call('get', route('preferences.code'));
|
|
|
|
$this->assertResponseStatus(200);
|
|
|
|
$this->see('<ol class="breadcrumb">');
|
2016-11-19 20:30:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2016-12-07 19:53:41 +01:00
|
|
|
* @covers \FireflyIII\Http\Controllers\PreferencesController::deleteCode
|
2016-11-19 20:30:30 +01:00
|
|
|
*/
|
|
|
|
public function testDeleteCode()
|
|
|
|
{
|
2016-12-18 17:54:11 +01:00
|
|
|
$this->be($this->user());
|
|
|
|
$this->call('get', route('preferences.delete-code'));
|
|
|
|
$this->assertResponseStatus(302);
|
|
|
|
$this->assertSessionHas('success');
|
|
|
|
$this->assertSessionHas('info');
|
|
|
|
$this->assertRedirectedToRoute('preferences.index');
|
2016-11-19 20:30:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2016-12-07 19:53:41 +01:00
|
|
|
* @covers \FireflyIII\Http\Controllers\PreferencesController::index
|
2016-11-19 20:30:30 +01:00
|
|
|
*/
|
|
|
|
public function testIndex()
|
|
|
|
{
|
2016-12-18 17:54:11 +01:00
|
|
|
$this->be($this->user());
|
|
|
|
$this->call('get', route('preferences.index'));
|
|
|
|
$this->assertResponseStatus(200);
|
|
|
|
$this->see('<ol class="breadcrumb">');
|
2016-11-19 20:30:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2016-12-07 19:53:41 +01:00
|
|
|
* @covers \FireflyIII\Http\Controllers\PreferencesController::postIndex
|
2016-11-19 20:30:30 +01:00
|
|
|
*/
|
|
|
|
public function testPostIndex()
|
|
|
|
{
|
2016-12-18 17:54:11 +01:00
|
|
|
$data = [
|
2016-12-18 19:34:03 +01:00
|
|
|
'fiscalYearStart' => '2016-01-01',
|
|
|
|
'frontPageAccounts' => [],
|
|
|
|
'viewRange' => '1M',
|
|
|
|
'customFiscalYear' => 0,
|
|
|
|
'showDepositsFrontpage' => 0,
|
|
|
|
'transactionPageSize' => 100,
|
|
|
|
'twoFactorAuthEnabled' => 0,
|
|
|
|
'language' => 'en_US',
|
|
|
|
'tj' => [],
|
2016-12-18 17:54:11 +01:00
|
|
|
];
|
2016-12-18 19:34:03 +01:00
|
|
|
|
2016-12-18 17:54:11 +01:00
|
|
|
$this->be($this->user());
|
|
|
|
$this->call('post', route('preferences.update'), $data);
|
|
|
|
$this->assertResponseStatus(302);
|
|
|
|
$this->assertSessionHas('success');
|
|
|
|
$this->assertRedirectedToRoute('preferences.index');
|
2016-11-19 20:30:30 +01:00
|
|
|
}
|
|
|
|
}
|