More extensions and views. First home view is semi-complete, time to write some tests again.

This commit is contained in:
James Cole
2014-07-06 21:07:52 +02:00
parent 4192f2bc8f
commit 2f5afc80a3
14 changed files with 206 additions and 51 deletions

View File

@@ -7,6 +7,33 @@ class AccountControllerTest extends TestCase
parent::setUp();
}
public function testIndex() {
$list = [
'personal' => [],
'beneficiaries' => [],
'initial' => [],
'cash' => []
];
// mock:
View::shouldReceive('share');
View::shouldReceive('make')->with('accounts.index')->once()->andReturn(\Mockery::self())
->shouldReceive('with')->once()->with('accounts',$list);
// mock account repository:
$accounts = $this->mock('Firefly\Storage\Account\AccountRepositoryInterface');
$accounts->shouldReceive('get')->andReturn([]);
// call
$this->call('GET', '/accounts');
// test
$this->assertResponseOk();
}
public function testCreate()
{
// mock:
@@ -22,8 +49,14 @@ class AccountControllerTest extends TestCase
public function testShow()
{
// mock account repository:
$accounts = $this->mock('Firefly\Storage\Account\AccountRepositoryInterface');
$accounts->shouldReceive('get')->with(1)->andReturn([]);
// the route filters on accounts using Eloquent, maybe fix that instead?
$this->assertTrue(true);
// call
$this->call('GET', '/accounts/1');
// test
$this->assertResponseOk();
}
}