mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-01-09 20:11:22 +00:00
Fixed all tests.
This commit is contained in:
@@ -14,18 +14,21 @@ class PreferencesControllerTest extends TestCase
|
||||
$pref = $this->mock('Preference');
|
||||
$pref->shouldReceive('getAttribute', 'data')->andReturn([]);
|
||||
|
||||
$viewPref = $this->mock('Preference');
|
||||
$viewPref->shouldReceive('getAttribute', 'data')->andReturn('1M');
|
||||
|
||||
|
||||
// mock view:
|
||||
View::shouldReceive('share');
|
||||
View::shouldReceive('make')->with('preferences.index')->once()->andReturn(\Mockery::self())
|
||||
->shouldReceive('with')->once()->with('accounts', [])->andReturn(\Mockery::self())
|
||||
->shouldReceive('with')->once()->with('viewRange', '1M')->andReturn(\Mockery::self())
|
||||
->shouldReceive('with')->once()->with('frontpageAccounts', $pref)->andReturn(\Mockery::self());
|
||||
|
||||
|
||||
|
||||
$preferences = $this->mock('Firefly\Helper\Preferences\PreferencesHelperInterface');
|
||||
$preferences->shouldReceive('get')->with('frontpageAccounts', [])->andReturn($pref);
|
||||
$preferences->shouldReceive('get')->with('viewRange', '1M')->andReturn($viewPref);
|
||||
|
||||
// mock account repository:
|
||||
$accounts = $this->mock('Firefly\Storage\Account\AccountRepositoryInterface');
|
||||
@@ -39,14 +42,15 @@ class PreferencesControllerTest extends TestCase
|
||||
$this->assertResponseOk();
|
||||
}
|
||||
|
||||
public function testPostIndex() {
|
||||
public function testPostIndex()
|
||||
{
|
||||
// mock
|
||||
$preferences = $this->mock('Firefly\Helper\Preferences\PreferencesHelperInterface');
|
||||
$preferences->shouldReceive('set')->with('frontpageAccounts', [1])->andReturn(true);
|
||||
$preferences->shouldReceive('set')->with('viewRange', '1M')->andReturn(true);
|
||||
|
||||
// call
|
||||
$this->call('POST', '/preferences',['frontpageAccounts' => [1]]);
|
||||
|
||||
$this->call('POST', '/preferences', ['frontpageAccounts' => [1], 'viewRange' => '1M']);
|
||||
|
||||
|
||||
// test
|
||||
|
||||
Reference in New Issue
Block a user