mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-25 06:51:08 +00:00
Fixed tests.
This commit is contained in:
@@ -26,7 +26,7 @@ class AccountController extends \BaseController
|
|||||||
'initial' => [],
|
'initial' => [],
|
||||||
'cash' => []
|
'cash' => []
|
||||||
];
|
];
|
||||||
$total = $all->count();
|
$total = count($all);
|
||||||
|
|
||||||
foreach ($all as $account) {
|
foreach ($all as $account) {
|
||||||
|
|
||||||
|
@@ -7,20 +7,22 @@ class AccountControllerTest extends TestCase
|
|||||||
parent::setUp();
|
parent::setUp();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testIndex() {
|
public function testIndex()
|
||||||
|
{
|
||||||
|
|
||||||
$list = [
|
$list = [
|
||||||
'personal' => [],
|
'personal' => [],
|
||||||
'beneficiaries' => [],
|
'beneficiaries' => [],
|
||||||
'initial' => [],
|
'initial' => [],
|
||||||
'cash' => []
|
'cash' => []
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
// mock:
|
// mock:
|
||||||
View::shouldReceive('share');
|
View::shouldReceive('share');
|
||||||
View::shouldReceive('make')->with('accounts.index')->once()->andReturn(\Mockery::self())
|
View::shouldReceive('make')->with('accounts.index')->once()->andReturn(\Mockery::self())
|
||||||
->shouldReceive('with')->once()->with('accounts',$list);
|
->shouldReceive('with')->once()->with('accounts', $list)->andReturn(\Mockery::self())
|
||||||
|
->shouldReceive('with')->once()->with('total', 0)->andReturn(\Mockery::self());
|
||||||
|
|
||||||
// mock account repository:
|
// mock account repository:
|
||||||
$accounts = $this->mock('Firefly\Storage\Account\AccountRepositoryInterface');
|
$accounts = $this->mock('Firefly\Storage\Account\AccountRepositoryInterface');
|
||||||
@@ -59,4 +61,10 @@ class AccountControllerTest extends TestCase
|
|||||||
// test
|
// test
|
||||||
$this->assertResponseOk();
|
$this->assertResponseOk();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function tearDown()
|
||||||
|
{
|
||||||
|
Mockery::close();
|
||||||
|
}
|
||||||
}
|
}
|
@@ -29,6 +29,7 @@ class HomeControllerTest extends TestCase
|
|||||||
// mock preferences helper:
|
// mock preferences helper:
|
||||||
$preferences = $this->mock('Firefly\Helper\Preferences\PreferencesHelperInterface');
|
$preferences = $this->mock('Firefly\Helper\Preferences\PreferencesHelperInterface');
|
||||||
$preferences->shouldReceive('get')->with('frontpageAccounts',[])->andReturn(new \Preference)->once();
|
$preferences->shouldReceive('get')->with('frontpageAccounts',[])->andReturn(new \Preference)->once();
|
||||||
|
$preferences->shouldReceive('get')->with('viewRange', 'week')->once()->andReturn('week');
|
||||||
|
|
||||||
// call
|
// call
|
||||||
$this->call('GET', '/');
|
$this->call('GET', '/');
|
||||||
@@ -37,4 +38,8 @@ class HomeControllerTest extends TestCase
|
|||||||
$this->assertResponseOk();
|
$this->assertResponseOk();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function tearDown()
|
||||||
|
{
|
||||||
|
Mockery::close();
|
||||||
|
}
|
||||||
}
|
}
|
@@ -19,4 +19,9 @@ class MigrationControllerTest extends TestCase
|
|||||||
// test
|
// test
|
||||||
$this->assertResponseOk();
|
$this->assertResponseOk();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function tearDown()
|
||||||
|
{
|
||||||
|
Mockery::close();
|
||||||
|
}
|
||||||
}
|
}
|
@@ -140,4 +140,9 @@ class ProfileControllerTest extends TestCase
|
|||||||
$this->assertSessionHas('success', 'Password changed!');
|
$this->assertSessionHas('success', 'Password changed!');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function tearDown()
|
||||||
|
{
|
||||||
|
Mockery::close();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
Reference in New Issue
Block a user