mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-23 14:26:58 +00:00
First set of new tests.
This commit is contained in:
@@ -16,4 +16,63 @@ use Tests\TestCase;
|
||||
class PreferencesControllerTest extends TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\PreferencesController::code
|
||||
*/
|
||||
public function testCode()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$response = $this->get(route('preferences.code'));
|
||||
$response->assertStatus(200);
|
||||
$response->assertSee('<ol class="breadcrumb">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\PreferencesController::deleteCode
|
||||
*/
|
||||
public function testDeleteCode()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$response = $this->get(route('preferences.delete-code'));
|
||||
$response->assertStatus(302);
|
||||
$response->assertSessionHas('success');
|
||||
$response->assertSessionHas('info');
|
||||
$this->assertRedirectedToRoute('preferences.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\PreferencesController::index
|
||||
*/
|
||||
public function testIndex()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$response = $this->get(route('preferences.index'));
|
||||
$response->assertStatus(200);
|
||||
$response->assertSee('<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());
|
||||
$response = $this->post(route('preferences.update'), $data);
|
||||
$response->assertStatus(302);
|
||||
$response->assertSessionHas('success');
|
||||
$this->assertRedirectedToRoute('preferences.index');
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user