Files
firefly-iii/tests/acceptance/Controllers/PreferencesControllerTest.php
James Cole 8deb92c3e5 More tests.
2016-12-18 19:34:03 +01:00

88 lines
2.4 KiB
PHP

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